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

Class OuternodeData<DIM> provides an implementation for data defined at cell nodes on the boundaries of 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 outernode data object represents data of some template TYPE and depth on the cell nodes on the boundary of the box. Here, depth indicates the number of data values at each node index location. The OuternodnodeGeometry class provides the translation between the standard SAMRAI cell-centered AMR index space and outernode-centered data. More...

#include <source/patchdata/outernode/OuternodeData.h>

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

Inheritance graph
[legend]
List of all members.

Public Member Functions

 OuternodeData (const hier::Box< DIM > &box, int depth, tbox::Pointer< tbox::Arena > pool=tbox::Pointer< tbox::Arena >(NULL))
 Constructor for an outernode data object.
virtual ~OuternodeData ()
 Virtual destructor for a outernode data object.
int getDepth () const
 Return the depth (e.g., the number of components at each spatial location) of the array.
bool dataExists (int face_normal) const
 Returns true if outernode data exists for the given face normal direction; false otherwise.
hier::Box< DIM > getDataBox (int face_normal, int side)
 Return the box of valid node indices for outernode data. Note: the returned box will reside in the node index space.
TYPE * getPointer (int face_normal, int side, int depth=0)
 Get a pointer to the beginning of a particular face normal, side, and depth component of the outernode centered array.
const TYPE * getPointer (int face_normal, int side, int depth=0) const
 Get a const pointer to the beginning of a particular face normal, side, and depth component of the outernode centered array.
TYPE & operator() (const NodeIndex< DIM > &i, int depth=0)
 Return a reference to data entry corresponding to a given node index and depth.
const TYPE & operator() (const NodeIndex< DIM > &i, int depth=0) const
 Return a const reference to data entry corresponding to a given node index and depth.
ArrayData< DIM, TYPE > & getArrayData (int face_normal, int side)
 Return a reference to the array data object for face normal, and side index of the outernode centered array.
const ArrayData< DIM, TYPE > & getArrayData (int face_normal, int side) const
 Return a const reference to the array data object for face normal, and side index of the outernode centered array.
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 copyDepth (int dst_depth, const NodeData< DIM, TYPE > &src, int src_depth)
 Fast copy (i.e., assumes node and outernode data objects are defined over the same box) from the given node source data object to this destination outernode data object at the specified depths.
void copyDepth2 (int dst_depth, NodeData< DIM, TYPE > &dst, int src_depth) const
 Fast copy (i.e., assumes node and outernode data objects are defined over the same box) to the given node destination data object from this source outernode data object at the specified depths.
virtual void sum (const hier::PatchData< DIM > &src, const hier::BoxOverlap< DIM > &overlap)
 Add data from source to destination (i.e., this) patch data object on the given overlap.
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 NodeOverlap 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 NodeOverlap of the same DIM.
virtual void unpackStreamAndSum (tbox::AbstractStream &stream, const hier::BoxOverlap< DIM > &overlap)
 Unpack data from stream and add into this patch data object over the specified box overlap region. The overlap must be an NodeOverlap 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 outernode 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 outernode data values at the given array depth in the specified box.
void printAxisSide (int face_normal, int side, const hier::Box< DIM > &box, std::ostream &os=tbox::plog, int prec=12) const
 Print all outernode centered data values for specified face_normal and side residing in the specified box. If the depth of the data is greater than one, all depths are printed.
void printAxisSide (int face_normal, int side, const hier::Box< DIM > &box, int depth, std::ostream &os=tbox::plog, int prec=12) const
 Print all outernode centered data values for specified face_normal, side, and depth residing in the specified box.
virtual void getSpecializedFromDatabase (tbox::Pointer< tbox::Database > database)
 Check that class version and restart file version are equal. If so, read data members from the database.
virtual void putSpecializedToDatabase (tbox::Pointer< tbox::Database > database)
 Write out the class version number and other data members to the database.

Static Public Member Functions

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

Detailed Description

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

Class OuternodeData<DIM> provides an implementation for data defined at cell nodes on the boundaries of 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 outernode data object represents data of some template TYPE and depth on the cell nodes on the boundary of the box. Here, depth indicates the number of data values at each node index location. The OuternodnodeGeometry class provides the translation between the standard SAMRAI cell-centered AMR index space and outernode-centered data.

Outernode data is stored in 2*DIM arrays, each of which contains data associated with node indices on an upper or lower box face in some corrdinate direction. The data layout in the outernode data arrays matches the corresponding array sections provided by the node data implementation. Where a node index falls on more than one box face (patch boundary edges and corners), the outernode data value belongs to only one data array so that there are no redundant data values. Specifically, when DIM > 1, outernode data boxes are "trimmed" so that each node index that lives on more than one face on the box boundary will be associated with the face of the largest coordinate direction and only that face. 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 location. Memory allocation is in column-major ordering (e.g., Fortran style) so that the leftmost index runs fastest in memory.

To illustrate the outernode data layout, in particular the "box trimming" that prevents redundant data values, we describe the data for a three-dimensional outernode data object instantiated over a box [l0:u0,l1:u1,l2:u2] in the standard SAMRAI cell-centered AMR index space.


      Here face normal directions 0, 1, and 2 can be thought of as X, Y, Z
      respectively, and d is the data depth.

      face normal 0:
          lower    [ l0 : l0     , l1+1 : u1   , l2+1 : u2 , d ]
          upper    [ u0+1 : u0+1 , l1+1 : u1   , l2+1 : u2 , d ]
          Note: Boxes are trimmed at edges intersecting faces with
                normal directions 1 and 2 so that node indices shared 
                with those faces appear in data arrays associated with
                higher dimension faces.
          
      face normal 1:
          lower    [ l0 : u0+1   , l1 : l1     , l2+1 : u2 , d ]
          upper    [ l0 : u0+1   , u1+1 : u1+1 , l2+1 : u2 , d ]
          Note: Boxes are trimmed at edges intersecting faces with
                normal direction 2 so that node indices shared 
                with those faces appear in data arrays associated with
                higher dimension faces.
 
      face normal 2:
          lower    [ l0 : u0+1   , l1 : u1+1   , l2 : l2     , d ]
          upper    [ l0 : u0+1   , l1 : u1+1   , u2+1 : u2+1 , d ]
          Note: Boxes are not trimmed. 
  
 * 
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::OuternodeDataFactory

pdat::OuternodeGeometry

pdat::NodeIterator

pdat::NodeIndex


Constructor & Destructor Documentation

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

Constructor for an outernode data object.

Note: Outernode data always has ghost cell width of zero.

Parameters:
box const Box reference describing the interior of the standard CELL-centered index box over which the outernode data object will be created.
depth gives the number of data values for each spatial location in the array.
pool memory arena. If not given, then the standard arena is used.

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

Virtual destructor for a outernode data object.


Member Function Documentation

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

Calculate the amount of memory needed to represent outernode- 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 outernode data object will be created. Note: the ghost cell width is assumed to be zero.
depth gives the number of data values for each spatial location in the array.

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

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

template<int DIM, class TYPE>
bool SAMRAI::pdat::OuternodeData< DIM, TYPE >::dataExists ( int  face_normal  )  const [inline]

Returns true if outernode data exists for the given face normal direction; false otherwise.

Parameters:
face_normal integer face normal direction for data, must satisfy 0 <= face_normal < DIM

template<int DIM, class TYPE>
hier::Box< DIM > SAMRAI::pdat::OuternodeData< DIM, TYPE >::getDataBox ( int  face_normal,
int  side 
)

Return the box of valid node indices for outernode data. Note: the returned box will reside in the node index space.

Parameters:
face_normal integer face normal direction for data, must satisfy 0 <= face_normal < DIM
side integer lower (0) or upper (1) side of outernode data array

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

Get a pointer to the beginning of a particular face normal, side, and depth component of the outernode centered array.

Parameters:
face_normal integer face normal direction for data, must satisfy 0 <= face_normal < DIM
side integer lower (0) or upper (1) side of outernode data array
depth integer depth component, must satisfy 0 <= depth < actual depth of data array

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

Get a const pointer to the beginning of a particular face normal, side, and depth component of the outernode centered array.

Parameters:
face_normal integer face normal direction for data, must satisfy 0 <= face_normal < DIM
side integer lower (0) or upper (1) side of outernode data array
depth integer depth component, must satisfy 0 <= depth < actual depth of data array

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

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

Parameters:
i const reference to NodeIndex, MUST be an index on the outernode of the box.
depth integer depth component, must satisfy 0 <= depth < actual depth of data array

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

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

Parameters:
i const reference to NodeIndex, MUST be an index on the outernode of the box.
depth integer depth component, must satisfy 0 <= depth < actual depth of data array

template<int DIM, class TYPE>
ArrayData< DIM, TYPE > & SAMRAI::pdat::OuternodeData< DIM, TYPE >::getArrayData ( int  face_normal,
int  side 
) [inline]

Return a reference to the array data object for face normal, and side index of the outernode centered array.

Parameters:
face_normal integer face normal direction for data, must satisfy 0 <= face_normal < DIM
side integer lower (0) or upper (1) side of outeredge data array

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

Return a const reference to the array data object for face normal, and side index of the outernode centered array.

Parameters:
face_normal integer face normal direction for data, must satisfy 0 <= face_normal < DIM
side integer lower (0) or upper (1) side of outeredge data array

template<int DIM, class TYPE>
void SAMRAI::pdat::OuternodeData< 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 either NodeData or OuternodeData 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::OuternodeData< 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 either NodeData or OuternodeData 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::OuternodeData< 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 either NodeData or OuternodeData of the same DIM and TYPE and the overlap must be an NodeOverlap of the same DIM. If not, then an unrecoverable error results.

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

template<int DIM, class TYPE>
void SAMRAI::pdat::OuternodeData< 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 either NodeData or OuternodeData of the same DIM and TYPE and the overlap must be an NodeOverlap of the same DIM. If not, then an unrecoverable error results.

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

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

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

template<int DIM, class TYPE>
void SAMRAI::pdat::OuternodeData< DIM, TYPE >::copyDepth2 ( int  dst_depth,
NodeData< DIM, TYPE > &  dst,
int  src_depth 
) const

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

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

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

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

template<int DIM, class TYPE>
bool SAMRAI::pdat::OuternodeData< 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::OuternodeData< 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::OuternodeData< 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 NodeOverlap of the same DIM.

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

template<int DIM, class TYPE>
void SAMRAI::pdat::OuternodeData< 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 NodeOverlap of the same DIM.

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

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

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

template<int DIM, class TYPE>
void SAMRAI::pdat::OuternodeData< 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::OuternodeData< 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::OuternodeData< DIM, TYPE >::fillAll ( const TYPE &  t  ) 

Fill all depth components with value t.

template<int DIM, class TYPE>
void SAMRAI::pdat::OuternodeData< 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::OuternodeData< DIM, TYPE >::print ( const hier::Box< DIM > &  box,
std::ostream &  os = tbox::plog,
int  prec = 12 
) const

Print all outernode 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 node 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::OuternodeData< DIM, TYPE >::print ( const hier::Box< DIM > &  box,
int  depth,
std::ostream &  os = tbox::plog,
int  prec = 12 
) const

Print all outernode 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 node 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::OuternodeData< DIM, TYPE >::printAxisSide ( int  face_normal,
int  side,
const hier::Box< DIM > &  box,
std::ostream &  os = tbox::plog,
int  prec = 12 
) const

Print all outernode centered data values for specified face_normal and side residing in the specified box. If the depth of the data is greater than one, all depths are printed.

Parameters:
face_normal integer face normal direction for data, must satisfy 0 <= face_normal < DIM
side integer lower (0) or upper (1) side of outernode data array
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 node 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::OuternodeData< DIM, TYPE >::printAxisSide ( int  face_normal,
int  side,
const hier::Box< DIM > &  box,
int  depth,
std::ostream &  os = tbox::plog,
int  prec = 12 
) const

Print all outernode centered data values for specified face_normal, side, and depth residing in the specified box.

Parameters:
face_normal integer face normal direction for data, must satisfy 0 <= face_normal < DIM
side integer lower (0) or upper (1) side of outernode data array
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 node 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::OuternodeData< 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 a non-null pointer.

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

template<int DIM, class TYPE>
void SAMRAI::pdat::OuternodeData< 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 a 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:54 2009 for SAMRAI by  doxygen 1.5.1