PISM, A Parallel Ice Sheet Model  stable v1.2 committed by Constantine Khrulev on 2020-02-11 20:24:05 -0900
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
pism::IceModelVec2S Class Reference

#include <iceModelVec.hh>

+ Inheritance diagram for pism::IceModelVec2S:

Public Types

typedef std::shared_ptr< IceModelVec2SPtr
 
typedef std::shared_ptr< const IceModelVec2SConstPtr
 
- Public Types inherited from pism::IceModelVec2
typedef std::shared_ptr< IceModelVec2Ptr
 
typedef std::shared_ptr< const IceModelVec2ConstPtr
 
- Public Types inherited from pism::IceModelVec
typedef std::shared_ptr< IceModelVecPtr
 
typedef std::shared_ptr< const IceModelVecConstPtr
 
typedef pism::AccessList AccessList
 

Public Member Functions

 IceModelVec2S ()
 
 IceModelVec2S (IceGrid::ConstPtr grid, const std::string &name, IceModelVecKind ghostedp, int width=1)
 
double interpolate (double x, double y) const
 
void create (IceGrid::ConstPtr grid, const std::string &name, IceModelVecKind ghostedp, int width=1)
 
virtual void copy_from (const IceModelVec &source)
 Result: v <- source. Leaves metadata alone but copies values in Vec. Uses VecCopy. More...
 
double ** get_array ()
 
virtual void set_to_magnitude (const IceModelVec2S &v_x, const IceModelVec2S &v_y)
 Sets an IceModelVec2 to the magnitude of a 2D vector field with components v_x and v_y. More...
 
virtual void set_to_magnitude (const IceModelVec2V &input)
 
virtual void mask_by (const IceModelVec2S &M, double fill=0.0)
 Masks out all the areas where $ M \le 0 $ by setting them to fill. More...
 
virtual void add (double alpha, const IceModelVec &x)
 Result: v <- v + alpha * x. Calls VecAXPY. More...
 
virtual void add (double alpha, const IceModelVec &x, IceModelVec &result) const
 
virtual double sum () const
 Sums up all the values in an IceModelVec2S object. Ignores ghosts. More...
 
virtual double min () const
 Finds minimum over all the values in an IceModelVec2S object. Ignores ghosts. More...
 
virtual double max () const
 Finds maximum over all the values in an IceModelVec2S object. Ignores ghosts. More...
 
virtual double absmax () const
 Finds maximum over all the absolute values in an IceModelVec2S object. Ignores ghosts. More...
 
virtual double diff_x (int i, int j) const
 Returns the x-derivative at i,j approximated using centered finite differences. More...
 
virtual double diff_y (int i, int j) const
 Returns the y-derivative at i,j approximated using centered finite differences. More...
 
virtual double diff_x_p (int i, int j) const
 Returns the x-derivative at i,j approximated using centered finite differences. Respects grid periodicity and uses one-sided FD at grid edges if necessary. More...
 
virtual double diff_y_p (int i, int j) const
 Returns the y-derivative at i,j approximated using centered finite differences. Respects grid periodicity and uses one-sided FD at grid edges if necessary. More...
 
doubleoperator() (int i, int j)
 Provides access (both read and write) to the internal double array. More...
 
const doubleoperator() (int i, int j) const
 
StarStencil< doublestar (int i, int j) const
 
BoxStencil< doublebox (int i, int j) const
 
void create (IceGrid::ConstPtr grid, const std::string &short_name, IceModelVecKind ghostedp, unsigned int stencil_width, int dof)
 
- Public Member Functions inherited from pism::IceModelVec2
 IceModelVec2 ()
 
 IceModelVec2 (IceGrid::ConstPtr grid, const std::string &short_name, IceModelVecKind ghostedp, unsigned int stencil_width, int dof)
 
virtual void view (int viewer_size) const
 View a 2D field. More...
 
virtual void view (petsc::Viewer::Ptr v1, petsc::Viewer::Ptr v2) const
 View a 2D vector field using existing PETSc viewers. More...
 
virtual void get_component (unsigned int n, IceModelVec2S &result) const
 
virtual void set_component (unsigned int n, const IceModelVec2S &source)
 
doubleoperator() (int i, int j, int k)
 
const doubleoperator() (int i, int j, int k) const
 
void create (IceGrid::ConstPtr grid, const std::string &short_name, IceModelVecKind ghostedp, unsigned int stencil_width, int dof)
 
- Public Member Functions inherited from pism::IceModelVec
 IceModelVec ()
 
virtual ~IceModelVec ()
 
virtual bool was_created () const
 Returns true if create() was called and false otherwise. More...
 
IceGrid::ConstPtr grid () const
 
unsigned int ndims () const
 Returns the grid type of an IceModelVec. (This is the way to figure out if an IceModelVec is 2D or 3D). More...
 
std::vector< intshape () const
 
unsigned int ndof () const
 Returns the number of degrees of freedom per grid point. More...
 
unsigned int stencil_width () const
 Get the stencil width of the current IceModelVec. Returns 0 if ghosts are not available. More...
 
std::vector< doublelevels () const
 
virtual Range range () const
 Result: min <- min(v[j]), max <- max(v[j]). More...
 
double norm (int n) const
 Computes the norm of an dof==1 IceModelVec by calling PETSc VecNorm. More...
 
std::vector< doublenorm_all (int n) const
 Computes the norm of all components. More...
 
virtual void squareroot ()
 Result: v <- sqrt(v), elementwise. Calls VecSqrt(v). More...
 
virtual void shift (double alpha)
 Result: v[j] <- v[j] + alpha for all j. Calls VecShift. More...
 
virtual void scale (double alpha)
 Result: v <- v * alpha. Calls VecScale. More...
 
void copy_to_vec (petsc::DM::Ptr destination_da, Vec destination) const
 Copies v to a global vector 'destination'. Ghost points are discarded. More...
 
void copy_from_vec (Vec source)
 Copies data from a Vec source to this IceModelVec. Updates ghost points if necessary. More...
 
Vec vec ()
 
petsc::DM::Ptr dm () const
 
virtual void set_name (const std::string &name)
 Sets the variable name to name. More...
 
const std::string & get_name () const
 Get the name of an IceModelVec object. More...
 
void set_attrs (const std::string &pism_intent, const std::string &long_name, const std::string &units, const std::string &glaciological_units, const std::string &standard_name, unsigned int component)
 Sets NetCDF attributes of an IceModelVec object. More...
 
virtual void read_attributes (const std::string &filename, int component=0)
 Read attributes from the corresponding variable in filename. More...
 
virtual void define (const File &nc, IO_Type default_type=PISM_DOUBLE) const
 Define variables corresponding to an IceModelVec in a file opened using file. More...
 
void read (const std::string &filename, unsigned int time)
 
void read (const File &nc, unsigned int time)
 
void write (const std::string &filename) const
 
void write (const File &nc) const
 
void regrid (const std::string &filename, RegriddingFlag flag, double default_value=0.0)
 
void regrid (const File &nc, RegriddingFlag flag, double default_value=0.0)
 
virtual void begin_access () const
 Checks if an IceModelVec is allocated and calls DAVecGetArray. More...
 
virtual void end_access () const
 Checks if an IceModelVec is allocated and calls DAVecRestoreArray. More...
 
virtual void update_ghosts ()
 Updates ghost points. More...
 
virtual void update_ghosts (IceModelVec &destination) const
 Scatters ghost points to IceModelVec destination. More...
 
petsc::Vec::Ptr allocate_proc0_copy () const
 
void put_on_proc0 (Vec onp0) const
 Puts a local IceModelVec2S on processor 0. More...
 
void get_from_proc0 (Vec onp0)
 Gets a local IceModelVec2 from processor 0. More...
 
void set (double c)
 Result: v[j] <- c for all j. More...
 
SpatialVariableMetadatametadata (unsigned int N=0)
 Returns a reference to the SpatialVariableMetadata object containing metadata for the compoment N. More...
 
const SpatialVariableMetadatametadata (unsigned int N=0) const
 
int state_counter () const
 Get the object state counter. More...
 
void inc_state_counter ()
 Increment the object state counter. More...
 
void set_time_independent (bool flag)
 Set the time independent flag for all variables corresponding to this IceModelVec instance. More...
 
void dump (const char filename[]) const
 Dumps a variable to a file, overwriting this file's contents (for debugging). More...
 
uint64_t fletcher64 () const
 
std::string checksum () const
 
void print_checksum (const char *prefix="") const
 
- Public Member Functions inherited from pism::PetscAccessible
virtual ~PetscAccessible ()
 

Static Public Member Functions

static Ptr To2DScalar (IceModelVec::Ptr input)
 
- Static Public Member Functions inherited from pism::IceModelVec2
static Ptr To2D (IceModelVec::Ptr input)
 

Friends

class IceModelVec2V
 
class IceModelVec2Stag
 

Additional Inherited Members

- Protected Member Functions inherited from pism::IceModelVec2
virtual void read_impl (const File &nc, const unsigned int time)
 Reads appropriate NetCDF variable(s) into an IceModelVec. More...
 
virtual void regrid_impl (const File &nc, RegriddingFlag flag, double default_value=0.0)
 Gets an IceModelVec from a file file, interpolating onto the current grid. More...
 
virtual void write_impl (const File &nc) const
 Writes an IceModelVec to a NetCDF file. More...
 
- Protected Member Functions inherited from pism::IceModelVec
void global_to_local (petsc::DM::Ptr dm, Vec source, Vec destination) const
 
virtual void checkCompatibility (const char *function, const IceModelVec &other) const
 Checks if two IceModelVecs have compatible sizes, dimensions and numbers of degrees of freedom. More...
 
void check_array_indices (int i, int j, unsigned int k) const
 Check the array indices and warn if they are out of range. More...
 
void reset_attrs (unsigned int N)
 Resets most IceModelVec attributes. More...
 
NormType int_to_normtype (int input) const
 
void get_dof (petsc::DM::Ptr da_result, Vec result, unsigned int n, unsigned int count=1) const
 
void set_dof (petsc::DM::Ptr da_source, Vec source, unsigned int n, unsigned int count=1)
 
void put_on_proc0 (Vec parallel, Vec onp0) const
 
void get_from_proc0 (Vec onp0, Vec parallel)
 
- Protected Attributes inherited from pism::IceModelVec
bool m_report_range
 If true, report range when regridding. More...
 
std::vector< doublem_zlevels
 
petsc::Vec m_v
 Internal storage. More...
 
std::string m_name
 
std::vector< SpatialVariableMetadatam_metadata
 stores metadata (NetCDF variable attributes) More...
 
IceGrid::ConstPtr m_grid
 
unsigned int m_dof
 number of "degrees of freedom" per grid point More...
 
unsigned int m_da_stencil_width
 stencil width supported by the DA More...
 
bool m_has_ghosts
 m_has_ghosts == true means "has ghosts" More...
 
petsc::DM::Ptr m_da
 distributed mesh manager (DM) More...
 
bool m_begin_end_access_use_dof
 
std::map< std::string, petsc::Viewer::Ptrm_map_viewers
 
void * m_array
 
int m_access_counter
 
int m_state_counter
 Internal IceModelVec "revision number". More...
 
InterpolationType m_interpolation_type
 

Detailed Description

A class for storing and accessing scalar 2D fields. IceModelVec2S is just IceModelVec2 with "dof == 1"

Definition at line 435 of file iceModelVec.hh.


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