PISM, A Parallel Ice Sheet Model
stable v1.2 committed by Constantine Khrulev on 2020-02-11 20:24:05 -0900
|
A simple class "hiding" the fact that the mask is stored as floating-point scalars (instead of integers). More...
#include <iceModelVec.hh>
Public Types | |
typedef std::shared_ptr< IceModelVec2Int > | Ptr |
typedef std::shared_ptr< const IceModelVec2Int > | ConstPtr |
![]() | |
typedef std::shared_ptr< IceModelVec2S > | Ptr |
typedef std::shared_ptr< const IceModelVec2S > | ConstPtr |
![]() | |
typedef std::shared_ptr< IceModelVec2 > | Ptr |
typedef std::shared_ptr< const IceModelVec2 > | ConstPtr |
![]() | |
typedef std::shared_ptr< IceModelVec > | Ptr |
typedef std::shared_ptr< const IceModelVec > | ConstPtr |
typedef pism::AccessList | AccessList |
Public Member Functions | |
IceModelVec2Int () | |
IceModelVec2Int (IceGrid::ConstPtr grid, const std::string &name, IceModelVecKind ghostedp, int width=1) | |
int | as_int (int i, int j) const |
StarStencil< int > | int_star (int i, int j) const |
BoxStencil< int > | int_box (int i, int j) const |
![]() | |
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 ![]() 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... | |
double & | operator() (int i, int j) |
Provides access (both read and write) to the internal double array. More... | |
const double & | operator() (int i, int j) const |
StarStencil< double > | star (int i, int j) const |
BoxStencil< double > | box (int i, int j) const |
void | create (IceGrid::ConstPtr grid, const std::string &short_name, IceModelVecKind ghostedp, unsigned int stencil_width, int dof) |
![]() | |
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) |
double & | operator() (int i, int j, int k) |
const double & | operator() (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) |
![]() | |
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< int > | shape () 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< double > | levels () 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< double > | norm_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... | |
SpatialVariableMetadata & | metadata (unsigned int N=0) |
Returns a reference to the SpatialVariableMetadata object containing metadata for the compoment N. More... | |
const SpatialVariableMetadata & | metadata (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 |
![]() | |
virtual | ~PetscAccessible () |
Additional Inherited Members | |
![]() | |
static Ptr | To2DScalar (IceModelVec::Ptr input) |
![]() | |
static Ptr | To2D (IceModelVec::Ptr input) |
![]() | |
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... | |
![]() | |
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) |
![]() | |
bool | m_report_range |
If true, report range when regridding. More... | |
std::vector< double > | m_zlevels |
petsc::Vec | m_v |
Internal storage. More... | |
std::string | m_name |
std::vector< SpatialVariableMetadata > | m_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::Ptr > | m_map_viewers |
void * | m_array |
int | m_access_counter |
int | m_state_counter |
Internal IceModelVec "revision number". More... | |
InterpolationType | m_interpolation_type |
A simple class "hiding" the fact that the mask is stored as floating-point scalars (instead of integers).
Definition at line 488 of file iceModelVec.hh.