From 062ec4092364ff13d0a9e4872340ae196eacbb00 Mon Sep 17 00:00:00 2001 From: guj Date: Wed, 31 Jul 2024 16:38:52 -0700 Subject: [PATCH 1/4] setshape() applies to non joined array variables --- src/IO/ADIOS/ADIOS2IOHandler.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/IO/ADIOS/ADIOS2IOHandler.cpp b/src/IO/ADIOS/ADIOS2IOHandler.cpp index d97769d19b..d0b0f49f43 100644 --- a/src/IO/ADIOS/ADIOS2IOHandler.cpp +++ b/src/IO/ADIOS/ADIOS2IOHandler.cpp @@ -854,7 +854,8 @@ namespace detail { dims.push_back(ext); } - var.SetShape(dims); + if (var.ShapeID() != adios2::ShapeID::JoinedArray) + var.SetShape(dims); } static constexpr char const *errorMsg = "ADIOS2: extendDataset()"; @@ -2032,7 +2033,8 @@ namespace detail } else { - var.SetShape(shape); + if (var.ShapeID() != adios2::ShapeID::JoinedArray) + var.SetShape(shape); if (count.size() > 0) { var.SetSelection({start, count}); From 024a92e0a197d52929cb1e616b56018fbefd03c3 Mon Sep 17 00:00:00 2001 From: guj Date: Wed, 31 Jul 2024 23:09:54 -0700 Subject: [PATCH 2/4] setshape() should not change the joined dim --- src/IO/ADIOS/ADIOS2IOHandler.cpp | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/IO/ADIOS/ADIOS2IOHandler.cpp b/src/IO/ADIOS/ADIOS2IOHandler.cpp index d0b0f49f43..dba1334f56 100644 --- a/src/IO/ADIOS/ADIOS2IOHandler.cpp +++ b/src/IO/ADIOS/ADIOS2IOHandler.cpp @@ -849,13 +849,14 @@ namespace detail variable + "'."); } adios2::Dims dims; - dims.reserve(newShape.size()); - for (auto ext : newShape) - { - dims.push_back(ext); + dims.assign(newShape.begin(), newShape.end()); + // keep the joined dim intact + auto joined_dim = joinedDimension(var.Shape()); + if (joined_dim.has_value()) { + auto idx = joined_dim.value(); + dims[idx] = var.Shape()[idx]; } - if (var.ShapeID() != adios2::ShapeID::JoinedArray) - var.SetShape(dims); + var.SetShape(dims); } static constexpr char const *errorMsg = "ADIOS2: extendDataset()"; @@ -2033,8 +2034,18 @@ namespace detail } else { - if (var.ShapeID() != adios2::ShapeID::JoinedArray) - var.SetShape(shape); + // keep the joined dim intact + auto joined_dim = joinedDimension(var.Shape()); + if (joined_dim.has_value()) + { + adios2::Dims cc; + cc.assign(shape.begin(), shape.end()); + cc[joined_dim.value()] = var.ShapeID()[joined_dim.value()]; + var.SetShape(cc); + } else + var.SetShape(shape); + + if (count.size() > 0) { var.SetSelection({start, count}); From 6340aea0d6d25035f52826d2753ae2cd83126289 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 1 Aug 2024 06:12:49 +0000 Subject: [PATCH 3/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/IO/ADIOS/ADIOS2IOHandler.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/IO/ADIOS/ADIOS2IOHandler.cpp b/src/IO/ADIOS/ADIOS2IOHandler.cpp index dba1334f56..83a0a02791 100644 --- a/src/IO/ADIOS/ADIOS2IOHandler.cpp +++ b/src/IO/ADIOS/ADIOS2IOHandler.cpp @@ -852,9 +852,10 @@ namespace detail dims.assign(newShape.begin(), newShape.end()); // keep the joined dim intact auto joined_dim = joinedDimension(var.Shape()); - if (joined_dim.has_value()) { - auto idx = joined_dim.value(); - dims[idx] = var.Shape()[idx]; + if (joined_dim.has_value()) + { + auto idx = joined_dim.value(); + dims[idx] = var.Shape()[idx]; } var.SetShape(dims); } @@ -2038,13 +2039,13 @@ namespace detail auto joined_dim = joinedDimension(var.Shape()); if (joined_dim.has_value()) { - adios2::Dims cc; - cc.assign(shape.begin(), shape.end()); - cc[joined_dim.value()] = var.ShapeID()[joined_dim.value()]; - var.SetShape(cc); - } else - var.SetShape(shape); - + adios2::Dims cc; + cc.assign(shape.begin(), shape.end()); + cc[joined_dim.value()] = var.ShapeID()[joined_dim.value()]; + var.SetShape(cc); + } + else + var.SetShape(shape); if (count.size() > 0) { From 215c9c65d6f4991b3b80700849ca3972db12df53 Mon Sep 17 00:00:00 2001 From: guj Date: Wed, 31 Jul 2024 23:38:45 -0700 Subject: [PATCH 4/4] typo fix --- src/IO/ADIOS/ADIOS2IOHandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/IO/ADIOS/ADIOS2IOHandler.cpp b/src/IO/ADIOS/ADIOS2IOHandler.cpp index 83a0a02791..9fdc983acd 100644 --- a/src/IO/ADIOS/ADIOS2IOHandler.cpp +++ b/src/IO/ADIOS/ADIOS2IOHandler.cpp @@ -2041,7 +2041,7 @@ namespace detail { adios2::Dims cc; cc.assign(shape.begin(), shape.end()); - cc[joined_dim.value()] = var.ShapeID()[joined_dim.value()]; + cc[joined_dim.value()] = var.Shape()[joined_dim.value()]; var.SetShape(cc); } else