From 2ff91ea870092a81ebb762830edabc296781915d Mon Sep 17 00:00:00 2001 From: Kacper Kornet Date: Sun, 25 Jun 2023 17:55:09 +0100 Subject: [PATCH] Get global X and Y dimensions from partition metadata file They are needed to write to a correct location in parallel mode. --- core/src/RectGridIO.cpp | 2 ++ core/src/include/ModelMetadata.hpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/RectGridIO.cpp b/core/src/RectGridIO.cpp index 032b51618..a6a5731fe 100644 --- a/core/src/RectGridIO.cpp +++ b/core/src/RectGridIO.cpp @@ -161,6 +161,8 @@ void RectGridIO::readPartitionData(const std::string& partitionFile, ModelMetada + std::to_string(nBoxes) + "\n"; throw std::runtime_error(errorMsg); } + metadata.globalExtentX = ncFile.getDim("globalX").getSize(); + metadata.globalExtentY = ncFile.getDim("globalY").getSize(); netCDF::NcGroup bboxGroup(ncFile.getGroup(bboxName)); std::vector index(1, metadata.mpiMyRank); bboxGroup.getVar("global_x").getVar(index, &metadata.localCornerX); diff --git a/core/src/include/ModelMetadata.hpp b/core/src/include/ModelMetadata.hpp index a0ab87297..7a5a0081c 100644 --- a/core/src/include/ModelMetadata.hpp +++ b/core/src/include/ModelMetadata.hpp @@ -61,7 +61,7 @@ class ModelMetadata { MPI_Comm mpiComm; int mpiSize = 0; int mpiMyRank = -1; - int localCornerX, localCornerY, localExtentX, localExtentY; + int localCornerX, localCornerY, localExtentX, localExtentY, globalExtentX, globalExtentY; #endif private: