@@ -4509,11 +4509,9 @@ TEST_CASE( "deferred_parsing", "[serial]" )
45094509 }
45104510}
45114511
4512- // @todo merge this back with the chaotic_stream test of PR #949
4513- // (bug noticed while working on that branch)
4514- void no_explicit_flush ( std::string filename )
4512+ void chaotic_stream ( std::string filename, bool variableBased )
45154513{
4516- std::vector< uint64_t > sampleData { 5 , 9 , 1 , 3 , 4 , 6 , 7 , 8 , 2 , 0 };
4514+ std::vector< uint64_t > iterations { 5 , 9 , 1 , 3 , 4 , 6 , 7 , 8 , 2 , 0 };
45174515 std::string jsonConfig = R"(
45184516{
45194517 "adios2": {
@@ -4525,16 +4523,31 @@ void no_explicit_flush( std::string filename )
45254523 }
45264524})" ;
45274525
4526+ bool weirdOrderWhenReading{};
4527+
45284528 {
45294529 Series series ( filename, Access::CREATE, jsonConfig );
4530- for ( uint64_t currentIteration = 0 ; currentIteration < 10 ;
4531- ++currentIteration )
4530+ /*
4531+ * When using ADIOS2 steps, iterations are read not by logical order
4532+ * (iteration index), but by order of writing.
4533+ */
4534+ weirdOrderWhenReading = series.backend () == " ADIOS2" &&
4535+ series.iterationEncoding () != IterationEncoding::fileBased;
4536+ if ( variableBased )
4537+ {
4538+ if ( series.backend () != " ADIOS2" )
4539+ {
4540+ return ;
4541+ }
4542+ series.setIterationEncoding ( IterationEncoding::variableBased );
4543+ }
4544+ for ( auto currentIteration : iterations )
45324545 {
45334546 auto dataset =
45344547 series.writeIterations ()[ currentIteration ]
45354548 .meshes [ " iterationOrder" ][ MeshRecordComponent::SCALAR ];
45364549 dataset.resetDataset ( { determineDatatype< uint64_t >(), { 10 } } );
4537- dataset.storeChunk ( sampleData , { 0 }, { 10 } );
4550+ dataset.storeChunk ( iterations , { 0 }, { 10 } );
45384551 // series.writeIterations()[ currentIteration ].close();
45394552 }
45404553 }
@@ -4544,18 +4557,26 @@ void no_explicit_flush( std::string filename )
45444557 size_t index = 0 ;
45454558 for ( auto iteration : series.readIterations () )
45464559 {
4547- REQUIRE ( iteration.iterationIndex == index );
4560+ if ( weirdOrderWhenReading )
4561+ {
4562+ REQUIRE ( iteration.iterationIndex == iterations[ index ] );
4563+ }
4564+ else
4565+ {
4566+ REQUIRE ( iteration.iterationIndex == index );
4567+ }
45484568 ++index;
45494569 }
4550- REQUIRE ( index == 10 );
4570+ REQUIRE ( index == iterations. size () );
45514571 }
45524572}
45534573
4554- TEST_CASE ( " no_explicit_flush " , " [serial]" )
4574+ TEST_CASE ( " chaotic_stream " , " [serial]" )
45554575{
45564576 for ( auto const & t : testedFileExtensions () )
45574577 {
4558- no_explicit_flush ( " ../samples/no_explicit_flush_filebased_%T." + t );
4559- no_explicit_flush ( " ../samples/no_explicit_flush." + t );
4578+ chaotic_stream ( " ../samples/chaotic_stream_filebased_%T." + t, false );
4579+ chaotic_stream ( " ../samples/chaotic_stream." + t, false );
4580+ chaotic_stream ( " ../samples/chaotic_stream_vbased." + t, true );
45604581 }
45614582}
0 commit comments