PISM, A Parallel Ice Sheet Model  stable v2.0.4 committed by Constantine Khrulev on 2022-05-25 12:02:27 -0800
IceModelVec_impl.hh
Go to the documentation of this file.
1 /* Copyright (C) 2020, 2021 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 #ifndef ICEMODELVEC_IMPL_H
20 #define ICEMODELVEC_IMPL_H
21 
22 #include <map>
23 #include <memory>
24 #include <string>
25 #include <vector>
26 
27 #include <gsl/gsl_interp.h>
28 
29 #include "pism/util/petscwrappers/Vec.hh"
30 #include "pism/util/interpolation.hh"
31 
32 namespace pism {
33 
35  Impl() {
36  access_counter = 0;
37 
38  da.reset();
39 
40  da_stencil_width = 1;
41  dof = 1;
42  begin_access_use_dof = false;
43 
44  ghosted = true;
45 
46  report_range = true;
47 
48  name = "uninitialized variable";
49 
50  zlevels = {0.0};
51 
52  state_counter = 0;
54 
55  bsearch_accel = nullptr;
56  }
57  //! If true, report range when regridding.
59 
60  //! The array itself
61  //!
62  //! Note: do not access this directly (via `m_impl->v`). Use `vec()` instead.
64 
65  //! Name of the field. In general this is *not* the name of the corresponding NetCDF
66  //! variable.
67  std::string name;
68 
69  //! Metadata (NetCDF variable attributes)
70  std::vector<SpatialVariableMetadata> metadata;
71 
72  //! The computational grid
74 
75  //! number of "degrees of freedom" per grid point
76  unsigned int dof;
77 
78  //! stencil width supported by the DA
79  unsigned int da_stencil_width;
80 
81  //! true if this IceModelVec is ghosted
82  bool ghosted;
83 
84  //! distributed mesh manager (DM)
85  std::shared_ptr<petsc::DM> da;
86 
87  //! If true, use DMDAVecGetArrayDOF() in begin_access()
89 
90  //! Map plane viewers. It is a map because a temporary IceModelVec can be used to view
91  //! different quantities
92  std::map<std::string,std::shared_ptr<petsc::Viewer> > map_viewers;
93 
94  // used in begin_access() and end_access()
96 
97  //! Internal IceModelVec "revision number"
99 
100  // 2D Interpolation type (used by regrid())
102 
103  //! Vertical levels (for 3D fields)
104  std::vector<double> zlevels;
105 
106  // binary search accelerator (used for interpolation in a column in 3D fields)
107  gsl_interp_accel *bsearch_accel;
108 };
109 
110 } // end of namespace pism
111 
112 #endif /* ICEMODELVEC_IMPL_H */
std::shared_ptr< const IceGrid > ConstPtr
Definition: IceGrid.hh:233
InterpolationType
bool report_range
If true, report range when regridding.
InterpolationType interpolation_type
std::shared_ptr< petsc::DM > da
distributed mesh manager (DM)
std::vector< double > zlevels
Vertical levels (for 3D fields)
unsigned int da_stencil_width
stencil width supported by the DA
std::map< std::string, std::shared_ptr< petsc::Viewer > > map_viewers
int state_counter
Internal IceModelVec "revision number".
std::vector< SpatialVariableMetadata > metadata
Metadata (NetCDF variable attributes)
bool begin_access_use_dof
If true, use DMDAVecGetArrayDOF() in begin_access()
unsigned int dof
number of "degrees of freedom" per grid point
gsl_interp_accel * bsearch_accel
bool ghosted
true if this IceModelVec is ghosted
IceGrid::ConstPtr grid
The computational grid.