SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE > Class Template Reference

#include <source/mathops/cell/HierarchyCellDataOpsReal.h>

Inheritance diagram for SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 HierarchyCellDataOpsReal (tbox::Pointer< hier::PatchHierarchy< DIM > > hierarchy, const int coarsest_level=-1, const int finest_level=-1)
virtual ~HierarchyCellDataOpsReal ()
void setPatchHierarchy (tbox::Pointer< hier::PatchHierarchy< DIM > > hierarchy)
void resetLevels (const int coarsest_level, const int finest_level)
const tbox::Pointer< hier::PatchHierarchy<
DIM > > 
getPatchHierarchy () const
void copyData (const int dst_id, const int src_id, const bool interior_only=true) const
void swapData (const int data1_id, const int data2_id) const
void printData (const int data_id, std::ostream &s, const bool interior_only=true) const
void setToScalar (const int data_id, const TYPE &alpha, const bool interior_only=true) const
void scale (const int dst_id, const TYPE &alpha, const int src_id, const bool interior_only=true) const
void addScalar (const int dst_id, const int src_id, const TYPE &alpha, const bool interior_only=true) const
void add (const int dst_id, const int src1_id, const int src2_id, const bool interior_only=true) const
void subtract (const int dst_id, const int src1_id, const int src2_id, const bool interior_only=true) const
void multiply (const int dst_id, const int src1_id, const int src2_id, const bool interior_only=true) const
void divide (const int dst_id, const int src1_id, const int src2_id, const bool interior_only=true) const
void reciprocal (const int dst_id, const int src_id, const bool interior_only=true) const
void linearSum (const int dst_id, const TYPE &alpha, const int src1_id, const TYPE &beta, const int src2_id, const bool interior_only=true) const
void axpy (const int dst_id, const TYPE &alpha, const int src1_id, const int src2_id, const bool interior_only=true) const
void axmy (const int dst_id, const TYPE &alpha, const int src1_id, const int src2_id, const bool interior_only=true) const
void abs (const int dst_id, const int src_id, const bool interior_only=true) const
TYPE min (const int data_id, const bool interior_only=true) const
TYPE max (const int data_id, const bool interior_only=true) const
void setRandomValues (const int data_id, const TYPE &width, const TYPE &low, const bool interior_only=true) const
int numberOfEntries (const int data_id, const bool interior_only=true) const
double sumControlVolumes (const int data_id, const int vol_id) const
double L1Norm (const int data_id, const int vol_id=-1, bool local_only=false) const
double L2Norm (const int data_id, const int vol_id=-1, bool local_only=false) const
double weightedL2Norm (const int data_id, const int weight_id, const int vol_id=-1) const
double RMSNorm (const int data_id, const int vol_id=-1) const
double weightedRMSNorm (const int data_id, const int weight_id, const int vol_id=-1) const
double maxNorm (const int data_id, const int vol_id=-1, bool local_only=false) const
TYPE dot (const int data1_id, const int data2_id, const int vol_id=-1, bool local_only=false) const
TYPE integral (const int data_id, const int vol_id) const
int computeConstrProdPos (const int data1_id, const int data2_id, const int vol_id=-1) const
void compareToScalar (const int dst_id, const int src_id, const TYPE &alpha, const int vol_id=-1) const
int testReciprocal (const int dst_id, const int src_id, const int vol_id=-1) const
TYPE maxPointwiseDivide (const int numer_id, const int denom_id, bool local_only=false) const
 Compute max of "conditional" quotients of two arrays.
TYPE minPointwiseDivide (const int numer_id, const int denom_id, bool local_only=false) const
 Compute min of quotients of two arrays.

Detailed Description

template<int DIM, class TYPE>
class SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >

Class HierarchyCellDataOpsReal<DIM> provides a collection of operations that manipulate real (double and float) cell-centered patch data components over multiple levels in an AMR hierarchy. It is derived from the abstract base class HierarchyDataOpsReal<DIM> which defines the interface to similar operations for cell-centered, face-centered, node-centered patch data objects where the data is either double or float. The operations include basic arithmetic, norms and ordering, and assorted miscellaneous operations. On each patch, the operations are performed by the PatchCellDataOpsReal<DIM> data member.

The patch hierarchy and set of levels within that hierarcy over which the operations will be performed are set in the constructor. However, note that the constructor accepts default arguments for the coarsest and finest level numbers. If the level numbers are not specified when calling the constructor the levels which exist in the hierarchy will be assumed in all operations. The hierarchy and levels may be changed at any time using the proper member functions.

Note that, when it makes sense, an operation accept a boolean argument which indicates whether the operation should be performed on all of the data or just those data elements corresponding to the patch interiors. If no boolean argument is provided, the default behavior is to treat only the patch interiors. Also, a similar set of operations for complex and integer cell-centered data is provided in the classes HierarchyCellDataOpsComplex<DIM> and HierarchyCellDataOpsInteger<DIM>, respectively.

See also:
math::PatchCellDataOpsReal


Constructor & Destructor Documentation

template<int DIM, class TYPE>
SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::HierarchyCellDataOpsReal ( tbox::Pointer< hier::PatchHierarchy< DIM > >  hierarchy,
const int  coarsest_level = -1,
const int  finest_level = -1 
)

The constructor for the HierarchyCellDataOpsReal<DIM> class sets the default patch hierarchy and coarsest and finest patch levels in that hierarchy over which operations will be performed. The hierarchy and operations may be reset using the member functions setPatchHierarchy() and resetLevels() below. If no level number arguments are given here, the levels over which the operations will be performed are those already existing in the hierarchy. If the hierarchy level configuration changes, the operations must be explicitly reset by calling the resetLevels() function.

template<int DIM, class TYPE>
SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::~HierarchyCellDataOpsReal (  )  [virtual]

Virtual destructor for the HierarchyCellDataOpsReal<DIM> class.


Member Function Documentation

template<int DIM, class TYPE>
void SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::setPatchHierarchy ( tbox::Pointer< hier::PatchHierarchy< DIM > >  hierarchy  )  [virtual]

Reset patch hierarchy over which operations occur.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
void SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::resetLevels ( const int  coarsest_level,
const int  finest_level 
) [virtual]

Reset range of patch levels over which operations occur. The levels must exist in the hierarchy or an assertion will result.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
const tbox::Pointer< hier::PatchHierarchy< DIM > > SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::getPatchHierarchy (  )  const [virtual]

Return const pointer to patch hierarchy associated with operations.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
void SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::copyData ( const int  dst_id,
const int  src_id,
const bool  interior_only = true 
) const [virtual]

Copy source data to destination data.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
void SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::swapData ( const int  data1_id,
const int  data2_id 
) const [virtual]

Swap data pointers (i.e., storage) between two data components.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
void SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::printData ( const int  data_id,
std::ostream &  s,
const bool  interior_only = true 
) const [virtual]

Print data over multiple levels to specified output stream.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
void SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::setToScalar ( const int  data_id,
const TYPE &  alpha,
const bool  interior_only = true 
) const [virtual]

Set data component to given scalar.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
void SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::scale ( const int  dst_id,
const TYPE &  alpha,
const int  src_id,
const bool  interior_only = true 
) const [virtual]

Set destination to source multiplied by given scalar, pointwise.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
void SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::addScalar ( const int  dst_id,
const int  src_id,
const TYPE &  alpha,
const bool  interior_only = true 
) const [virtual]

Add scalar to each entry in source data and set destination to result.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
void SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::add ( const int  dst_id,
const int  src1_id,
const int  src2_id,
const bool  interior_only = true 
) const [virtual]

Set destination to sum of two source components, pointwise.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
void SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::subtract ( const int  dst_id,
const int  src1_id,
const int  src2_id,
const bool  interior_only = true 
) const [virtual]

Subtract second source component from first source component pointwise and set destination data component to result.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
void SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::multiply ( const int  dst_id,
const int  src1_id,
const int  src2_id,
const bool  interior_only = true 
) const [virtual]

Set destination component to product of two source components, pointwise.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
void SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::divide ( const int  dst_id,
const int  src1_id,
const int  src2_id,
const bool  interior_only = true 
) const [virtual]

Divide first data component by second source component pointwise and set destination data component to result.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
void SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::reciprocal ( const int  dst_id,
const int  src_id,
const bool  interior_only = true 
) const [virtual]

Set each entry of destination component to reciprocal of corresponding source data component entry.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
void SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::linearSum ( const int  dst_id,
const TYPE &  alpha,
const int  src1_id,
const TYPE &  beta,
const int  src2_id,
const bool  interior_only = true 
) const [virtual]

Set $d = \alpha s_1 + \beta s_2$, where $d$ is the destination patch data component and $s_1, s_2$ are the first and second source components, respectively. Here $\alpha, \beta$ are scalar values.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
void SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::axpy ( const int  dst_id,
const TYPE &  alpha,
const int  src1_id,
const int  src2_id,
const bool  interior_only = true 
) const [virtual]

Set $d = \alpha s_1 + s_2$, where $d$ is the destination patch data component and $s_1, s_2$ are the first and second source components, respectively. Here $\alpha$ is a scalar.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
void SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::axmy ( const int  dst_id,
const TYPE &  alpha,
const int  src1_id,
const int  src2_id,
const bool  interior_only = true 
) const [virtual]

Set $d = \alpha s_1 - s_2$, where $d$ is the destination patch data component and $s_1, s_2$ are the first and second source components, respectively. Here $\alpha$ is a scalar.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
void SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::abs ( const int  dst_id,
const int  src_id,
const bool  interior_only = true 
) const [virtual]

Set destination data to absolute value of source data, pointwise.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
TYPE SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::min ( const int  data_id,
const bool  interior_only = true 
) const [virtual]

Return minimum data value over all patches in the collection of levels.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
TYPE SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::max ( const int  data_id,
const bool  interior_only = true 
) const [virtual]

Return maximum data value over all patches in the collection of levels.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
void SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::setRandomValues ( const int  data_id,
const TYPE &  width,
const TYPE &  low,
const bool  interior_only = true 
) const [virtual]

Set data entries to random values. See the operations in the array data operation classes for each data type for details on the generation of the random values.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
int SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::numberOfEntries ( const int  data_id,
const bool  interior_only = true 
) const [virtual]

Return the total number of data values for the component on the set of hierarchy levels. If the boolean argument is true, the number of elements will be summed over patch interiors. If the boolean argument is false, all elements will be counted (including ghost values) over all patches.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
double SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::sumControlVolumes ( const int  data_id,
const int  vol_id 
) const [virtual]

Return sum of the control volumes associated with the data component. Note that if the ontrol volumes are set propery, this is equivalent to integrating a data component containing all ones over the collection of hierarchy levels.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
double SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::L1Norm ( const int  data_id,
const int  vol_id = -1,
bool  local_only = false 
) const [virtual]

Return discrete $L_1$-norm of the data using the control volume to weight the contribution of each data entry to the sum. That is, the return value is the sum $\sum_i ( \| data_i \| cvol_i )$. If the control volume is not defined (vol_id < 0), the return value is $\sum_i ( \| data_i \| )$. If local_only is true, the global reduction is not performed (thus each process will get only local results).

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
double SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::L2Norm ( const int  data_id,
const int  vol_id = -1,
bool  local_only = false 
) const [virtual]

Return discrete $L_2$-norm of the data using the control volume to weight the contribution of each data entry to the sum. That is, the return value is the sum $\sqrt{ \sum_i ( (data_i)^2 cvol_i ) }$. If the control volume is not defined (vol_id < 0), the return value is $\sqrt{ \sum_i ( (data_i)^2 cvol_i ) }$. If local_only is true, the global reduction is not performed (thus each process will get only local results).

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
double SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::weightedL2Norm ( const int  data_id,
const int  weight_id,
const int  vol_id = -1 
) const [virtual]

Return discrete weighted $L_2$-norm of the data using the control volume to weight the contribution of the data and weight entries to the sum. That is, the return value is the sum $\sqrt{ \sum_i ( (data_i * weight_i)^2 cvol_i ) }$. If the control volume is not defined (vol_id < 0), the return value is $\sqrt{ \sum_i ( (data_i * weight_i)^2 ) }$.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
double SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::RMSNorm ( const int  data_id,
const int  vol_id = -1 
) const [virtual]

Return discrete root mean squared norm of the data. If the control volume is defined, the return value is the $L_2$-norm divided by the square root of the sum of the control volumes. Otherwise, the return value is the $L_2$-norm divided by the square root of the number of data entries.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
double SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::weightedRMSNorm ( const int  data_id,
const int  weight_id,
const int  vol_id = -1 
) const [virtual]

Return discrete weighted root mean squared norm of the data. If the control volume is define, the return value is the weighted $L_2$-norm divided by the square root of the sum of the control volumes. Otherwise, the return value is the weighted $L_2$-norm divided by the square root of the number of data entries.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
double SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::maxNorm ( const int  data_id,
const int  vol_id = -1,
bool  local_only = false 
) const [virtual]

Return the $\max$-norm of the data using the control volume to weight the contribution of each data entry to the maximum. That is, the return value is $\max_i ( \| data_i \| )$, where the max is over the data elements where $cvol_i > 0$. If the control volume is undefined (vol_id < 0), it is ignored during the computation of the maximum. If local_only is true, the global reduction is not performed (thus each process will get only local results).

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
TYPE SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::dot ( const int  data1_id,
const int  data2_id,
const int  vol_id = -1,
bool  local_only = false 
) const [virtual]

Return the dot product of the two data arrays using the control volume to weight the contribution of each product to the sum. That is, the return value is the sum $\sum_i ( data1_i * data2_i * cvol_i )$. If the control volume is undefined (vol_id < 0), it is ignored during the summation. If local_only is true, the global reduction is not performed (thus each process will get only local results).

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
TYPE SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::integral ( const int  data_id,
const int  vol_id 
) const

Return the integral of the function represented by the data array. The return value is the sum $\sum_i ( data_i * vol_i )$.

template<int DIM, class TYPE>
int SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::computeConstrProdPos ( const int  data1_id,
const int  data2_id,
const int  vol_id = -1 
) const [virtual]

Return 1 if $\|data2_i\| > 0$ and $data1_i * data2_i \leq 0$, for any $i$ in the set of patch data indices, where $cvol_i > 0$. Otherwise, return 0. If the control volume is undefined (vol_id < 0), all values on the patch interiors are considered.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
void SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::compareToScalar ( const int  dst_id,
const int  src_id,
const TYPE &  alpha,
const int  vol_id = -1 
) const [virtual]

Wherever $cvol_i > 0$ in the set of patch data indices, set $dst_i = 1$ if $\|src_i\| > \alpha$, and $dst_i = 0$ otherwise. If the control volume is undefined (vol_id < 0), all values on the patch interiors are considered.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
int SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::testReciprocal ( const int  dst_id,
const int  src_id,
const int  vol_id = -1 
) const [virtual]

Wherever $cvol_i > 0$ in the set of patch data indices, set $dst_i = 1/src_i$ if $src_i \neq 0$, and $dst_i = 0$ otherwise. If $dst_i = 0$ anywhere, 0 is the return value. Otherwise 1 is returned. If the control volume is undefined (vol_id < 0), all values on the patch interiors are considered.

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
TYPE SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::maxPointwiseDivide ( const int  numer_id,
const int  denom_id,
bool  local_only = false 
) const [virtual]

Compute max of "conditional" quotients of two arrays.

Return the maximum of pointwise "conditional" quotients of the numerator and denominator.

The "conditional" quotient is defined as |numerator/denominator| where the denominator is nonzero. Otherwise, it is defined as |numerator|.

Note: This method is currently intended to support the PETSc-2.1.6 vector wrapper only. Please do not use it!

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.

template<int DIM, class TYPE>
TYPE SAMRAI::math::HierarchyCellDataOpsReal< DIM, TYPE >::minPointwiseDivide ( const int  numer_id,
const int  denom_id,
bool  local_only = false 
) const [virtual]

Compute min of quotients of two arrays.

Return the minimum of pointwise quotients of the numerator and denominator.

The quotient is defined as (numerator/denominator) where the denominator is nonzero. When the denominator is zero, the entry is skipped. If the denominator is always zero, the value of tbox::IEEE::getFLT_MAX() is returned (see SAMRAI::tbox::IEEE).

Note: This method is currently intended to support the SUNDIALS vector wrapper only. Please do not use it!

Implements SAMRAI::math::HierarchyDataOpsReal< DIM, TYPE >.


The documentation for this class was generated from the following files:
Generated on Thu Jun 18 11:28:32 2009 for SAMRAI by  doxygen 1.5.1