PISM, A Parallel Ice Sheet Model
stable v2.0.6 committed by Constantine Khrulev on 2023-01-23 15:14:38 -0900
|
Class representing diagnostic computations in PISM. More...
#include <Diagnostic.hh>
Public Types | |
typedef std::shared_ptr< Diagnostic > | Ptr |
Public Member Functions | |
Diagnostic (IceGrid::ConstPtr g) | |
virtual | ~Diagnostic ()=default |
void | update (double dt) |
void | reset () |
IceModelVec::Ptr | compute () const |
Compute a diagnostic quantity and return a pointer to a newly-allocated IceModelVec. More... | |
unsigned int | n_variables () const |
Get the number of NetCDF variables corresponding to a diagnostic quantity. More... | |
SpatialVariableMetadata & | metadata (unsigned int N=0) |
Get a metadata object corresponding to variable number N. More... | |
void | define (const File &file, IO_Type default_type) const |
void | init (const File &input, unsigned int time) |
void | define_state (const File &output) const |
void | write_state (const File &output) const |
Static Public Member Functions | |
template<typename T > | |
static Ptr | wrap (const T &input) |
Protected Member Functions | |
virtual void | define_impl (const File &file, IO_Type default_type) const |
Define NetCDF variables corresponding to a diagnostic quantity. More... | |
virtual void | init_impl (const File &input, unsigned int time) |
virtual void | define_state_impl (const File &output) const |
virtual void | write_state_impl (const File &output) const |
void | set_attrs (const std::string &long_name, const std::string &standard_name, const std::string &units, const std::string &glaciological_units, unsigned int N=0) |
A method for setting common variable attributes. More... | |
virtual void | update_impl (double dt) |
virtual void | reset_impl () |
virtual IceModelVec::Ptr | compute_impl () const =0 |
double | to_internal (double x) const |
double | to_external (double x) const |
Protected Attributes | |
IceGrid::ConstPtr | m_grid |
the grid More... | |
const units::System::Ptr | m_sys |
the unit system More... | |
const Config::ConstPtr | m_config |
Configuration flags and parameters. More... | |
std::vector< SpatialVariableMetadata > | m_vars |
metadata corresponding to NetCDF variables More... | |
double | m_fill_value |
fill value (used often enough to justify storing it) More... | |
Class representing diagnostic computations in PISM.
The main goal of this abstraction is to allow accessing metadata corresponding to a diagnostic quantity before it is computed.
Another goal is to create an interface for computing diagnostics without knowing which PISM module is responsible for the computation.
Technical note: to compute some diagnostic quantities we need access to protected members of classes. C++ forbids obtaining pointers to non-static methods of a class, but it is possible to define a (friend) function
which is the same as creating a method Foo::compute_bar()
, but you can get a pointer to it.
Diagnostic creates a common interface for all these compute_bar functions.
Definition at line 59 of file Diagnostic.hh.