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

#include <source/mathops/array/ArrayDataBasicOps.h>

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

Inheritance graph
[legend]
List of all members.

Public Member Functions

 ArrayDataBasicOps ()
 ~ArrayDataBasicOps ()
void scale (pdat::ArrayData< DIM, TYPE > &dst, const TYPE &alpha, const pdat::ArrayData< DIM, TYPE > &src, const hier::Box< DIM > &box) const
void addScalar (pdat::ArrayData< DIM, TYPE > &dst, const pdat::ArrayData< DIM, TYPE > &src, const TYPE &alpha, const hier::Box< DIM > &box) const
void add (pdat::ArrayData< DIM, TYPE > &dst, const pdat::ArrayData< DIM, TYPE > &src1, const pdat::ArrayData< DIM, TYPE > &src2, const hier::Box< DIM > &box) const
void subtract (pdat::ArrayData< DIM, TYPE > &dst, const pdat::ArrayData< DIM, TYPE > &src1, const pdat::ArrayData< DIM, TYPE > &src2, const hier::Box< DIM > &box) const
void multiply (pdat::ArrayData< DIM, TYPE > &dst, const pdat::ArrayData< DIM, TYPE > &src1, const pdat::ArrayData< DIM, TYPE > &src2, const hier::Box< DIM > &box) const
void divide (pdat::ArrayData< DIM, TYPE > &dst, const pdat::ArrayData< DIM, TYPE > &src1, const pdat::ArrayData< DIM, TYPE > &src2, const hier::Box< DIM > &box) const
void reciprocal (pdat::ArrayData< DIM, TYPE > &dst, const pdat::ArrayData< DIM, TYPE > &src, const hier::Box< DIM > &box) const
void linearSum (pdat::ArrayData< DIM, TYPE > &dst, const TYPE &alpha, const pdat::ArrayData< DIM, TYPE > &src1, const TYPE &beta, const pdat::ArrayData< DIM, TYPE > &src2, const hier::Box< DIM > &box) const
void axpy (pdat::ArrayData< DIM, TYPE > &dst, const TYPE &alpha, const pdat::ArrayData< DIM, TYPE > &src1, const pdat::ArrayData< DIM, TYPE > &src2, const hier::Box< DIM > &box) const
void axmy (pdat::ArrayData< DIM, TYPE > &dst, const TYPE &alpha, const pdat::ArrayData< DIM, TYPE > &src1, const pdat::ArrayData< DIM, TYPE > &src2, const hier::Box< DIM > &box) const
TYPE min (const pdat::ArrayData< DIM, TYPE > &data, const hier::Box< DIM > &box) const
TYPE max (const pdat::ArrayData< DIM, TYPE > &data, const hier::Box< DIM > &box) const
void setRandomValues (pdat::ArrayData< DIM, TYPE > &dst, const TYPE &width, const TYPE &low, const hier::Box< DIM > &box) const

Detailed Description

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

Class ArrayDataBasicOps<DIM> implements a set of basic operations that apply to numerical data maintained as pdat::ArrayData<DIM> objects. These operations include simple arithmetic operations as well as min and max, etc. This class provides a single implementation of these operations that may used to manipulate any of the standard array-based patch data types defined on a patch. Note that each member function accepts a box argument which specifies the portion of the array data on which the associated operation is performed. The actual index region on which the operation occurs is the intersection of this box and the boxes of all the pdat::ArrayData<DIM> objects involved.

These operations typically apply only to the numerical standard built-in types, such as double, float, and int, and the complex type (which may or may not be a built-in type depending on the C++ compiler). Thus, this templated class should only be used to instantiate objects with those types as the template parameter. Those operations whose implementations depend of the data type are specialized for each numerical type. To use this class with other standard types or user-defined types (which may or may not make sense), the member functions must be specialized so that the correct operations are performed.

See also:
pdat::ArrayData


Constructor & Destructor Documentation

template<int DIM, class TYPE>
SAMRAI::math::ArrayDataBasicOps< DIM, TYPE >::ArrayDataBasicOps (  ) 

Empty constructor and destructor.

template<int DIM, class TYPE>
SAMRAI::math::ArrayDataBasicOps< DIM, TYPE >::~ArrayDataBasicOps (  ) 


Member Function Documentation

template<int DIM, class TYPE>
void SAMRAI::math::ArrayDataBasicOps< DIM, TYPE >::scale ( pdat::ArrayData< DIM, TYPE > &  dst,
const TYPE &  alpha,
const pdat::ArrayData< DIM, TYPE > &  src,
const hier::Box< DIM > &  box 
) const

Set dst = alpha * src, elementwise.

template<int DIM, class TYPE>
void SAMRAI::math::ArrayDataBasicOps< DIM, TYPE >::addScalar ( pdat::ArrayData< DIM, TYPE > &  dst,
const pdat::ArrayData< DIM, TYPE > &  src,
const TYPE &  alpha,
const hier::Box< DIM > &  box 
) const

Set dst = src + alpha, elementwise.

template<int DIM, class TYPE>
void SAMRAI::math::ArrayDataBasicOps< DIM, TYPE >::add ( pdat::ArrayData< DIM, TYPE > &  dst,
const pdat::ArrayData< DIM, TYPE > &  src1,
const pdat::ArrayData< DIM, TYPE > &  src2,
const hier::Box< DIM > &  box 
) const

Set dst = src1 + src2, elementwise.

template<int DIM, class TYPE>
void SAMRAI::math::ArrayDataBasicOps< DIM, TYPE >::subtract ( pdat::ArrayData< DIM, TYPE > &  dst,
const pdat::ArrayData< DIM, TYPE > &  src1,
const pdat::ArrayData< DIM, TYPE > &  src2,
const hier::Box< DIM > &  box 
) const

Set dst = src1 - src2, elementwise.

template<int DIM, class TYPE>
void SAMRAI::math::ArrayDataBasicOps< DIM, TYPE >::multiply ( pdat::ArrayData< DIM, TYPE > &  dst,
const pdat::ArrayData< DIM, TYPE > &  src1,
const pdat::ArrayData< DIM, TYPE > &  src2,
const hier::Box< DIM > &  box 
) const

Set dst = src1 * src2, elementwise.

template<int DIM, class TYPE>
void SAMRAI::math::ArrayDataBasicOps< DIM, TYPE >::divide ( pdat::ArrayData< DIM, TYPE > &  dst,
const pdat::ArrayData< DIM, TYPE > &  src1,
const pdat::ArrayData< DIM, TYPE > &  src2,
const hier::Box< DIM > &  box 
) const

Set dst = src1 / src2, elementwise. No check for division by zero.

template<int DIM, class TYPE>
void SAMRAI::math::ArrayDataBasicOps< DIM, TYPE >::reciprocal ( pdat::ArrayData< DIM, TYPE > &  dst,
const pdat::ArrayData< DIM, TYPE > &  src,
const hier::Box< DIM > &  box 
) const

Set dst = 1 / src, elementwise. No check for division by zero.

template<int DIM, class TYPE>
void SAMRAI::math::ArrayDataBasicOps< DIM, TYPE >::linearSum ( pdat::ArrayData< DIM, TYPE > &  dst,
const TYPE &  alpha,
const pdat::ArrayData< DIM, TYPE > &  src1,
const TYPE &  beta,
const pdat::ArrayData< DIM, TYPE > &  src2,
const hier::Box< DIM > &  box 
) const

Set dst = alpha * src1 + beta * src2, elementwise.

template<int DIM, class TYPE>
void SAMRAI::math::ArrayDataBasicOps< DIM, TYPE >::axpy ( pdat::ArrayData< DIM, TYPE > &  dst,
const TYPE &  alpha,
const pdat::ArrayData< DIM, TYPE > &  src1,
const pdat::ArrayData< DIM, TYPE > &  src2,
const hier::Box< DIM > &  box 
) const

Set dst = alpha * src1 + src2, elementwise.

template<int DIM, class TYPE>
void SAMRAI::math::ArrayDataBasicOps< DIM, TYPE >::axmy ( pdat::ArrayData< DIM, TYPE > &  dst,
const TYPE &  alpha,
const pdat::ArrayData< DIM, TYPE > &  src1,
const pdat::ArrayData< DIM, TYPE > &  src2,
const hier::Box< DIM > &  box 
) const

Set dst = alpha * src1 - src2, elementwise.

template<int DIM, class TYPE>
TYPE SAMRAI::math::ArrayDataBasicOps< DIM, TYPE >::min ( const pdat::ArrayData< DIM, TYPE > &  data,
const hier::Box< DIM > &  box 
) const

Return the minimum array data entry. If data is complex, return the array data entry with the minimum norm.

template<int DIM, class TYPE>
TYPE SAMRAI::math::ArrayDataBasicOps< DIM, TYPE >::max ( const pdat::ArrayData< DIM, TYPE > &  data,
const hier::Box< DIM > &  box 
) const

Return the maximum array data entry. If data is complex, return the array data entry with the maximum norm.

template<int DIM, class TYPE>
void SAMRAI::math::ArrayDataBasicOps< DIM, TYPE >::setRandomValues ( pdat::ArrayData< DIM, TYPE > &  dst,
const TYPE &  width,
const TYPE &  low,
const hier::Box< DIM > &  box 
) const

Set dst to random values. If the data is int, each element of dst is set as dst = mrand48(). If the data is double or float, each element of dst is set as dst = width * drand48() + low. If the data is complex, each element of dst is set as dst = dcomplex(rval, ival), where rval = real(width) * drand48() + real(low), and ival = imag(width) * drand48() + imag(low).


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