SAMRAI::pdat::EdgeData< DIM, TYPE > Class Template Reference

Class EdgeData<DIM> provides an implementation for data defined at cell edges on AMR patches. It is derived from the hier::PatchData interface common to all SAMRAI patch data types. Given a CELL-centered AMR index space box, an edge data object represents data of some template TYPE and depth on the edges of the cells in the box. Here, depth indicates the number of data values at each edge index location. The EdgeGeometry class provides the translation between the standard SAMRAI cell-centered AMR index space and edge-centered data. More...

#include <source/patchdata/edge/EdgeData.h>

Inheritance diagram for SAMRAI::pdat::EdgeData< DIM, TYPE >:

Inheritance graph
[legend]
List of all members.

Public Types

typedef EdgeIterator< DIM > Iterator

Public Member Functions

 EdgeData (const hier::Box< DIM > &box, int depth, const hier::IntVector< DIM > &ghosts, tbox::Pointer< tbox::Arena > pool=tbox::Pointer< tbox::Arena >((0)))
 The constructor for an edge data object.
virtual ~EdgeData ()
 The virtual destructor for an edge data object.
int getDepth () const
 Return the depth (e.g., the number of components in each spatial location) of the array.
TYPE * getPointer (int axis, int depth=0)
 Get a pointer to the beginning of a particular axis and depth component of the edge centered array.
const TYPE * getPointer (int axis, int depth=0) const
 Get a const pointer to the beginning of a particular axis and depth component of the edge centered array.
TYPE & operator() (const EdgeIndex< DIM > &i, int depth=0)
 Return a reference to the data entry corresponding to a given edge index and depth.
const TYPE & operator() (const EdgeIndex< DIM > &i, int depth=0) const
 Return a const reference to the data entry corresponding to a given edge index and depth.
ArrayData< DIM, TYPE > & getArrayData (int axis)
 Return a reference to the array data object for the given axis of the edge centered data object.
const ArrayData< DIM, TYPE > & getArrayData (int axis) const
 Return a const reference to the array data object for the given axis of the edge centered data object.
virtual void copy (const hier::PatchData< DIM > &src)
 A fast copy from source to destination (i.e., this) patch data object.
virtual void copy2 (hier::PatchData< DIM > &dst) const
 A fast copy from source (i.e., this) to destination patch data object.
virtual void copy (const hier::PatchData< DIM > &src, const hier::BoxOverlap< DIM > &overlap)
 Copy data from source to destination (i.e., this) patch data object on the given overlap.
virtual void copy2 (hier::PatchData< DIM > &dst, const hier::BoxOverlap< DIM > &overlap) const
 Copy data from source (i.e., this) to destination patch data object on the given overlap.
void copyOnBox (const EdgeData< DIM, TYPE > &src, const hier::Box< DIM > &box)
 Copy data from source to destination (i.e., this) patch data object on the given CELL-centered AMR index box.
void copyDepth (int dst_depth, const EdgeData< DIM, TYPE > &src, int src_depth)
 Fast copy (i.e., source and this edge data objects are defined over the same box) to this destination edge data object from the given source edge data object at the specified depths.
virtual bool canEstimateStreamSizeFromBox () const
 Return true if the patch data object can estimate the stream size required to fit its data using only index space information (i.e., a box).
virtual int getDataStreamSize (const hier::BoxOverlap< DIM > &overlap) const
 Return the number of bytes needed to stream the data in this patch data object lying in the specified box overlap region.
virtual void packStream (tbox::AbstractStream &stream, const hier::BoxOverlap< DIM > &overlap) const
 Pack data in this patch data object lying in the specified box overlap region into the stream. The overlap must be an EdgeOverlap of the same DIM.
virtual void unpackStream (tbox::AbstractStream &stream, const hier::BoxOverlap< DIM > &overlap)
 Unpack data from stream into this patch data object over the specified box overlap region. The overlap must be an EdgeOverlap of the same DIM.
void fill (const TYPE &t, int d=0)
 Fill all values at depth d with the value t.
void fill (const TYPE &t, const hier::Box< DIM > &box, int d=0)
 Fill all values at depth d within the box with the value t.
void fillAll (const TYPE &t)
 Fill all depth components with value t.
void fillAll (const TYPE &t, const hier::Box< DIM > &box)
 Fill all depth components within the box with value t.
void print (const hier::Box< DIM > &box, std::ostream &os=tbox::plog, int prec=12) const
 Print all edge data values residing in the specified box. If the depth of the array is greater than one, all depths are printed.
void print (const hier::Box< DIM > &box, int depth, std::ostream &os=tbox::plog, int prec=12) const
 Print all edge data values at the given array depth in the specified box.
void printAxis (int axis, const hier::Box< DIM > &box, std::ostream &os=tbox::plog, int prec=12) const
 Print all edge centered data values for specified axis residing in the specified box. If the depth of the data is greater than one, all depths are printed.
void printAxis (int axis, const hier::Box< DIM > &box, int depth, std::ostream &os=tbox::plog, int prec=12) const
 Print all edge centered data values for specified axis residing in the specified box. If the depth of the data is greater than one, all depths are printed.
virtual void getSpecializedFromDatabase (tbox::Pointer< tbox::Database > database)
virtual void putSpecializedToDatabase (tbox::Pointer< tbox::Database > database)

Static Public Member Functions

static size_t getSizeOfData (const hier::Box< DIM > &box, int depth, const hier::IntVector< DIM > &ghosts)
 Calculate the amount of memory needed to represent edge- centered data over a CELL-centered AMR index space box.

Detailed Description

template<int DIM, class TYPE>
class SAMRAI::pdat::EdgeData< DIM, TYPE >

Class EdgeData<DIM> provides an implementation for data defined at cell edges on AMR patches. It is derived from the hier::PatchData interface common to all SAMRAI patch data types. Given a CELL-centered AMR index space box, an edge data object represents data of some template TYPE and depth on the edges of the cells in the box. Here, depth indicates the number of data values at each edge index location. The EdgeGeometry class provides the translation between the standard SAMRAI cell-centered AMR index space and edge-centered data.

Edge data is stored in DIM arrays, each of which contains the data for the edges tangent to a corresponding coordinate direction. Within each array, data is stored in (i,...,k,d) order, where i,...,k indicates a spatial index and the d indicates the component depth at that locaion. Memory allocation is in column-major ordering (e.g., Fortran style) so that the leftmost index runs fastest in memory. For example, a three-dimensional edge data object created over a CELL-centered AMR index space [l0:u0,l1:u1,l2:u2] allocates three data arrays dimensioned as follows:


   axis 0 
     [ l0 : u0 ,
       l1 : u1+1 ,
       l2 : u2+1 , d ]   ,

   axis 1 
     [ l0 : u0+1 ,
       l1 : u1 ,
       l2 : u2+1 , d ]   ,

   axis 2 
     [ l0 : u0+1 ,
       l1 : u1+1 ,
       l2 : u2 , d ]   ,
 
 * 
Here the axis directions 0, 1, 2 can be thought of as the x, y, and z edge directions, respectively, and d is the depth index (i.e., number of values at each face index location). Other spatial dimensions are represented similarly.

The data type TYPE must define a default constructor (that takes no arguments) and also the assignment operator.

See also:
pdat::ArrayData

hier::PatchData

pdat::EdgeDataFactory

pdat::EdgeIndex

pdat::EdgeIterator

pdat::EdgeGeometry


Member Typedef Documentation

template<int DIM, class TYPE>
typedef EdgeIterator<DIM> SAMRAI::pdat::EdgeData< DIM, TYPE >::Iterator

The edge iterator iterates over the elements on one axis of an edge centered box geometry. This typedef is a convenience for using the EdgeIterator<DIM> class.


Constructor & Destructor Documentation

template<int DIM, class TYPE>
SAMRAI::pdat::EdgeData< DIM, TYPE >::EdgeData ( const hier::Box< DIM > &  box,
int  depth,
const hier::IntVector< DIM > &  ghosts,
tbox::Pointer< tbox::Arena pool = tbox::Pointertbox::Arena >((0)) 
)

The constructor for an edge data object.

Parameters:
box const Box reference describing the interior of the standard CELL-centered index box over which the edge data object will be created.
depth gives the number of components for each spatial location in the array.
ghosts const IntVector reference indicating the width of the ghost cell region around the box over which the edge data will be allocated.
pool memory arena. If not given, then the standard arena is used.

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

The virtual destructor for an edge data object.


Member Function Documentation

template<int DIM, class TYPE>
size_t SAMRAI::pdat::EdgeData< DIM, TYPE >::getSizeOfData ( const hier::Box< DIM > &  box,
int  depth,
const hier::IntVector< DIM > &  ghosts 
) [static]

Calculate the amount of memory needed to represent edge- centered data over a CELL-centered AMR index space box.

This function assumes that the amount of memory needed for TYPE is sizeof(TYPE). If this is not the case, then a specialized function must be defined.

Parameters:
box const Box reference describing the interior of the standard CELL-centered index box over which the edge data object will be created.
depth gives the number of components for each spatial location in the array.
ghosts const IntVector reference indicating the width of the ghost cell region around the box over which the edge data will be allocated.

template<int DIM, class TYPE>
int SAMRAI::pdat::EdgeData< DIM, TYPE >::getDepth (  )  const [inline]

Return the depth (e.g., the number of components in each spatial location) of the array.

template<int DIM, class TYPE>
TYPE * SAMRAI::pdat::EdgeData< DIM, TYPE >::getPointer ( int  axis,
int  depth = 0 
) [inline]

Get a pointer to the beginning of a particular axis and depth component of the edge centered array.

template<int DIM, class TYPE>
const TYPE * SAMRAI::pdat::EdgeData< DIM, TYPE >::getPointer ( int  axis,
int  depth = 0 
) const [inline]

Get a const pointer to the beginning of a particular axis and depth component of the edge centered array.

template<int DIM, class TYPE>
TYPE & SAMRAI::pdat::EdgeData< DIM, TYPE >::operator() ( const EdgeIndex< DIM > &  i,
int  depth = 0 
) [inline]

Return a reference to the data entry corresponding to a given edge index and depth.

template<int DIM, class TYPE>
const TYPE & SAMRAI::pdat::EdgeData< DIM, TYPE >::operator() ( const EdgeIndex< DIM > &  i,
int  depth = 0 
) const [inline]

Return a const reference to the data entry corresponding to a given edge index and depth.

template<int DIM, class TYPE>
ArrayData< DIM, TYPE > & SAMRAI::pdat::EdgeData< DIM, TYPE >::getArrayData ( int  axis  )  [inline]

Return a reference to the array data object for the given axis of the edge centered data object.

template<int DIM, class TYPE>
const ArrayData< DIM, TYPE > & SAMRAI::pdat::EdgeData< DIM, TYPE >::getArrayData ( int  axis  )  const [inline]

Return a const reference to the array data object for the given axis of the edge centered data object.

template<int DIM, class TYPE>
void SAMRAI::pdat::EdgeData< DIM, TYPE >::copy ( const hier::PatchData< DIM > &  src  )  [virtual]

A fast copy from source to destination (i.e., this) patch data object.

Data is copied where there is overlap in the underlying index space. The copy is performed on the interior plus the ghost cell width (for both the source and destination). Currently, source data must be an EdgeData of the same DIM and TYPE. If not, then an unrecoverable error results.

Implements SAMRAI::hier::PatchData< DIM >.

template<int DIM, class TYPE>
void SAMRAI::pdat::EdgeData< DIM, TYPE >::copy2 ( hier::PatchData< DIM > &  dst  )  const [virtual]

A fast copy from source (i.e., this) to destination patch data object.

Data is copied where there is overlap in the underlying index space. The copy is performed on the interior plus the ghost cell width (for both the source and destination). Currently, destination data must be an EdgeData of the same DIM and TYPE. If not, then an unrecoverable error results.

Implements SAMRAI::hier::PatchData< DIM >.

template<int DIM, class TYPE>
void SAMRAI::pdat::EdgeData< DIM, TYPE >::copy ( const hier::PatchData< DIM > &  src,
const hier::BoxOverlap< DIM > &  overlap 
) [virtual]

Copy data from source to destination (i.e., this) patch data object on the given overlap.

Currently, source data must be EdgeData of the same DIM and TYPE and the overlap must be a EdgeOverlap of the same DIM. If not, then an unrecoverable error results.

Implements SAMRAI::hier::PatchData< DIM >.

template<int DIM, class TYPE>
void SAMRAI::pdat::EdgeData< DIM, TYPE >::copy2 ( hier::PatchData< DIM > &  dst,
const hier::BoxOverlap< DIM > &  overlap 
) const [virtual]

Copy data from source (i.e., this) to destination patch data object on the given overlap.

Currently, destination data must be EdgeData of the same DIM and TYPE and the overlap must be a EdgeOverlap of the same DIM. If not, then an unrecoverable error results.

Implements SAMRAI::hier::PatchData< DIM >.

template<int DIM, class TYPE>
void SAMRAI::pdat::EdgeData< DIM, TYPE >::copyOnBox ( const EdgeData< DIM, TYPE > &  src,
const hier::Box< DIM > &  box 
) [inline]

Copy data from source to destination (i.e., this) patch data object on the given CELL-centered AMR index box.

template<int DIM, class TYPE>
void SAMRAI::pdat::EdgeData< DIM, TYPE >::copyDepth ( int  dst_depth,
const EdgeData< DIM, TYPE > &  src,
int  src_depth 
)

Fast copy (i.e., source and this edge data objects are defined over the same box) to this destination edge data object from the given source edge data object at the specified depths.

template<int DIM, class TYPE>
bool SAMRAI::pdat::EdgeData< DIM, TYPE >::canEstimateStreamSizeFromBox (  )  const [virtual]

Return true if the patch data object can estimate the stream size required to fit its data using only index space information (i.e., a box).

This routine is defined for the standard types (bool, char, double, float, int, and dcomplex).

Implements SAMRAI::hier::PatchData< DIM >.

template<int DIM, class TYPE>
int SAMRAI::pdat::EdgeData< DIM, TYPE >::getDataStreamSize ( const hier::BoxOverlap< DIM > &  overlap  )  const [virtual]

Return the number of bytes needed to stream the data in this patch data object lying in the specified box overlap region.

This routine is defined for the standard types (bool, char, double, float, int, and dcomplex).

Implements SAMRAI::hier::PatchData< DIM >.

template<int DIM, class TYPE>
void SAMRAI::pdat::EdgeData< DIM, TYPE >::packStream ( tbox::AbstractStream stream,
const hier::BoxOverlap< DIM > &  overlap 
) const [virtual]

Pack data in this patch data object lying in the specified box overlap region into the stream. The overlap must be an EdgeOverlap of the same DIM.

Implements SAMRAI::hier::PatchData< DIM >.

template<int DIM, class TYPE>
void SAMRAI::pdat::EdgeData< DIM, TYPE >::unpackStream ( tbox::AbstractStream stream,
const hier::BoxOverlap< DIM > &  overlap 
) [virtual]

Unpack data from stream into this patch data object over the specified box overlap region. The overlap must be an EdgeOverlap of the same DIM.

Implements SAMRAI::hier::PatchData< DIM >.

template<int DIM, class TYPE>
void SAMRAI::pdat::EdgeData< DIM, TYPE >::fill ( const TYPE &  t,
int  d = 0 
)

Fill all values at depth d with the value t.

template<int DIM, class TYPE>
void SAMRAI::pdat::EdgeData< DIM, TYPE >::fill ( const TYPE &  t,
const hier::Box< DIM > &  box,
int  d = 0 
)

Fill all values at depth d within the box with the value t.

template<int DIM, class TYPE>
void SAMRAI::pdat::EdgeData< DIM, TYPE >::fillAll ( const TYPE &  t  ) 

Fill all depth components with value t.

template<int DIM, class TYPE>
void SAMRAI::pdat::EdgeData< DIM, TYPE >::fillAll ( const TYPE &  t,
const hier::Box< DIM > &  box 
)

Fill all depth components within the box with value t.

template<int DIM, class TYPE>
void SAMRAI::pdat::EdgeData< DIM, TYPE >::print ( const hier::Box< DIM > &  box,
std::ostream &  os = tbox::plog,
int  prec = 12 
) const

Print all edge data values residing in the specified box. If the depth of the array is greater than one, all depths are printed.

Parameters:
box const reference to box over whioch to print data. Note box is assumed to reside in standard cell-centered index space and will be converted to edge index space.
os reference to output stream.
prec integer precision for printing floating point numbers (i.e., TYPE = float, double, or dcomplex). The default is 12 decimal places for double and complex floating point numbers, and the default is 6 decimal places floats. For other types, this value is ignored.

template<int DIM, class TYPE>
void SAMRAI::pdat::EdgeData< DIM, TYPE >::print ( const hier::Box< DIM > &  box,
int  depth,
std::ostream &  os = tbox::plog,
int  prec = 12 
) const

Print all edge data values at the given array depth in the specified box.

Parameters:
box const reference to box over whioch to print data. Note box is assumed to reside in standard cell-centered index space and will be converted to edge index space.
depth integer depth component, must satisfy 0 <= depth < actual depth of data array
os reference to output stream.
prec integer precision for printing floating point numbers (i.e., TYPE = float, double, or dcomplex). The default is 12 decimal places for double and complex floating point numbers, and the default is 6 decimal places floats. For other types, this value is ignored.

template<int DIM, class TYPE>
void SAMRAI::pdat::EdgeData< DIM, TYPE >::printAxis ( int  axis,
const hier::Box< DIM > &  box,
std::ostream &  os = tbox::plog,
int  prec = 12 
) const

Print all edge centered data values for specified axis residing in the specified box. If the depth of the data is greater than one, all depths are printed.

Parameters:
axis integer edge data coordinate axis, must satisfy 0 <= axis < DIM
box const reference to box over whioch to print data. Note box is assumed to reside in standard cell-centered index space and will be converted to edge index space.
os reference to output stream.
prec integer precision for printing floating point numbers (i.e., TYPE = float, double, or dcomplex). The default is 12 decimal places for double and complex floating point numbers, and the default is 6 decimal places floats. For other types, this value is ignored.

template<int DIM, class TYPE>
void SAMRAI::pdat::EdgeData< DIM, TYPE >::printAxis ( int  axis,
const hier::Box< DIM > &  box,
int  depth,
std::ostream &  os = tbox::plog,
int  prec = 12 
) const

Print all edge centered data values for specified axis residing in the specified box. If the depth of the data is greater than one, all depths are printed.

Parameters:
axis integer edge data coordinate axis, must satisfy 0 <= axis < DIM
box const reference to box over whioch to print data. Note box is assumed to reside in standard cell-centered index space and will be converted to edge index space.
depth integer depth component, must satisfy 0 <= depth < actual depth of data array
os reference to output stream.
prec integer precision for printing floating point numbers (i.e., TYPE = float, double, or dcomplex). The default is 12 decimal places for double and complex floating point numbers, and the default is 6 decimal places floats. For other types, this value is ignored.

template<int DIM, class TYPE>
void SAMRAI::pdat::EdgeData< DIM, TYPE >::getSpecializedFromDatabase ( tbox::Pointer< tbox::Database database  )  [virtual]

Check that class version and restart file version are equal. If so, read data members from the database.

Assertions: database must be non-null pointer.

Implements SAMRAI::hier::PatchData< DIM >.

template<int DIM, class TYPE>
void SAMRAI::pdat::EdgeData< DIM, TYPE >::putSpecializedToDatabase ( tbox::Pointer< tbox::Database database  )  [virtual]

Write out the class version number and other data members to the database.

Assertions: database must be non-null pointer.

Implements SAMRAI::hier::PatchData< DIM >.


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