@@ -4302,3 +4302,75 @@ TEST_CASE( "deferred_parsing", "[serial]" )
43024302 deferred_parsing ( t );
43034303 }
43044304}
4305+
4306+ void chaotic_stream ( std::string filename, bool variableBased )
4307+ {
4308+ std::vector< uint64_t > iterations{ 5 , 9 , 1 , 3 , 4 , 6 , 7 , 8 , 2 , 0 };
4309+ std::string jsonConfig = R"(
4310+ {
4311+ "adios2": {
4312+ "schema": 20210209,
4313+ "engine": {
4314+ "type": "bp4",
4315+ "usesteps": true
4316+ }
4317+ }
4318+ })" ;
4319+
4320+ bool weirdOrderWhenReading{};
4321+
4322+ {
4323+ Series series ( filename, Access::CREATE, jsonConfig );
4324+ /*
4325+ * When using ADIOS2 steps, iterations are read not by logical order
4326+ * (iteration index), but by order of writing.
4327+ */
4328+ weirdOrderWhenReading = series.backend () == " ADIOS2" &&
4329+ series.iterationEncoding () != IterationEncoding::fileBased;
4330+ if ( variableBased )
4331+ {
4332+ if ( series.backend () != " ADIOS2" )
4333+ {
4334+ return ;
4335+ }
4336+ series.setIterationEncoding ( IterationEncoding::variableBased );
4337+ }
4338+ for ( auto currentIteration : iterations )
4339+ {
4340+ auto dataset =
4341+ series.writeIterations ()[ currentIteration ]
4342+ .meshes [ " iterationOrder" ][ MeshRecordComponent::SCALAR ];
4343+ dataset.resetDataset ( { determineDatatype< uint64_t >(), { 10 } } );
4344+ dataset.storeChunk ( iterations, { 0 }, { 10 } );
4345+ // series.writeIterations()[ currentIteration ].close();
4346+ }
4347+ }
4348+
4349+ {
4350+ Series series ( filename, Access::READ_ONLY );
4351+ size_t index = 0 ;
4352+ for ( auto iteration : series.readIterations () )
4353+ {
4354+ if ( weirdOrderWhenReading )
4355+ {
4356+ REQUIRE ( iteration.iterationIndex == iterations[ index ] );
4357+ }
4358+ else
4359+ {
4360+ REQUIRE ( iteration.iterationIndex == index );
4361+ }
4362+ ++index;
4363+ }
4364+ REQUIRE ( index == iterations.size () );
4365+ }
4366+ }
4367+
4368+ TEST_CASE ( " chaotic_stream" , " [serial]" )
4369+ {
4370+ for ( auto const & t : testedFileExtensions () )
4371+ {
4372+ chaotic_stream ( " ../samples/chaotic_stream_filebased_%T." + t, false );
4373+ chaotic_stream ( " ../samples/chaotic_stream." + t, false );
4374+ chaotic_stream ( " ../samples/chaotic_stream_vbased." + t, true );
4375+ }
4376+ }
0 commit comments