@@ -2891,21 +2891,21 @@ TEST_CASE("git_hdf5_legacy_picongpu", "[serial][hdf5]")
28912891
28922892TEST_CASE (" git_hdf5_sample_attribute_test" , " [serial][hdf5]" )
28932893{
2894- try
2895- {
2896- Series o = Series (" ../samples/git-sample/data%T.h5" , Access::READ_ONLY);
2897-
2894+ auto verifySeries = [](Series o, bool this_is_the_original_file) {
28982895 REQUIRE (o.openPMD () == " 1.1.0" );
28992896 REQUIRE (o.openPMDextension () == 1 );
29002897 REQUIRE (o.basePath () == " /data/%T/" );
29012898 REQUIRE (o.meshesPath () == " fields/" );
29022899 REQUIRE (o.particlesPath () == " particles/" );
2903- REQUIRE (o.iterationEncoding () == IterationEncoding::fileBased);
2904- REQUIRE (o.iterationFormat () == " data%T.h5" );
2905- REQUIRE (o.name () == " data%T" );
2900+ if (this_is_the_original_file)
2901+ {
2902+ REQUIRE (o.iterationEncoding () == IterationEncoding::fileBased);
2903+ REQUIRE (o.iterationFormat () == " data%T.h5" );
2904+ REQUIRE (o.name () == " data%T" );
29062905
2907- REQUIRE (o.iterations .size () == 5 );
2908- REQUIRE (o.iterations .count (100 ) == 1 );
2906+ REQUIRE (o.iterations .size () == 5 );
2907+ REQUIRE (o.iterations .count (100 ) == 1 );
2908+ }
29092909
29102910 Iteration &iteration_100 = o.iterations [100 ];
29112911 REQUIRE (iteration_100.time <double >() == 3.2847121452090077e-14 );
@@ -3135,6 +3135,30 @@ TEST_CASE("git_hdf5_sample_attribute_test", "[serial][hdf5]")
31353135 REQUIRE (weighting_scalar.getDatatype () == Datatype::DOUBLE);
31363136 REQUIRE (weighting_scalar.getDimensionality () == 1 );
31373137 REQUIRE (weighting_scalar.getExtent () == e);
3138+ };
3139+
3140+ try
3141+ {
3142+ {
3143+ Series o =
3144+ Series (" ../samples/git-sample/data%T.h5" , Access::READ_ONLY);
3145+ verifySeries (o, true );
3146+
3147+ Series fromTemplate (
3148+ " ../samples/initialized_from_git_sample.json" ,
3149+ Access::CREATE,
3150+ R"( json.mode = "template")" );
3151+ auxiliary::initializeFromTemplate (fromTemplate, o, 100 );
3152+ fromTemplate.flush ();
3153+ }
3154+
3155+ {
3156+ Series o (
3157+ " ../samples/initialized_from_git_sample.json" ,
3158+ Access::READ_ONLY,
3159+ R"( json.mode = "template")" );
3160+ verifySeries (o, false );
3161+ }
31383162 }
31393163 catch (error::ReadError &e)
31403164 {
0 commit comments