@@ -3709,8 +3709,10 @@ serial_iterator( std::string const & file )
37093709 Series readSeries ( file, Access::READ_ONLY );
37103710
37113711 size_t last_iteration_index = 0 ;
3712+ size_t numberOfIterations = 0 ;
37123713 for ( auto iteration : readSeries.readIterations () )
37133714 {
3715+ ++numberOfIterations;
37143716 auto E_x = iteration.meshes [ " E" ][ " x" ];
37153717 REQUIRE ( E_x.getDimensionality () == 1 );
37163718 REQUIRE ( E_x.getExtent ()[ 0 ] == extent );
@@ -3723,6 +3725,7 @@ serial_iterator( std::string const & file )
37233725 last_iteration_index = iteration.iterationIndex ;
37243726 }
37253727 REQUIRE ( last_iteration_index == 9 );
3728+ REQUIRE ( numberOfIterations == 10 );
37263729}
37273730
37283731TEST_CASE ( " serial_iterator" , " [serial][adios2]" )
@@ -4873,11 +4876,9 @@ TEST_CASE( "deferred_parsing", "[serial]" )
48734876 }
48744877}
48754878
4876- // @todo merge this back with the chaotic_stream test of PR #949
4877- // (bug noticed while working on that branch)
4878- void no_explicit_flush ( std::string filename )
4879+ void chaotic_stream ( std::string filename, bool variableBased )
48794880{
4880- std::vector< uint64_t > sampleData { 5 , 9 , 1 , 3 , 4 , 6 , 7 , 8 , 2 , 0 };
4881+ std::vector< uint64_t > iterations { 5 , 9 , 1 , 3 , 4 , 6 , 7 , 8 , 2 , 0 };
48814882 std::string jsonConfig = R"(
48824883{
48834884 "adios2": {
@@ -4889,16 +4890,31 @@ void no_explicit_flush( std::string filename )
48894890 }
48904891})" ;
48914892
4893+ bool weirdOrderWhenReading{};
4894+
48924895 {
48934896 Series series ( filename, Access::CREATE, jsonConfig );
4894- for ( uint64_t currentIteration = 0 ; currentIteration < 10 ;
4895- ++currentIteration )
4897+ /*
4898+ * When using ADIOS2 steps, iterations are read not by logical order
4899+ * (iteration index), but by order of writing.
4900+ */
4901+ weirdOrderWhenReading = series.backend () == " ADIOS2" &&
4902+ series.iterationEncoding () != IterationEncoding::fileBased;
4903+ if ( variableBased )
4904+ {
4905+ if ( series.backend () != " ADIOS2" )
4906+ {
4907+ return ;
4908+ }
4909+ series.setIterationEncoding ( IterationEncoding::variableBased );
4910+ }
4911+ for ( auto currentIteration : iterations )
48964912 {
48974913 auto dataset =
48984914 series.writeIterations ()[ currentIteration ]
48994915 .meshes [ " iterationOrder" ][ MeshRecordComponent::SCALAR ];
49004916 dataset.resetDataset ( { determineDatatype< uint64_t >(), { 10 } } );
4901- dataset.storeChunk ( sampleData , { 0 }, { 10 } );
4917+ dataset.storeChunk ( iterations , { 0 }, { 10 } );
49024918 // series.writeIterations()[ currentIteration ].close();
49034919 }
49044920 }
@@ -4908,19 +4924,27 @@ void no_explicit_flush( std::string filename )
49084924 size_t index = 0 ;
49094925 for ( auto iteration : series.readIterations () )
49104926 {
4911- REQUIRE ( iteration.iterationIndex == index );
4927+ if ( weirdOrderWhenReading )
4928+ {
4929+ REQUIRE ( iteration.iterationIndex == iterations[ index ] );
4930+ }
4931+ else
4932+ {
4933+ REQUIRE ( iteration.iterationIndex == index );
4934+ }
49124935 ++index;
49134936 }
4914- REQUIRE ( index == 10 );
4937+ REQUIRE ( index == iterations. size () );
49154938 }
49164939}
49174940
4918- TEST_CASE ( " no_explicit_flush " , " [serial]" )
4941+ TEST_CASE ( " chaotic_stream " , " [serial]" )
49194942{
49204943 for ( auto const & t : testedFileExtensions () )
49214944 {
4922- no_explicit_flush ( " ../samples/no_explicit_flush_filebased_%T." + t );
4923- no_explicit_flush ( " ../samples/no_explicit_flush." + t );
4945+ chaotic_stream ( " ../samples/chaotic_stream_filebased_%T." + t, false );
4946+ chaotic_stream ( " ../samples/chaotic_stream." + t, false );
4947+ chaotic_stream ( " ../samples/chaotic_stream_vbased." + t, true );
49244948 }
49254949}
49264950
0 commit comments