IceModelVec Class Reference

Abstract class for reading, writing, allocating, and accessing a DA-based PETSc Vec from within IceModel. More...

#include <iceModelVec.hh>

Inheritance diagram for IceModelVec:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 IceModelVec ()
 IceModelVec (const IceModelVec &other)
 Creates a shallow copy of an IceModelVec.
virtual ~IceModelVec ()
virtual bool was_created ()
 Returns true if create() was called and false otherwise.
virtual GridType grid_type ()
 Returns the grid type of an IceModelVec. (This is the way to figure out if an IceModelVec is 2D or 3D).
virtual PetscErrorCode range (PetscReal &min, PetscReal &max)
 Result: min <- min(v[j]), max <- max(v[j]).
virtual PetscErrorCode norm (NormType n, PetscReal &out)
 Computes the norm of an IceModelVec by calling PETSc VecNorm.
virtual PetscErrorCode add (PetscScalar alpha, IceModelVec &x)
 Result: v <- v + alpha * x. Calls VecAXPY.
virtual PetscErrorCode add (PetscScalar alpha, IceModelVec &x, IceModelVec &result)
 Result: result <- v + alpha * x. Calls VecWAXPY.
virtual PetscErrorCode squareroot ()
 Result: v <- sqrt(v), elementwise. Calls VecSqrt(v).
virtual PetscErrorCode shift (PetscScalar alpha)
 Result: v[j] <- v[j] + alpha for all j. Calls VecShift.
virtual PetscErrorCode scale (PetscScalar alpha)
 Result: v <- v * alpha. Calls VecScale.
virtual PetscErrorCode multiply_by (IceModelVec &x, IceModelVec &result)
 Result: result <- v .* x. Calls VecPointwiseMult.
virtual PetscErrorCode multiply_by (IceModelVec &x)
 Result: v <- v .* x. Calls VecPointwiseMult.
virtual PetscErrorCode copy_to (Vec destination)
 Copies v to a global vector 'destination'. Ghost points are discarded.
virtual PetscErrorCode copy_from (Vec source)
virtual PetscErrorCode copy_to (IceModelVec &destination)
 Result: destination <- v. Leaves metadata alone but copies values in Vec. Uses VecCopy.
virtual PetscErrorCode copy_from (IceModelVec &source)
 Result: v <- source. Leaves metadata alone but copies values in Vec. Uses VecCopy.
virtual PetscErrorCode has_nan ()
 Checks if the current IceModelVec has NANs and stops if it does.
virtual PetscErrorCode set_name (const char name[], int component=0)
 Sets the variable name to name.
virtual PetscErrorCode set_glaciological_units (string units)
 Sets the glaciological units of an IceModelVec.
virtual PetscErrorCode set_attr (string name, string value, int component=0)
 Set a string attribute of an IceModelVec.
virtual PetscErrorCode set_attr (string name, double value, int component=0)
 Sets a single-valued double attribute.
virtual PetscErrorCode set_attr (string name, vector< double > values, int component=0)
 Sets an array attribute.
virtual bool has_attr (string name, int component=0)
virtual string string_attr (string name, int component=0)
 Returns a string attribute.
virtual double double_attr (string name, int component=0)
 Returns a single-valued double attribute.
virtual vector< doublearray_attr (string name, int component=0)
 Returns an array attribute.
virtual PetscErrorCode set_attrs (string my_pism_intent, string my_long_name, string my_units, string my_standard_name, int component=0)
 Sets NetCDF attributes of an IceModelVec object.
virtual bool is_valid (PetscScalar a, int component=0)
 Checks if a value a in in the range of valid values of an IceModelVec.
virtual PetscErrorCode write (const char filename[])
 Writes an IceModelVec to a NetCDF file using the default output data type.
virtual PetscErrorCode write (const char filename[], nc_type nctype)
 Writes an IceModelVec to a NetCDF file.
virtual PetscErrorCode read (const char filename[], unsigned int time)
 Reads appropriate NetCDF variable(s) into an IceModelVec.
virtual PetscErrorCode regrid (const char filename[], LocalInterpCtx &lic, bool critical)
 Gets an IceModelVec from a file filename, interpolating onto the current grid.
virtual PetscErrorCode regrid (const char filename[], LocalInterpCtx &lic, PetscScalar default_value)
 Gets an IceModelVec from a file filename, interpolating onto the current grid.
virtual PetscErrorCode begin_access ()
 Checks if an IceModelVec is allocated and calls DAVecGetArray.
virtual PetscErrorCode end_access ()
 Checks if an IceModelVec is allocated and calls DAVecRestoreArray.
virtual PetscErrorCode beginGhostComm ()
 Starts the communication of ghost points.
virtual PetscErrorCode endGhostComm ()
 Ends the communication of ghost points.
virtual PetscErrorCode beginGhostComm (IceModelVec &destination)
 Starts the communication of ghost points to IceModelVec destination.
virtual PetscErrorCode endGhostComm (IceModelVec &destination)
 Ends the communication of ghost points to IceModelVec destination.
virtual PetscErrorCode set (PetscScalar c)
 Result: v[j] <- c for all j.

Public Attributes

MaskInterp interpolation_mask
bool use_interpolation_mask
bool write_in_glaciological_units
bool time_independent
nc_type output_data_type

Protected Member Functions

virtual PetscErrorCode destroy ()
virtual PetscErrorCode checkAllocated ()
 Checks if an IceModelVec is allocated. Terminates if not.
virtual PetscErrorCode checkHaveArray ()
 Checks if the access to the array is available.
virtual PetscErrorCode checkCompatibility (const char *, IceModelVec &other)
 Checks if two IceModelVecs have compatible sizes, dimensions and numbers of degrees of freedom.
virtual PetscErrorCode reset_attrs ()
 Resets most IceModelVec attributes.
virtual PetscErrorCode create_viewer (PetscInt viewer_size, string title, PetscViewer &viewer)
 Creates a run-time diagnostic viewer.
virtual PetscErrorCode compute_viewer_size (int target, int &x, int &y)
 Computes the size of a diagnostic viewer window.

Protected Attributes

bool shallow_copy
Vec v
string name
vector< NCSpatialVariablevars
IceGridgrid
GridType dims
int dof
int s_width
DA da
bool localp
map< string, PetscViewer > * map_viewers
void * array
int access_counter

Detailed Description

Abstract class for reading, writing, allocating, and accessing a DA-based PETSc Vec from within IceModel.

Definition at line 32 of file iceModelVec.hh.


Constructor & Destructor Documentation

IceModelVec (  ) 
IceModelVec ( const IceModelVec other  ) 

Creates a shallow copy of an IceModelVec.

No data is copied to the new IceModelVec.

The difference is that such a copy will not free the memory when deleted (or goes out of scope).

Definition at line 55 of file iceModelVec.cc.

References access_counter, array, da, dims, dof, grid, interpolation_mask, localp, map_viewers, name, shallow_copy, use_interpolation_mask, v, and vars.

~IceModelVec (  )  [virtual]

Definition at line 79 of file iceModelVec.cc.

References destroy(), and shallow_copy.


Member Function Documentation

PetscErrorCode add ( PetscScalar  alpha,
IceModelVec x,
IceModelVec result 
) [virtual]

Result: result <- v + alpha * x. Calls VecWAXPY.

Definition at line 214 of file iceModelVec.cc.

References checkAllocated(), checkCompatibility(), and v.

PetscErrorCode add ( PetscScalar  alpha,
IceModelVec x 
) [virtual]
vector< double > array_attr ( string  name,
int  component = 0 
) [virtual]

Returns an array attribute.

Definition at line 741 of file iceModelVec.cc.

References vars.

PetscErrorCode begin_access (  )  [virtual]

Checks if an IceModelVec is allocated and calls DAVecGetArray.

Reimplemented in IceModelVec2Stag, and IceModelVec2T.

Definition at line 569 of file iceModelVec.cc.

References access_counter, array, checkAllocated(), da, and v.

Referenced by IceMISMIPModel.additionalAtEndTimestep(), IcePSTexModel.additionalAtEndTimestep(), IceModel.ageStats(), IceModel.ageStep(), IceModel.assembleSSAMatrix(), IceModel.assembleSSARhs(), IceModel.basalSlidingHeatingSIA(), PAYearlyCycle.begin_pointwise_access(), PALapseRates.begin_pointwise_access(), PAConstant.begin_pointwise_access(), IceModel.broadcastSSAVelocity(), IceMISMIPModel.calving(), IceModel.check_maximum_thickness(), IceModel.compute_bwp(), IceModel.compute_csurf(), IceModel.compute_enthalpysurf(), IceModel.compute_hardav(), IceModel.compute_ice_area(), IceModel.compute_ice_area_floating(), IceModel.compute_ice_area_grounded(), IceModel.compute_ice_enthalpy(), IceModel.compute_ice_volume(), IceModel.compute_proc_ice_area(), IceModel.compute_rank(), IceModel.compute_temp(), IceModel.compute_temp_pa(), IceModel.compute_tempsurf(), IceModel.compute_uvelbase(), IceModel.compute_uvelsurf(), IceModel.compute_vvelbase(), IceModel.compute_vvelsurf(), IceModel.compute_wvelbase(), IceModel.compute_wvelsurf(), IceCompModel.computeBasalTemperatureErrors(), IceModel.computeDrivingStress(), IceModel.computeEffectiveViscosity(), IceROSSModel.computeErrorsInAccurateRegion(), IceCompModel.computeIceBedrockTemperatureErrors(), IceModel.computeMax2DSlidingSpeed(), IceModel.computeMax3DVelocities(), IceModel.computeMaxDiffusivity(), IceModel.computePhiFromBedElevation(), IceCompModel.computeSigmaErrors(), IceCompModel.computeSurfaceVelocityErrors(), IceCompModel.computeTemperatureErrors(), IceModel.correct_cell_areas(), IceModel.correctBasalFrictionalHeating(), IceModel.correctSigma(), IceModel.countCFLViolations(), IceModel.energyStats(), IceModel.enthalpyAndDrainageStep(), IceModelVec2Mask.fill_where_floating(), IceModelVec2Mask.fill_where_grounded(), IceExactSSAModel.fillFromExactSolution(), IceROSSModel.fillinTemps(), IceCompModel.fillSolnTestFG(), IceCompModel.fillSolnTestK(), IceEISModel.generateMoundTopography(), IceEISModel.generateTroughTopography(), IceModelVec2V.get_array(), IceModelVec2Mask.get_array(), IceModelVec2S.get_array(), IceCompModel.getCompSourcesTestFG(), IceModelVec3.getHorSlice(), IceMISMIPModel.getMISMIPStats(), IceMISMIPModel.getRoutineStats(), IceModelVec3.getSurfaceValues(), IceModelVec3.has_nan(), IceModel.horizontalVelocitySIARegular(), IceModel.ice_mass_bookkeeping(), PSForceThickness.ice_surface_mass_flux(), IceEISModel.init_couplers(), IceCompModel.initTestABCDEH(), IceCompModel.initTestFG(), IceModelVec2S.mask_by(), IceModel.massContExplicitStep(), PALapseRates.mean_annual_temp(), PAForcing.mean_precip(), IceModel.putTempAtDepth(), IceROSSModel.readRIGGSandCompare(), IceModel.readShelfStreamBCFromFile(), IceExactSSAModel.reportErrors(), IceModelVec2S.set_to_magnitude(), IceMISMIPModel.setBed(), IcePSTexModel.setBedElev(), IceModel.setCTSFromEnthalpy(), IceModel.setEnth3FromT3_ColdIce(), IceModel.setEnth3FromT3AndLiqfrac3(), IceExactSSAModel.setInitStateJ(), IceExactSSAModel.setInitStateM(), IceModel.setLiquidFracFromEnthalpy(), IceMISMIPModel.setMask(), IcePSTexModel.setTillPhi(), POConstant.shelf_base_temperature(), IceModel.SigmaSIAToRegular(), IceModelVec2S.sum(), IceModel.temperatureStep(), IceUnitModel.test_dof2comm(), IceUnitModel.test_IceModelVec2V(), IceUnitModel.test_IceModelVec3(), IceUnitModel.test_IceModelVec3Bedrock(), IceModel.trivialMoveSSAXtoIMV2V(), PA_EISMINT_Greenland.update(), PSLocalMassBalance.update(), PA_SeaRISE_Greenland.update(), IceModel.updateYieldStressUsingBasalWater(), IceModel.velocities2DSIAToRegular(), IceModel.velocitySIAStaggered(), IceModel.vertVelocityFromIncompressibility(), IceModelVec3Bedrock.view_sounding(), IceModelVec3.view_sounding(), IceModel.volumeArea(), and IceMISMIPModel.writeMISMIPasciiFile().

PetscErrorCode beginGhostComm ( IceModelVec destination  )  [virtual]

Starts the communication of ghost points to IceModelVec destination.

Definition at line 632 of file iceModelVec.cc.

References checkAllocated(), da, dims, localp, name, and v.

PetscErrorCode beginGhostComm (  )  [virtual]
PetscErrorCode checkAllocated (  )  [protected, virtual]
PetscErrorCode checkCompatibility ( const char *  func,
IceModelVec other 
) [protected, virtual]

Checks if two IceModelVecs have compatible sizes, dimensions and numbers of degrees of freedom.

Definition at line 544 of file iceModelVec.cc.

References dims, dof, name, and v.

Referenced by add(), copy_from(), copy_to(), and multiply_by().

PetscErrorCode checkHaveArray (  )  [protected, virtual]
PetscErrorCode compute_viewer_size ( int  target,
int &  x,
int &  y 
) [protected, virtual]

Computes the size of a diagnostic viewer window.

Definition at line 766 of file iceModelVec.cc.

References double, grid, IceGrid.Lx, IceGrid.Ly, and Ly.

Referenced by create_viewer().

PetscErrorCode copy_from ( IceModelVec source  )  [virtual]

Result: v <- source. Leaves metadata alone but copies values in Vec. Uses VecCopy.

Definition at line 307 of file iceModelVec.cc.

References checkAllocated(), checkCompatibility(), and v.

PetscErrorCode copy_from ( Vec  source  )  [virtual]
PetscErrorCode copy_to ( IceModelVec destination  )  [virtual]

Result: destination <- v. Leaves metadata alone but copies values in Vec. Uses VecCopy.

Definition at line 296 of file iceModelVec.cc.

References checkAllocated(), checkCompatibility(), and v.

PetscErrorCode copy_to ( Vec  destination  )  [virtual]
PetscErrorCode create_viewer ( PetscInt  viewer_size,
string  title,
PetscViewer &  viewer 
) [protected, virtual]
PetscErrorCode destroy (  )  [protected, virtual]

Reimplemented in IceModelVec2V, IceModelVec3Bedrock, IceModelVec3, and IceModelVec2T.

Definition at line 94 of file iceModelVec.cc.

References da, map_viewers, and v.

Referenced by ~IceModelVec().

double double_attr ( string  name,
int  component = 0 
) [virtual]

Returns a single-valued double attribute.

Definition at line 727 of file iceModelVec.cc.

References vars.

PetscErrorCode end_access (  )  [virtual]

Checks if an IceModelVec is allocated and calls DAVecRestoreArray.

Reimplemented in IceModelVec2Stag, and IceModelVec2T.

Definition at line 588 of file iceModelVec.cc.

References access_counter, array, checkAllocated(), da, and v.

Referenced by IceMISMIPModel.additionalAtEndTimestep(), IcePSTexModel.additionalAtEndTimestep(), IceModel.ageStats(), IceModel.ageStep(), IceModel.assembleSSAMatrix(), IceModel.assembleSSARhs(), IceModel.basalSlidingHeatingSIA(), IceModel.broadcastSSAVelocity(), IceMISMIPModel.calving(), IceModel.check_maximum_thickness(), IceModel.compute_bwp(), IceModel.compute_csurf(), IceModel.compute_enthalpysurf(), IceModel.compute_hardav(), IceModel.compute_ice_area(), IceModel.compute_ice_area_floating(), IceModel.compute_ice_area_grounded(), IceModel.compute_ice_enthalpy(), IceModel.compute_ice_volume(), IceModel.compute_proc_ice_area(), IceModel.compute_rank(), IceModel.compute_temp(), IceModel.compute_temp_pa(), IceModel.compute_tempsurf(), IceModel.compute_uvelbase(), IceModel.compute_uvelsurf(), IceModel.compute_vvelbase(), IceModel.compute_vvelsurf(), IceModel.compute_wvelbase(), IceModel.compute_wvelsurf(), IceCompModel.computeBasalTemperatureErrors(), IceCompModel.computeBasalVelocityErrors(), IceModel.computeDrivingStress(), IceModel.computeEffectiveViscosity(), IceROSSModel.computeErrorsInAccurateRegion(), IceCompModel.computeGeometryErrors(), IceCompModel.computeIceBedrockTemperatureErrors(), IceModel.computeMax2DSlidingSpeed(), IceModel.computeMax3DVelocities(), IceModel.computeMaxDiffusivity(), IceModel.computePhiFromBedElevation(), IceCompModel.computeSigmaErrors(), IceCompModel.computeSurfaceVelocityErrors(), IceCompModel.computeTemperatureErrors(), IceModel.correct_cell_areas(), IceModel.correctBasalFrictionalHeating(), IceModel.correctSigma(), IceModel.countCFLViolations(), IceModel.diffuseHmelt(), PAYearlyCycle.end_pointwise_access(), PALapseRates.end_pointwise_access(), PAConstant.end_pointwise_access(), IceModel.energyStats(), IceModel.enthalpyAndDrainageStep(), IceModelVec3.extend_vertically(), IceModelVec2Mask.fill_where_floating(), IceModelVec2Mask.fill_where_grounded(), IceExactSSAModel.fillFromExactSolution(), IceROSSModel.fillinTemps(), IceCompModel.fillSolnTestABCDH(), IceCompModel.fillSolnTestE(), IceCompModel.fillSolnTestFG(), IceCompModel.fillSolnTestK(), IceEISModel.generateMoundTopography(), IceEISModel.generateTroughTopography(), IceCompModel.getCompSourcesTestCDH(), IceCompModel.getCompSourcesTestFG(), IceModelVec3.getHorSlice(), IceMISMIPModel.getMISMIPStats(), IceMISMIPModel.getRoutineStats(), IceModelVec3.getSurfaceValues(), IceModelVec3.has_nan(), IceModel.horizontalVelocitySIARegular(), IceModel.ice_mass_bookkeeping(), PSForceThickness.ice_surface_mass_flux(), IceEISModel.init_couplers(), IceCompModel.initTestABCDEH(), IceCompModel.initTestFG(), IceCompModel.initTestL(), IceModelVec2V.magnitude(), IceModelVec2S.mask_by(), IceModel.massContExplicitStep(), PALapseRates.mean_annual_temp(), PAForcing.mean_precip(), IceModel.putTempAtDepth(), IceROSSModel.readRIGGSandCompare(), IceModel.readShelfStreamBCFromFile(), IceExactSSAModel.reportErrors(), IceModelVec2S.set_to_magnitude(), IceMISMIPModel.setBed(), IcePSTexModel.setBedElev(), IceModel.setCTSFromEnthalpy(), IceModel.setEnth3FromT3_ColdIce(), IceModel.setEnth3FromT3AndLiqfrac3(), IceExactSSAModel.setInitStateAndBoundaryVelsI(), IceExactSSAModel.setInitStateJ(), IceExactSSAModel.setInitStateM(), IceModel.setLiquidFracFromEnthalpy(), IceMISMIPModel.setMask(), IceModel.setMaskSurfaceElevation_bootstrap(), IcePSTexModel.setTillPhi(), POConstant.shelf_base_temperature(), IceModel.SigmaSIAToRegular(), IceModelVec2S.sum(), IceModel.summary(), IceModel.surfaceGradientSIA(), IceExactSSAModel.taucSetI(), IceModel.temperatureStep(), IceUnitModel.test_dof1comm(), IceUnitModel.test_dof2comm(), IceUnitModel.test_IceModelVec2V(), IceUnitModel.test_IceModelVec3(), IceUnitModel.test_IceModelVec3Bedrock(), IceModel.trivialMoveSSAXtoIMV2V(), PA_EISMINT_Greenland.update(), PSLocalMassBalance.update(), PA_SeaRISE_Greenland.update(), IceModel.update_mask(), IceModel.update_nu_viewers(), IceModel.update_surface_elevation(), IceModel.updateYieldStressUsingBasalWater(), IceModel.velocities2DSIAToRegular(), IceModel.velocitySIAStaggered(), IceModel.vertVelocityFromIncompressibility(), IceModelVec3Bedrock.view_sounding(), IceModelVec3.view_sounding(), IceModel.volumeArea(), and IceMISMIPModel.writeMISMIPasciiFile().

PetscErrorCode endGhostComm ( IceModelVec destination  )  [virtual]

Ends the communication of ghost points to IceModelVec destination.

Definition at line 653 of file iceModelVec.cc.

References checkAllocated(), da, dims, localp, name, and v.

PetscErrorCode endGhostComm (  )  [virtual]
GridType grid_type (  )  [virtual]

Returns the grid type of an IceModelVec. (This is the way to figure out if an IceModelVec is 2D or 3D).

Definition at line 90 of file iceModelVec.cc.

References dims.

Referenced by IceModel.regrid(), and IceModel.update_viewers().

bool has_attr ( string  name,
int  component = 0 
) [virtual]

Definition at line 722 of file iceModelVec.cc.

References vars.

Referenced by PISMVars.add().

PetscErrorCode has_nan (  )  [virtual]

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

Reimplemented in IceModelVec3.

Definition at line 795 of file iceModelVec.cc.

References IceGrid.com, grid, name, and norm().

bool is_valid ( PetscScalar  a,
int  N = 0 
) [virtual]

Checks if a value a in in the range of valid values of an IceModelVec.

uses valid_min and valid_max attributes, which can be set using the set_attr() method.

Definition at line 685 of file iceModelVec.cc.

References vars.

PetscErrorCode multiply_by ( IceModelVec x  )  [virtual]

Result: v <- v .* x. Calls VecPointwiseMult.

Definition at line 257 of file iceModelVec.cc.

References checkAllocated(), checkCompatibility(), and v.

PetscErrorCode multiply_by ( IceModelVec x,
IceModelVec result 
) [virtual]

Result: result <- v .* x. Calls VecPointwiseMult.

Definition at line 245 of file iceModelVec.cc.

References checkAllocated(), checkCompatibility(), and v.

Referenced by IceModel.compute_cflx(), and IceMISMIPModel.getMISMIPStats().

PetscErrorCode norm ( NormType  n,
PetscReal &  out 
) [virtual]

Computes the norm of an IceModelVec by calling PETSc VecNorm.

See comment for range(); because local Vecs are VECSEQ, needs a reduce operation. See src/trypetsc/localVecMax.c.

Definition at line 155 of file iceModelVec.cc.

References checkAllocated(), IceGrid.com, grid, localp, name, and v.

Referenced by has_nan(), and IceModel.testConvergenceOfNu().

PetscErrorCode range ( PetscReal &  min,
PetscReal &  max 
) [virtual]

Result: min <- min(v[j]), max <- max(v[j]).

PETSc manual correctly says "VecMin and VecMax are collective on Vec" but GlobalMax,GlobalMin are needed, when localp==true, to get correct values because Vecs created with DACreateLocalVector() are of type VECSEQ and not VECMPI. See src/trypetsc/localVecMax.c.

Definition at line 128 of file iceModelVec.cc.

References checkAllocated(), IceGrid.com, grid, localp, and v.

Referenced by IceModel.bootstrapFromFile(), and IceModel.check_maximum_thickness().

PetscErrorCode read ( const char  filename[],
unsigned int  time 
) [virtual]

Reads appropriate NetCDF variable(s) into an IceModelVec.

Reimplemented in IceModelVec2V.

Definition at line 458 of file iceModelVec.cc.

References IceGrid.com, da, dof, g, getVerbosityLevel(), grid, localp, name, v, and vars.

Referenced by PSConstant.init(), PAYearlyCycle.init(), PALapseRates.init(), PAConstant.init(), IceModel.initFromFile(), and readIceInfoFromFile().

PetscErrorCode regrid ( const char  filename[],
LocalInterpCtx lic,
PetscScalar  default_value 
) [virtual]

Gets an IceModelVec from a file filename, interpolating onto the current grid.

Sets all the values to default_value if the variable was not found.

Reimplemented in IceModelVec2V.

Definition at line 430 of file iceModelVec.cc.

References da, dof, g, interpolation_mask, localp, use_interpolation_mask, v, and vars.

PetscErrorCode regrid ( const char  filename[],
LocalInterpCtx lic,
bool  critical 
) [virtual]

Gets an IceModelVec from a file filename, interpolating onto the current grid.

Stops if the variable was not found and critical == true.

Reimplemented in IceModelVec2V.

Definition at line 400 of file iceModelVec.cc.

References da, dof, g, interpolation_mask, localp, use_interpolation_mask, v, and vars.

Referenced by IceModel.bootstrapFromFile(), PSForceThickness.init(), PSConstant.init(), PAYearlyCycle.init(), PALapseRates.init(), PAConstant.init(), IceROSSModel.readObservedVels(), IceModel.readShelfStreamBCFromFile(), IceModel.regrid(), and IceModelVec2T.update().

PetscErrorCode reset_attrs (  )  [protected, virtual]

Resets most IceModelVec attributes.

Definition at line 347 of file iceModelVec.cc.

References dof, output_data_type, time_independent, vars, and write_in_glaciological_units.

Referenced by IceModelVec(), IceModelVec2V.IceModelVec2V(), and set_name().

PetscErrorCode scale ( PetscScalar  alpha  )  [virtual]
PetscErrorCode set ( PetscScalar  c  )  [virtual]
PetscErrorCode set_attr ( string  name,
vector< double values,
int  component = 0 
) [virtual]

Sets an array attribute.

Definition at line 716 of file iceModelVec.cc.

References vars.

PetscErrorCode set_attr ( string  name,
double  value,
int  component = 0 
) [virtual]

Sets a single-valued double attribute.

Definition at line 710 of file iceModelVec.cc.

References vars.

PetscErrorCode set_attr ( string  attr,
string  value,
int  N = 0 
) [virtual]
PetscErrorCode set_attrs ( string  my_pism_intent,
string  my_long_name,
string  my_units,
string  my_standard_name,
int  N = 0 
) [virtual]

Sets NetCDF attributes of an IceModelVec object.

Call set_attrs("new long name", "new units", "new pism_intent", "") if a variable does not have a standard name. Similarly, by putting "" in an appropriate spot, it is possible tp leave long_name, units or pism_intent unmodified.

If my_units != "", this also resets glaciological_units, so that they match internal units.

Definition at line 372 of file iceModelVec.cc.

References vars.

Referenced by IceModel.allocate_internal_objects(), IceModel.compute_bwp(), IceModel.compute_cbar(), IceModel.compute_cbase(), IceModel.compute_cflx(), IceModel.compute_csurf(), IceModel.compute_cts(), IceModel.compute_dhdt(), IceModel.compute_enthalpybase(), IceModel.compute_enthalpysurf(), IceModel.compute_hardav(), IceModel.compute_liqfrac(), IceModel.compute_proc_ice_area(), IceModel.compute_rank(), IceModel.compute_taud(), IceModel.compute_temp(), IceModel.compute_temp_pa(), IceModel.compute_tempbase(), IceModel.compute_temppabase(), IceModel.compute_tempsurf(), IceModel.compute_uvelbase(), IceModel.compute_uvelsurf(), IceModel.compute_vvelbase(), IceModel.compute_vvelsurf(), IceModel.compute_wvelbase(), IceModel.compute_wvelsurf(), IceModel.computeMaxDiffusivity(), IceModel.correct_cell_areas(), IceCompModel.createVecs(), IceUnitModel.createVecs(), createVecs(), IceROSSModel.createVecs(), IceModel.createVecs(), PSForceThickness.init(), PSLocalMassBalance.init(), PSConstant.init(), PAYearlyCycle.init(), PALapseRates.init(), PAForcing.init(), PAConstant.init(), IceModel.initFromFile(), PISMBedDef.pismbeddef_allocate(), IceModel.readShelfStreamBCFromFile(), IceModel.setCTSFromEnthalpy(), IceModel.setLiquidFracFromEnthalpy(), IceUnitModel.test_IceModelVec2T(), IceUnitModel.test_IceModelVec2V(), PAYearlyCycle.write_diagnostic_fields(), PAYearlyCycle.write_fields(), PAForcing.write_fields(), PAConstant.write_fields(), and PALapseRates.write_model_state().

PetscErrorCode set_glaciological_units ( string  my_units  )  [virtual]
PetscErrorCode set_name ( const char  name[],
int  component = 0 
) [virtual]
PetscErrorCode shift ( PetscScalar  alpha  )  [virtual]

Result: v[j] <- v[j] + alpha for all j. Calls VecShift.

Definition at line 227 of file iceModelVec.cc.

References checkAllocated(), and v.

Referenced by IceModel.compute_temp_pa(), PAForcing.mean_annual_temp(), and PA_EISMINT_Greenland.update().

PetscErrorCode squareroot (  )  [virtual]

Result: v <- sqrt(v), elementwise. Calls VecSqrt(v).

Name avoids clash with sqrt() in math.h.

Definition at line 193 of file iceModelVec.cc.

References checkAllocated(), and v.

string string_attr ( string  name,
int  component = 0 
) [virtual]
bool was_created (  )  [virtual]
PetscErrorCode write ( const char  filename[],
nc_type  nctype 
) [virtual]

Writes an IceModelVec to a NetCDF file.

Reimplemented in IceModelVec2V.

Definition at line 499 of file iceModelVec.cc.

References da, dof, g, localp, time_independent, v, vars, and write_in_glaciological_units.

PetscErrorCode write ( const char  filename[]  )  [virtual]

Member Data Documentation

int access_counter [protected]
void* array [protected]
DA da [protected]
GridType dims [protected]
int dof [protected]
IceGrid* grid [protected]

Definition at line 96 of file iceModelVec.hh.

Referenced by compute_viewer_size(), IceModelVec2T.create(), IceModelVec3Bedrock.create(), IceModelVec3.create(), IceModelVec2V.create(), IceModelVec2.create(), IceModelVec3.create_da(), create_viewer(), IceModelVec2S.diff_x(), IceModelVec2S.diff_x_p(), IceModelVec2S.diff_y(), IceModelVec2S.diff_y_p(), IceModelVec2T.discard(), IceModelVec3.extend_vertically(), IceModelVec3.extend_vertically_private(), IceModelVec2Mask.fill_where_floating(), IceModelVec2Mask.fill_where_grounded(), IceModelVec2.get_component(), IceModelVec2S.get_from_proc0(), IceModelVec2T.get_record(), IceModelVec3.getHorSlice(), IceModelVec3.getPlaneStar_fine(), IceModelVec3.getPlaneStarZ(), IceModelVec3.getSurfaceValues(), IceModelVec3.getValColumn(), IceModelVec3Bedrock.getValColumnPL(), IceModelVec3.getValColumnPL(), IceModelVec3.getValColumnQUAD(), IceModelVec3.getValZ(), IceModelVec3.has_nan(), has_nan(), IceModelVec(), IceModelVec2T.init(), IceModelVec2T.interp(), IceModelVec3Bedrock.isLegalLevel(), IceModelVec3.isLegalLevel(), IceModelVec2V.magnitude(), IceModelVec2S.mask_by(), norm(), IceModelVec2S.put_on_proc0(), range(), IceModelVec2V.read(), read(), IceModelVec2.set_component(), IceModelVec2T.set_record(), IceModelVec2S.set_to_magnitude(), IceModelVec3Bedrock.setColumn(), IceModelVec3.setColumn(), IceModelVec3Bedrock.setInternalColumn(), IceModelVec3.setInternalColumn(), IceModelVec3Bedrock.setValColumnPL(), IceModelVec3.setValColumnPL(), IceModelVec2S.sum(), IceModelVec2T.update(), IceModelVec2V.view(), IceModelVec2.view(), IceModelVec3.view_horizontal_slice(), IceModelVec2S.view_matlab(), IceModelVec3Bedrock.view_sounding(), IceModelVec3.view_sounding(), IceModelVec3.view_surface(), IceModelVec2V.write(), and write().

bool localp [protected]
map<string,PetscViewer>* map_viewers [protected]

it is a map, because a temporary IceModelVec can be used to view different quantities, and a pointer because "shallow copies" should have the acces to the original map

Definition at line 104 of file iceModelVec.hh.

Referenced by destroy(), IceModelVec(), IceModelVec2V.view(), IceModelVec2.view(), and IceModelVec3.view_surface().

string name [protected]

Definition at line 85 of file iceModelVec.hh.

Referenced by IceModel.createVecs(), reset_attrs(), and write().

int s_width [protected]

Definition at line 98 of file iceModelVec.hh.

Referenced by IceModelVec3.create(), IceModelVec3.create_da(), and IceModelVec().

bool shallow_copy [protected]
Vec v [protected]
vector<NCSpatialVariable> vars [protected]

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