PISM, A Parallel Ice Sheet Model 2.3.0-79cae578d committed by Constantine Khrulev on 2026-03-22
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
pism::Diagnostic Class Referenceabstract

Class representing diagnostic computations in PISM. More...

#include <Diagnostic.hh>

+ Inheritance diagram for pism::Diagnostic:

Public Types

typedef std::shared_ptr< DiagnosticPtr
 

Public Member Functions

 Diagnostic (std::shared_ptr< const Grid > g)
 
virtual ~Diagnostic ()=default
 
void update (double dt)
 
void reset ()
 
std::shared_ptr< array::Arraycompute () const
 Compute a diagnostic quantity and return a pointer to a newly-allocated Array.
 
const grid::DistributedGridInfogrid_info () const
 
unsigned int n_variables () const
 Get the number of NetCDF variables corresponding to a diagnostic quantity.
 
VariableMetadatametadata (unsigned int N=0)
 Get a metadata object corresponding to variable number N.
 
std::set< VariableMetadatastate () const
 
void init (const File &input, unsigned int time)
 
void write_state (const OutputFile &output) const
 

Static Public Member Functions

template<typename T >
static Ptr wrap (const T &input)
 

Protected Member Functions

virtual void init_impl (const File &input, unsigned int time)
 
virtual std::set< VariableMetadatastate_impl () const
 
virtual void write_state_impl (const OutputFile &output) const
 
virtual void update_impl (double dt)
 
virtual void reset_impl ()
 
virtual std::shared_ptr< array::Arraycompute_impl () const =0
 
double to_internal (double x) const
 
double to_external (double x) const
 
template<typename T >
std::shared_ptr< T > allocate (const std::string &name) const
 

Protected Attributes

std::shared_ptr< const Gridm_grid
 the grid
 
const units::System::Ptr m_sys
 the unit system
 
std::shared_ptr< const Configm_config
 Configuration flags and parameters.
 
std::vector< VariableMetadatam_vars
 metadata corresponding to NetCDF variables
 
double m_fill_value
 fill value (used often enough to justify storing it)
 

Detailed Description

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

std::shared_ptr<array::Array> compute_bar(Foo* model, ...);

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 62 of file Diagnostic.hh.


The documentation for this class was generated from the following files: