PISM, A Parallel Ice Sheet Model 2.3.0-79cae578d committed by Constantine Khrulev on 2026-03-22
Loading...
Searching...
No Matches
GridInfo.hh
Go to the documentation of this file.
1/* Copyright (C) 2025 PISM Authors
2 *
3 * This file is part of PISM.
4 *
5 * PISM is free software; you can redistribute it and/or modify it under the
6 * terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * PISM is distributed in the hope that it will be useful, but WITHOUT ANY
11 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with PISM; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#ifndef PISM_GRIDINFO_H
21#define PISM_GRIDINFO_H
22
23#include <string>
24#include <vector>
25
26namespace pism {
27namespace grid {
28
29typedef enum {NOT_PERIODIC = 0, X_PERIODIC = 1, Y_PERIODIC = 2, XY_PERIODIC = 3} Periodicity;
30
32
33Registration string_to_registration(const std::string &keyword);
34std::string registration_to_string(Registration registration);
35
36Periodicity string_to_periodicity(const std::string &keyword);
38
39class GridInfo {
40public:
41 //! x-coordinate of the domain center
42 double x0;
43 //! y-coordinate of the domain center
44 double y0;
45 //! domain half-width in the X direction
46 double Lx;
47 //! domain half-width in the Y direction
48 double Ly;
49
50 //! x coordinates
51 std::vector<double> x;
52 //! y coordinates
53 std::vector<double> y;
54};
55
57public:
58 //! Grid periodicity in X and Y directions
60 //! Grid registration (cell center or cell corner)
62
63 //! Grid spacing in the X direction
64 double dx;
65 //! Grid spacing in the Y direction
66 double dy;
67 //! Cell area (meters^2) (same as dx*dy)
68 double cell_area;
69
70 //! Starting index (in the X direction) of the patch owned by the current MPI rank
71 unsigned int xs;
72 //! Number of grid points (in the X direction) of the patch owned by the current MPI
73 //! rank
74 unsigned int xm;
75 //! Starting index of the patch owned by the current MPI rank (X direction)
76 unsigned int ys;
77 //! Number of grid points (in the Y direction) of the patch owned by the current MPI
78 //! rank
79 unsigned int ym;
80
81 //! Total number of grid points in the X direction
82 unsigned int Mx;
83 //! Total number of grid points in the Y direction
84 unsigned int My;
85
86 //! Number of grid points in the largest patch (max(xm*ym) over all MPI ranks)
88
89 //! Current MPI rank
90 int rank;
91
92 //! MPI Communicator size
93 int size;
94};
95
96} // namespace grid
97} // namespace pism
98
99#endif /* PISM_GRIDINFO_H */
int max_patch_size
Number of grid points in the largest patch (max(xm*ym) over all MPI ranks)
Definition GridInfo.hh:87
double dx
Grid spacing in the X direction.
Definition GridInfo.hh:64
unsigned int Mx
Total number of grid points in the X direction.
Definition GridInfo.hh:82
unsigned int ys
Starting index of the patch owned by the current MPI rank (X direction)
Definition GridInfo.hh:76
int rank
Current MPI rank.
Definition GridInfo.hh:90
double cell_area
Cell area (meters^2) (same as dx*dy)
Definition GridInfo.hh:68
grid::Periodicity periodicity
Grid periodicity in X and Y directions.
Definition GridInfo.hh:59
double dy
Grid spacing in the Y direction.
Definition GridInfo.hh:66
int size
MPI Communicator size.
Definition GridInfo.hh:93
unsigned int xs
Starting index (in the X direction) of the patch owned by the current MPI rank.
Definition GridInfo.hh:71
unsigned int My
Total number of grid points in the Y direction.
Definition GridInfo.hh:84
grid::Registration registration
Grid registration (cell center or cell corner)
Definition GridInfo.hh:61
double Lx
domain half-width in the X direction
Definition GridInfo.hh:46
std::vector< double > y
y coordinates
Definition GridInfo.hh:53
double y0
y-coordinate of the domain center
Definition GridInfo.hh:44
double x0
x-coordinate of the domain center
Definition GridInfo.hh:42
std::vector< double > x
x coordinates
Definition GridInfo.hh:51
double Ly
domain half-width in the Y direction
Definition GridInfo.hh:48
std::string periodicity_to_string(Periodicity p)
Convert Periodicity to a STL string.
Definition Grid.cc:778
Registration string_to_registration(const std::string &keyword)
Definition Grid.cc:817
Periodicity string_to_periodicity(const std::string &keyword)
Convert a string to Periodicity.
Definition Grid.cc:756
std::string registration_to_string(Registration registration)
Definition Grid.cc:830
std::shared_ptr< Grid > grid(std::shared_ptr< Context > ctx)
Definition pism.cc:173