update MDAL to 1.3.1

This commit is contained in:
uclaros 2025-02-20 21:57:36 +02:00 committed by Nyall Dawson
parent f38d190f56
commit 626efeafe6
7 changed files with 11 additions and 16 deletions

View File

@ -402,7 +402,7 @@ void MDAL::Driver2dm::save( const std::string &fileName, const std::string &, MD
for ( size_t j = 0; j < 2; ++j )
{
line.append( " " );
line.append( MDAL::doubleToString( vertex[j], 8, true ) );
line.append( MDAL::doubleToString( vertex[j], 16 ) );
}
line.append( " " );
line.append( MDAL::doubleToString( vertex[2] ) );

View File

@ -122,7 +122,7 @@ static MDAL::DateTime convertToDateTime( const std::string strDateTime )
{
//HECRAS format date is 01JAN2000
auto data = MDAL::split( strDateTime, " " );
auto data = MDAL::split( strDateTime, ' ' );
if ( data.size() < 2 )
return MDAL::DateTime();

View File

@ -23,13 +23,6 @@
#define DRIVER_NAME "Mike21"
// function to split using regex, by default split on whitespace characters
std::vector<std::string> regex_split( const std::string &input, const std::regex &split_regex = std::regex{"\\s+"} )
{
std::sregex_token_iterator iter( input.begin(), input.end(), split_regex, -1 );
std::sregex_token_iterator end;
return {iter, end};
}
static bool parse_vertex_id_gaps( std::map<size_t, size_t> &vertexIDtoIndex, size_t vertexIndex, size_t vertexID )
{
@ -246,7 +239,8 @@ std::unique_ptr<MDAL::Mesh> MDAL::DriverMike21::load( const std::string &meshFil
{
if ( 0 < lineNumber && lineNumber < mVertexCount + 1 )
{
chunks = regex_split( MDAL::trim( line ) );
std::replace( line.begin(), line.end(), '\t', ' ' );
chunks = MDAL::split( MDAL::trim( line ), ' ' );
if ( chunks.size() != 5 )
{
MDAL::Log::error( MDAL_Status::Err_InvalidData, name(), "vertex line in invalid format." );
@ -283,7 +277,8 @@ std::unique_ptr<MDAL::Mesh> MDAL::DriverMike21::load( const std::string &meshFil
if ( mVertexCount + 1 < lineNumber )
{
chunks = regex_split( MDAL::trim( line ) );
std::replace( line.begin(), line.end(), '\t', ' ' );
chunks = MDAL::split( MDAL::trim( line ), ' ' );
assert( faceIndex < faceCount );
size_t faceVertexCount = chunks.size() - 1;

View File

@ -461,7 +461,7 @@ void MDAL::DriverUgrid::ignore1DMeshVariables( const std::string &mesh, std::set
for ( const std::string &coordinateIt : coordinateVarsToIgnore )
{
std::string coordinatesVar = mNcFile->getAttrStr( mesh, coordinateIt );
std::vector<std::string> allCoords = MDAL::split( coordinatesVar, " " );
std::vector<std::string> allCoords = MDAL::split( coordinatesVar, ' ' );
for ( const std::string &var : allCoords )
{
@ -1041,7 +1041,7 @@ void MDAL::DriverUgrid::writeVariables( MDAL::Mesh *mesh, const std::string &mes
}
else
{
std::vector<std::string> words = MDAL::split( mesh->crs(), ":" );
std::vector<std::string> words = MDAL::split( mesh->crs(), ':' );
if ( words[0] == "EPSG" && words.size() > 1 )
{

View File

@ -359,7 +359,7 @@ void MDAL::DriverXdmf::hdf5NamePath( const std::string &dataItemPath, std::strin
path.erase( 0, startpos );
}
std::vector<std::string> chunks = MDAL::split( path, ":" );
std::vector<std::string> chunks = MDAL::split( path, ':' );
if ( chunks.size() != 2 )
{
throw MDAL::Error( MDAL_Status::Err_UnknownFormat, "must be in format fileName:hdfPath" );

View File

@ -21,7 +21,7 @@ static const char *EMPTY_STR = "";
const char *MDAL_Version()
{
return "1.3.0";
return "1.3.1";
}
MDAL_Status MDAL_LastStatus()

View File

@ -964,7 +964,7 @@ MDAL::DateTime MDAL::parseCFReferenceTime( const std::string &timeInformation, c
if ( strings.size() > 3 )
{
std::string timeString = strings[3];
auto timeStringsValue = MDAL::split( timeString, ":" );
auto timeStringsValue = MDAL::split( timeString, ':' );
if ( timeStringsValue.size() == 3 )
{
hours = MDAL::toInt( timeStringsValue[0] );