Skip to content

Commit

Permalink
dito for hdf5
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Dec 23, 2020
1 parent 1cae0d2 commit 2191931
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
1 change: 1 addition & 0 deletions include/openPMD/IO/AbstractIOHandlerImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ class AbstractIOHandlerImpl
*
* The operation should overwrite existing file positions, even when the Writable was already marked written.
* The path parameters.path may contain multiple levels (e.g. first/second/third/). This path should be relative (i.e. it should not start with a slash "/").
* The number of levels may be zero, i.e. parameters.path may be an empty string.
* The Writables file position should correspond to the complete opened path (i.e. first/second/third/ should be assigned to the Writables file position).
* The Writable should be marked written when the operation completes successfully.
*/
Expand Down
24 changes: 14 additions & 10 deletions src/IO/HDF5/HDF5IOHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,19 +518,23 @@ HDF5IOHandlerImpl::openPath(

/* Sanitize path */
std::string path = parameters.path;
if( auxiliary::starts_with(path, '/') )
path = auxiliary::replace_first(path, "/", "");
if( !auxiliary::ends_with(path, '/') )
path += '/';
if( !path.empty() )
{
if( auxiliary::starts_with(path, '/') )
path = auxiliary::replace_first(path, "/", "");
if( !auxiliary::ends_with(path, '/') )
path += '/';
path_id = H5Gopen(node_id,
path.c_str(),
H5P_DEFAULT);
VERIFY(path_id >= 0, "[HDF5] Internal error: Failed to open HDF5 group during path opening");

path_id = H5Gopen(node_id,
path.c_str(),
H5P_DEFAULT);
VERIFY(path_id >= 0, "[HDF5] Internal error: Failed to open HDF5 group during path opening");
herr_t status;
status = H5Gclose(path_id);
VERIFY(status == 0, "[HDF5] Internal error: Failed to close HDF5 group during path opening");
}

herr_t status;
status = H5Gclose(path_id);
VERIFY(status == 0, "[HDF5] Internal error: Failed to close HDF5 group during path opening");
status = H5Gclose(node_id);
VERIFY(status == 0, "[HDF5] Internal error: Failed to close HDF5 group during path opening");

Expand Down
10 changes: 4 additions & 6 deletions test/SerialIOTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3188,12 +3188,10 @@ stepBasedSingleIteration( std::string const & file )

TEST_CASE( "stepBasedSingleIteration", "[serial][adios2]" )
{
stepBasedSingleIteration("../samples/stepBasedSingleIteration.bp");
stepBasedSingleIteration("../samples/stepBasedSingleIteration.json");
// for( auto const & t : getFileExtensions() )
// {
// stepBasedSingleIteration( "../samples/stepBasedSingleIteration." + t );
// }
for( auto const & t : getFileExtensions() )
{
stepBasedSingleIteration( "../samples/stepBasedSingleIteration." + t );
}
}

#if openPMD_HAVE_ADIOS2
Expand Down

0 comments on commit 2191931

Please sign in to comment.