Skip to content

Commit

Permalink
Get global X and Y dimensions from partition metadata file
Browse files Browse the repository at this point in the history
They are needed to write to a correct location in parallel mode.
  • Loading branch information
draenog authored and TomMelt committed Nov 9, 2023
1 parent 791c886 commit 2ff91ea
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions core/src/RectGridIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<size_t> index(1, metadata.mpiMyRank);
bboxGroup.getVar("global_x").getVar(index, &metadata.localCornerX);
Expand Down
2 changes: 1 addition & 1 deletion core/src/include/ModelMetadata.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 2ff91ea

Please sign in to comment.