From 3ed83cc2b5ec453818ca7d62ec1e8942812f02ee Mon Sep 17 00:00:00 2001 From: Kacper Kornet Date: Fri, 18 Aug 2023 09:00:51 +0100 Subject: [PATCH] Record global dimensions in metadata file --- Partitioner.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Partitioner.cpp b/Partitioner.cpp index ca098da..e6feca9 100644 --- a/Partitioner.cpp +++ b/Partitioner.cpp @@ -148,6 +148,16 @@ void Partitioner::save_metadata(const std::string& filename) const CHECK_MPI(MPI_Exscan(&right_num_neighbors, &right_offset, 1, MPI_INT, MPI_SUM, _comm)); + // Create 2 dimensions + // The values to be written are associated with the netCDF variable by + // assuming that the last dimension of the netCDF variable varies fastest in + // the C interface + const int NDIMS = 2; + int dimid_global[NDIMS]; + NC_CHECK(nc_def_dim(nc_id, "globalX", _global_ext_0, &dimid_global[0])); + NC_CHECK(nc_def_dim(nc_id, "globalY", _global_ext_1, &dimid_global[1])); + + // Define dimensions in netCDF file int dimid, top_dimid, bottom_dimid, left_dimid, right_dimid; NC_CHECK(nc_def_dim(nc_id, "P", _num_procs, &dimid));