From 127196b36602f99845880c13d2d385a99b0262a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Mon, 8 Mar 2021 16:00:59 +0100 Subject: [PATCH 1/2] Add (failing) test for available_chunks() on a constant record --- test/SerialIOTest.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/SerialIOTest.cpp b/test/SerialIOTest.cpp index 1425d21689..86e4480bd2 100644 --- a/test/SerialIOTest.cpp +++ b/test/SerialIOTest.cpp @@ -180,7 +180,12 @@ TEST_CASE( "available_chunks_test_json", "[serial][json]" ) { E_x.storeChunk( data, { line, 0 }, { 1, 2 } ); } - E_x.storeChunk( data, { 8, 3 }, {2, 1 } ); + E_x.storeChunk( data, { 8, 3 }, { 2, 1 } ); + + auto E_y = it0.meshes[ "E" ][ "y" ]; + E_y.resetDataset( { Datatype::INT, { height, 4 } } ); + E_y.makeConstant( 1234 ); + it0.close(); } @@ -197,6 +202,12 @@ TEST_CASE( "available_chunks_test_json", "[serial][json]" ) REQUIRE( bool( table[ 0 ] == WrittenChunkInfo( { 2, 0 }, { 5, 4 } ) ) ); REQUIRE( bool( table[ 1 ] == WrittenChunkInfo( { 7, 0 }, { 2, 2 } ) ) ); REQUIRE( bool( table[ 2 ] == WrittenChunkInfo( { 8, 3 }, { 2, 1 } ) ) ); + + auto E_y = it0.meshes[ "E" ][ "y" ]; + table = E_y.availableChunks(); + REQUIRE( table.size() == 1 ); + REQUIRE( + bool( table[ 0 ] == WrittenChunkInfo( { 0, 0 }, { height, 4 } ) ) ); } } From e0de7b77017eaf7ae561683d3c9edf71bb6c7397 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franz=20P=C3=B6schel?= Date: Mon, 8 Mar 2021 16:12:16 +0100 Subject: [PATCH 2/2] Fix available_chunks() for constant components --- src/backend/BaseRecordComponent.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/backend/BaseRecordComponent.cpp b/src/backend/BaseRecordComponent.cpp index 83f31e71a3..f1730249ee 100644 --- a/src/backend/BaseRecordComponent.cpp +++ b/src/backend/BaseRecordComponent.cpp @@ -59,6 +59,11 @@ BaseRecordComponent::constant() const ChunkTable BaseRecordComponent::availableChunks() { + if( m_isConstant && *m_isConstant ) + { + Offset offset( m_dataset->extent.size(), 0 ); + return ChunkTable{ { std::move( offset ), m_dataset->extent } }; + } Parameter< Operation::AVAILABLE_CHUNKS > param; IOTask task( this, param ); IOHandler()->enqueue( task );