Skip to content

Commit

Permalink
update MDAL to 1.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
uclaros authored and nyalldawson committed Feb 21, 2025
1 parent f38d190 commit 626efea
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion external/mdal/frmts/mdal_2dm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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] ) );
Expand Down
2 changes: 1 addition & 1 deletion external/mdal/frmts/mdal_hec2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
13 changes: 4 additions & 9 deletions external/mdal/frmts/mdal_mike21.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand Down Expand Up @@ -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." );
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions external/mdal/frmts/mdal_ugrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand Down Expand Up @@ -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 )
{
Expand Down
2 changes: 1 addition & 1 deletion external/mdal/frmts/mdal_xdmf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" );
Expand Down
2 changes: 1 addition & 1 deletion external/mdal/mdal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion external/mdal/mdal_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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] );
Expand Down

0 comments on commit 626efea

Please sign in to comment.