IceModelVec3 Class Reference

Class for a 3d DA-based Vec for ice scalar quantities in IceModel. More...

#include <iceModelVec.hh>

Inheritance diagram for IceModelVec3:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 IceModelVec3 ()
 IceModelVec3 (const IceModelVec3 &other)
virtual ~IceModelVec3 ()
virtual PetscErrorCode create (IceGrid &mygrid, const char my_short_name[], bool local, int stencil_width=1)
 Allocate a DA and a Vec from information in IceGrid.
virtual PetscErrorCode beginGhostCommTransfer (IceModelVec3 &imv3_source)
virtual PetscErrorCode endGhostCommTransfer (IceModelVec3 &imv3_source)
PetscErrorCode setValColumnPL (PetscInt i, PetscInt j, PetscScalar *valsIN)
 Set values of an ice scalar quantity by linear interpolation from given values in a given column.
PetscErrorCode setColumn (PetscInt i, PetscInt j, PetscScalar c)
 Set all values of scalar quantity to given a single value in a particular column.
PetscErrorCode setInternalColumn (PetscInt i, PetscInt j, PetscScalar *valsIN)
PetscScalar getValZ (PetscInt i, PetscInt j, PetscScalar z)
 Return value of scalar quantity at level z (m) above base of ice (by linear interpolation).
PetscErrorCode getPlaneStarZ (PetscInt i, PetscInt j, PetscScalar z, planeStar *star)
 Return values on planar star stencil of scalar quantity at level z (by linear interpolation).
PetscErrorCode getPlaneStar_fine (PetscInt i, PetscInt j, PetscInt k, planeStar *star)
 Gets a map-plane star stencil on the fine vertical grid.
PetscErrorCode getPlaneStar (PetscInt i, PetscInt j, PetscInt k, planeStar *star)
 Gets a map-plane star stencil directly from the storage grid.
PetscErrorCode getValColumnPL (PetscInt i, PetscInt j, PetscInt ks, PetscScalar *valsOUT)
 Return values of ice scalar quantity at given levels (m) above base of ice, using piecewise linear interpolation.
PetscErrorCode getValColumnQUAD (PetscInt i, PetscInt j, PetscInt ks, PetscScalar *valsOUT)
 Return values of ice scalar quantity on the fine computational grid, using local quadratic interpolation.
PetscErrorCode getValColumn (PetscInt i, PetscInt j, PetscInt ks, PetscScalar *valsOUT)
 If the grid is equally spaced in the ice then use PL, otherwise use QUAD.
PetscErrorCode getInternalColumn (PetscInt i, PetscInt j, PetscScalar **valsPTR)
PetscErrorCode getHorSlice (Vec &gslice, PetscScalar z)
 Copies a horizontal slice at level z of an IceModelVec3 into a Vec gslice.
PetscErrorCode getHorSlice (IceModelVec2S &gslice, PetscScalar z)
 Copies a horizontal slice at level z of an IceModelVec3 into an IceModelVec2S gslice.
PetscErrorCode getSurfaceValues (Vec &gsurf, IceModelVec2S &myH)
 Copies the values of an IceModelVec3 at the ice surface (specified by the level myH) to a Vec gsurf.
PetscErrorCode getSurfaceValues (IceModelVec2S &gsurf, IceModelVec2S &myH)
 Copies the values of an IceModelVec3 at the ice surface (specified by the level myH) to an IceModelVec2S gsurf.
PetscErrorCode getSurfaceValues (IceModelVec2S &gsurf, PetscScalar **H)
PetscErrorCode extend_vertically (int old_Mz, PetscScalar fill_value)
 Extends an IceModelVec3 and fills all the new grid points with fill_value.
PetscErrorCode extend_vertically (int old_Mz, IceModelVec2S &fill_values)
 Extends an IceModelVec3 and fills the new grid points with corresponding fill_values values.
PetscErrorCode view_surface (IceModelVec2S &thickness, PetscInt viewer_size)
PetscErrorCode view_horizontal_slice (PetscScalar level, PetscInt viewer_size)
PetscErrorCode view_sounding (int i, int j, PetscInt viewer_size)
virtual PetscErrorCode has_nan ()
 Checks if the current IceModelVec has NANs and stops if it does.

Protected Member Functions

virtual PetscErrorCode destroy ()
PetscErrorCode isLegalLevel (PetscScalar z)
virtual PetscErrorCode extend_vertically_private (int old_Mz)
 Handles the memory allocation/deallocation and copying. Does not fill the values of the new layer.
virtual PetscErrorCode create_da (DA &result, PetscInt Mz)

Protected Attributes

map< string, PetscViewer > * slice_viewers
map< string, PetscViewer > * sounding_viewers
Vec sounding_buffer

Detailed Description

Class for a 3d DA-based Vec for ice scalar quantities in IceModel.

Definition at line 258 of file iceModelVec.hh.


Constructor & Destructor Documentation

IceModelVec3 (  ) 

Definition at line 32 of file iceModelVec3.cc.

References slice_viewers, sounding_buffer, and sounding_viewers.

IceModelVec3 ( const IceModelVec3 other  ) 
~IceModelVec3 (  )  [virtual]

Definition at line 38 of file iceModelVec3.cc.

References IceModelVec.shallow_copy, slice_viewers, and sounding_viewers.


Member Function Documentation

PetscErrorCode beginGhostCommTransfer ( IceModelVec3 imv3_source  )  [virtual]
PetscErrorCode create ( IceGrid mygrid,
const char  my_short_name[],
bool  local,
int  stencil_width = 1 
) [virtual]
PetscErrorCode create_da ( DA &  result,
PetscInt  Mz 
) [protected, virtual]
PetscErrorCode destroy (  )  [protected, virtual]

Reimplemented from IceModelVec.

Definition at line 107 of file iceModelVec3.cc.

References slice_viewers, sounding_buffer, and sounding_viewers.

PetscErrorCode endGhostCommTransfer ( IceModelVec3 imv3_source  )  [virtual]
PetscErrorCode extend_vertically ( int  old_Mz,
IceModelVec2S fill_values 
)
PetscErrorCode extend_vertically ( int  old_Mz,
PetscScalar  fill_value 
)
PetscErrorCode extend_vertically_private ( int  old_Mz  )  [protected, virtual]

Handles the memory allocation/deallocation and copying. Does not fill the values of the new layer.

Definition at line 852 of file iceModelVec3.cc.

References create_da(), IceModelVec.da, IceModelVec.grid, IceModelVec.localp, IceGrid.Mz, IceModelVec.v, IceGrid.xm, IceGrid.xs, IceGrid.ym, and IceGrid.ys.

Referenced by extend_vertically().

PetscErrorCode getHorSlice ( IceModelVec2S gslice,
PetscScalar  z 
)

Copies a horizontal slice at level z of an IceModelVec3 into an IceModelVec2S gslice.

Definition at line 488 of file iceModelVec3.cc.

References IceModelVec.begin_access(), IceModelVec.end_access(), IceModelVec2S.get_array(), getValZ(), IceModelVec.grid, IceGrid.xm, IceGrid.xs, IceGrid.ym, and IceGrid.ys.

PetscErrorCode getHorSlice ( Vec &  gslice,
PetscScalar  z 
)
PetscErrorCode getInternalColumn ( PetscInt  i,
PetscInt  j,
PetscScalar **  valsPTR 
)
PetscErrorCode getPlaneStar ( PetscInt  i,
PetscInt  j,
PetscInt  k,
planeStar star 
)

Gets a map-plane star stencil directly from the storage grid.

Definition at line 326 of file iceModelVec3.cc.

References IceModelVec.array, planeStar.ij, planeStar.im1, planeStar.ip1, planeStar.jm1, and planeStar.jp1.

Referenced by IceModel.enthalpyAndDrainageStep(), getPlaneStar_fine(), and tempSystemCtx.solveThisColumn().

PetscErrorCode getPlaneStar_fine ( PetscInt  i,
PetscInt  j,
PetscInt  k,
planeStar star 
)
PetscErrorCode getPlaneStarZ ( PetscInt  i,
PetscInt  j,
PetscScalar  z,
planeStar star 
)

Return values on planar star stencil of scalar quantity at level z (by linear interpolation).

Definition at line 276 of file iceModelVec3.cc.

References IceModelVec.array, IceModelVec.checkHaveArray(), IceModelVec.grid, planeStar.ij, planeStar.im1, planeStar.ip1, isLegalLevel(), planeStar.jm1, planeStar.jp1, vfnow.levels, IceModelVec.localp, IceGrid.Lz, IceGrid.Mz, IceModelVec.name, and IceGrid.zlevels.

PetscErrorCode getSurfaceValues ( IceModelVec2S gsurf,
PetscScalar **  H 
)
PetscErrorCode getSurfaceValues ( IceModelVec2S gsurf,
IceModelVec2S myH 
)

Copies the values of an IceModelVec3 at the ice surface (specified by the level myH) to an IceModelVec2S gsurf.

Definition at line 507 of file iceModelVec3.cc.

References IceModelVec.end_access(), IceModelVec2S.get_array(), and getSurfaceValues().

PetscErrorCode getSurfaceValues ( Vec &  gsurf,
IceModelVec2S myH 
)
PetscErrorCode getValColumn ( PetscInt  i,
PetscInt  j,
PetscInt  ks,
PetscScalar *  valsOUT 
)

If the grid is equally spaced in the ice then use PL, otherwise use QUAD.

Definition at line 459 of file iceModelVec3.cc.

References EQUAL, getValColumnPL(), getValColumnQUAD(), IceModelVec.grid, and IceGrid.ice_vertical_spacing.

Referenced by IceModel.ageStep(), IceModel.enthalpyAndDrainageStep(), and IceModel.temperatureStep().

PetscErrorCode getValColumnPL ( PetscInt  i,
PetscInt  j,
PetscInt  ks,
PetscScalar *  result 
)

Return values of ice scalar quantity at given levels (m) above base of ice, using piecewise linear interpolation.

Input array levelsIN must be an allocated array of nlevels scalars (PetscScalar).

levelsIN must be strictly increasing and positive. Exceeding Lz is allowed, extrapolation (by the value at the top-most level) is performed in this case.

Return array valsOUT must be an allocated array of nlevels scalars (PetscScalar).

Upon return, valsOUT will be filled with values of scalar quantity at the $z$ values in levelsIN.

Definition at line 375 of file iceModelVec3.cc.

References IceModelVec.array, IceModelVec.checkAllocated(), IceModelVec.grid, IceGrid.ice_storage2fine, vfnow.levels, IceGrid.Mz, IceGrid.Mz_fine, IceGrid.zlevels, and IceGrid.zlevels_fine.

Referenced by getValColumn(), and IceUnitModel.test_IceModelVec3().

PetscErrorCode getValColumnQUAD ( PetscInt  i,
PetscInt  j,
PetscInt  ks,
PetscScalar *  result 
)

Return values of ice scalar quantity on the fine computational grid, using local quadratic interpolation.

Return array valsOUT must be an allocated array of grid.Mz_fine scalars (PetscScalar).

Definition at line 414 of file iceModelVec3.cc.

References IceModelVec.array, IceModelVec.grid, IceGrid.ice_storage2fine, vfnow.levels, IceGrid.Mz, IceGrid.Mz_fine, z0, IceGrid.zlevels, and IceGrid.zlevels_fine.

Referenced by getValColumn(), and IceUnitModel.test_IceModelVec3().

PetscScalar getValZ ( PetscInt  i,
PetscInt  j,
PetscScalar  z 
)
PetscErrorCode has_nan (  )  [virtual]

Checks if the current IceModelVec has NANs and stops if it does.

Reimplemented from IceModelVec.

Definition at line 1020 of file iceModelVec3.cc.

References IceModelVec.begin_access(), IceGrid.com, IceModelVec.end_access(), getInternalColumn(), IceModelVec.grid, IceGrid.Mz, IceModelVec.name, IceGrid.xm, IceGrid.xs, IceGrid.ym, and IceGrid.ys.

PetscErrorCode isLegalLevel ( PetscScalar  z  )  [protected]

Definition at line 178 of file iceModelVec3.cc.

References e, IceModelVec.grid, IceGrid.Lz, and IceModelVec.name.

Referenced by getPlaneStarZ(), and getValZ().

PetscErrorCode setColumn ( PetscInt  i,
PetscInt  j,
PetscScalar  c 
)
PetscErrorCode setInternalColumn ( PetscInt  i,
PetscInt  j,
PetscScalar *  valsIN 
)
PetscErrorCode setValColumnPL ( PetscInt  i,
PetscInt  j,
PetscScalar *  source 
)

Set values of an ice scalar quantity by linear interpolation from given values in a given column.

Input arrays levelsIN and valsIN must be allocated arrays of nlevels scalars (PetscScalar). Upon completion, internal storage will hold values derived from linearly interpolating the input values.

levelsIN must be strictly increasing.

Piecewise linear interpolation is used and the input values must span a sufficient range of $z$ values so that all stored values, at heights in zlevels, can be determined by interpolation; extrapolation is not allowed. Therefore (levelsIN[0] <= 0.0) and (levelsIN[nlevels-1] >= Lz) must both be true.

Definition at line 206 of file iceModelVec3.cc.

References IceModelVec.array, IceModelVec.checkAllocated(), IceModelVec.grid, IceGrid.ice_fine2storage, vfnow.levels, IceGrid.Mz, IceGrid.zlevels, and IceGrid.zlevels_fine.

Referenced by IceModel.ageStep(), IceModel.enthalpyAndDrainageStep(), IceModel.temperatureStep(), and IceUnitModel.test_IceModelVec3().

PetscErrorCode view_horizontal_slice ( PetscScalar  level,
PetscInt  viewer_size 
)
PetscErrorCode view_sounding ( int  i,
int  j,
PetscInt  viewer_size 
)
PetscErrorCode view_surface ( IceModelVec2S thickness,
PetscInt  viewer_size 
)

Member Data Documentation

map<string,PetscViewer>* slice_viewers [protected]

Definition at line 313 of file iceModelVec.hh.

Referenced by destroy(), IceModelVec3(), view_horizontal_slice(), and ~IceModelVec3().

Vec sounding_buffer [protected]

Definition at line 314 of file iceModelVec.hh.

Referenced by destroy(), IceModelVec3(), and view_sounding().

map<string,PetscViewer> * sounding_viewers [protected]

Definition at line 313 of file iceModelVec.hh.

Referenced by destroy(), IceModelVec3(), view_sounding(), and ~IceModelVec3().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Defines
Generated by  doxygen 1.6.2-20100124