IBAMR  IBAMR version 0.19.
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
SAMRAI::pdat::NodeData< DIM, TYPE > Class Template Reference

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

#include <ibtk/PatchMathOps.h>

Inheritance diagram for SAMRAI::pdat::NodeData< DIM, TYPE >:
Inheritance graph
[legend]

Public Types

typedef NodeIterator< DIM > Iterator
 

Public Member Functions

 NodeData (const hier::Box< DIM > &box, int depth, const hier::IntVector< DIM > &ghosts, tbox::Pointer< tbox::Arena > pool=tbox::Pointer< tbox::Arena >(NULL))
 The constructor for a node data object.
More...
 
virtual ~NodeData ()
 The virtual destructor for a node data object. More...
 
int getDepth () const
 Return the depth (e.g., the number of components in each spatial location) of the array. More...
 
TYPE * getPointer (int depth=0)
 Get a pointer to the beginning of a particular depth component of the node centered array. More...
 
const TYPE * getPointer (int depth=0) const
 Get a const pointer to the beginning of a particular depth component of the node centered array. More...
 
TYPE & operator() (const NodeIndex< DIM > &i, int depth=0)
 Return a reference to the data entry corresponding to a given node index and depth. More...
 
const TYPE & operator() (const NodeIndex< DIM > &i, int depth=0) const
 Return a const reference to the data entry corresponding to a given node index and depth. More...
 
ArrayData< DIM, TYPE > & getArrayData ()
 Return a reference to the array data object of the node centered array. More...
 
const ArrayData< DIM, TYPE > & getArrayData () const
 Return a const reference to the array data object of the node centered array. More...
 
virtual void copy (const hier::PatchData< DIM > &src)
 A fast copy from source to destination (i.e., this) patch data object. More...
 
virtual void copy2 (hier::PatchData< DIM > &dst) const
 A fast copy from source (i.e., this) to destination patch data object. More...
 
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. More...
 
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. More...
 
void copyOnBox (const NodeData< 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. More...
 
void copyDepth (int dst_depth, const NodeData< DIM, TYPE > &src, int src_depth)
 Fast copy (i.e., source and this node data objects are defined over the same box) from the given node source data object to this destination node data object at the specified depths. More...
 
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). More...
 
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. More...
 
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 a NodeOverlap of the same DIM. More...
 
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 a NodeOverlap of the same DIM. More...
 
void fill (const TYPE &t, int d=0)
 Fill all values at depth d with the value t. More...
 
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. More...
 
void fillAll (const TYPE &t)
 Fill all depth components with value t. More...
 
void fillAll (const TYPE &t, const hier::Box< DIM > &box)
 Fill all depth components within the box with value t. More...
 
void print (const hier::Box< DIM > &box, std::ostream &os=tbox::plog, int prec=12) const
 Print all node data values residing in the specified box. If the depth of the array is greater than one, all depths are printed. More...
 
void print (const hier::Box< DIM > &box, int depth, std::ostream &os=tbox::plog, int prec=12) const
 Print all node data values at the given array depth in the specified box. More...
 
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. More...
 
virtual void putSpecializedToDatabase (tbox::Pointer< tbox::Database > database)
 Write out the class version number and other data members to the database. More...
 
const Box< DIM > & getBox () const
 
const Box< DIM > & getGhostBox () const
 
const IntVector< DIM > & getGhostCellWidth () const
 
void setTime (const double timestamp)
 
double getTime () const
 
virtual void getFromDatabase (tbox::Pointer< tbox::Database > database)
 
virtual void putToDatabase (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 node- centered data over a CELL-centered AMR index space box. More...
 

Protected Member Functions

void setGhostBox (const Box< DIM > &ghost_box)
 

Private Member Functions

 NodeData (const NodeData< DIM, TYPE > &)
 
void operator= (const NodeData< DIM, TYPE > &)
 

Private Attributes

int d_depth
 
ArrayData< DIM, TYPE > d_data
 
Box< DIM > d_box
 
Box< DIM > d_ghost_box
 
IntVector< DIM > d_ghosts
 
double d_timestamp
 

Detailed Description

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

A node data array is stored in (i,...,k,d) order, where i,...,k indicates spatial indices 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 node data object created over a CELL-centered AMR index space box [l0:u0,l1:u1,l2:u2] allocates a data array dimensioned as

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

* 

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::NodeDataFactory
pdat::NodeIndex
pdat::NodeIterator
pdat::NodeGeometry

Member Typedef Documentation

◆ Iterator

template<int DIM, class TYPE >
typedef NodeIterator<DIM> SAMRAI::pdat::NodeData< DIM, TYPE >::Iterator

The node iterator iterates over the elements of a node centered box geometry. This typedef is a convenience for using the NodeIterator<DIM> class.

Constructor & Destructor Documentation

◆ NodeData() [1/2]

template<int DIM, class TYPE >
SAMRAI::pdat::NodeData< DIM, TYPE >::NodeData ( const hier::Box< DIM > &  box,
int  depth,
const hier::IntVector< DIM > &  ghosts,
tbox::Pointer< tbox::Arena pool = tbox::Pointertbox::Arena >(NULL) 
)
Parameters
boxconst Box reference describing the interior of the standard CELL-centered index box over which the node data object will be created.
depthgives the number of components for each spatial location in the array.
ghostsconst IntVector reference indicating the width of the ghost cell region around the box over which the node data will be allocated.
poolmemory arena. If not given, then the standard arena is used.

◆ ~NodeData()

template<int DIM, class TYPE >
virtual SAMRAI::pdat::NodeData< DIM, TYPE >::~NodeData ( )
virtual

◆ NodeData() [2/2]

template<int DIM, class TYPE >
SAMRAI::pdat::NodeData< DIM, TYPE >::NodeData ( const NodeData< DIM, TYPE > &  )
private

Member Function Documentation

◆ getSizeOfData()

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

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
boxconst Box reference describing the interior of the standard CELL-centered index box over which the node data object will be created.
depthgives the number of components for each spatial location in the array.
ghostsconst IntVector reference indicating the width of the ghost cell region around the box over which the node data will be allocated.

◆ getDepth()

template<int DIM, class TYPE >
int SAMRAI::pdat::NodeData< DIM, TYPE >::getDepth ( ) const

◆ getPointer() [1/2]

template<int DIM, class TYPE >
TYPE* SAMRAI::pdat::NodeData< DIM, TYPE >::getPointer ( int  depth = 0)

◆ getPointer() [2/2]

template<int DIM, class TYPE >
const TYPE* SAMRAI::pdat::NodeData< DIM, TYPE >::getPointer ( int  depth = 0) const

◆ operator()() [1/2]

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

◆ operator()() [2/2]

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

◆ getArrayData() [1/2]

template<int DIM, class TYPE >
ArrayData<DIM,TYPE>& SAMRAI::pdat::NodeData< DIM, TYPE >::getArrayData ( )

◆ getArrayData() [2/2]

template<int DIM, class TYPE >
const ArrayData<DIM,TYPE>& SAMRAI::pdat::NodeData< DIM, TYPE >::getArrayData ( ) const

◆ copy() [1/2]

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

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 a NodeData of the same DIM and TYPE. If not, then an unrecoverable error results.

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

◆ copy2() [1/2]

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

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 a NodeData of the same DIM and TYPE. If not, then an unrecoverable error results.

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

◆ copy() [2/2]

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

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

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

◆ copy2() [2/2]

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

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

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

◆ copyOnBox()

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

◆ copyDepth()

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

◆ canEstimateStreamSizeFromBox()

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

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

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

◆ getDataStreamSize()

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

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

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

◆ packStream()

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

◆ unpackStream()

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

◆ fill() [1/2]

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

◆ fill() [2/2]

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

◆ fillAll() [1/2]

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

◆ fillAll() [2/2]

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

◆ print() [1/2]

template<int DIM, class TYPE >
void SAMRAI::pdat::NodeData< DIM, TYPE >::print ( const hier::Box< DIM > &  box,
std::ostream &  os = tbox::plog,
int  prec = 12 
) const
Parameters
boxconst 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.
osreference to output stream.
precinteger 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.

◆ print() [2/2]

template<int DIM, class TYPE >
void SAMRAI::pdat::NodeData< DIM, TYPE >::print ( const hier::Box< DIM > &  box,
int  depth,
std::ostream &  os = tbox::plog,
int  prec = 12 
) const
Parameters
boxconst 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.
depthinteger depth component, must satisfy 0 <= depth < actual depth of data array
osreference to output stream.
precinteger 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.

◆ getSpecializedFromDatabase()

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

Assertions: database must be non-null pointer.

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

◆ putSpecializedToDatabase()

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

Assertions: database must be non-null pointer.

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

◆ operator=()

template<int DIM, class TYPE >
void SAMRAI::pdat::NodeData< DIM, TYPE >::operator= ( const NodeData< DIM, TYPE > &  )
private

◆ getBox()

template<int DIM>
const Box<DIM>& SAMRAI::hier::PatchData< DIM >::getBox ( ) const
inherited

Return the box over which this patch data object is defined. All objects in the same patch are defined over the same box, although the patch data objects may interpret how to allocate storage for that box in different ways.

◆ getGhostBox()

template<int DIM>
const Box<DIM>& SAMRAI::hier::PatchData< DIM >::getGhostBox ( ) const
inherited

Return the ghost cell box. The ghost cell box is defined to be the interior box grown by the ghost cell width.

◆ getGhostCellWidth()

template<int DIM>
const IntVector<DIM>& SAMRAI::hier::PatchData< DIM >::getGhostCellWidth ( ) const
inherited

Get the ghost cell width associated with this patch data object.

◆ setTime()

template<int DIM>
void SAMRAI::hier::PatchData< DIM >::setTime ( const double  timestamp)
inherited

Set the simulation time stamp for the patch data type. The simulation time is initialized to zero when the patch data type is created.

◆ getTime()

template<int DIM>
double SAMRAI::hier::PatchData< DIM >::getTime ( ) const
inherited

Get the simulation time stamp for the patch data type.

◆ getFromDatabase()

template<int DIM>
virtual void SAMRAI::hier::PatchData< DIM >::getFromDatabase ( tbox::Pointer< tbox::Database database)
virtualinherited

Checks that class version and restart file version are equal. If so, reads in the data members common to all patch data types from database. This method then calls the getSpecializedFromDatabase() method to retrieve the data special to the concrete patch data type.

◆ putToDatabase()

template<int DIM>
virtual void SAMRAI::hier::PatchData< DIM >::putToDatabase ( tbox::Pointer< tbox::Database database)
virtualinherited

Writes out the class version number to the database. Then, writes the data members common to all patch data types from database. After the common data is written to the database, the putSpecializedToDatabase() method is invoked.

◆ setGhostBox()

template<int DIM>
void SAMRAI::hier::PatchData< DIM >::setGhostBox ( const Box< DIM > &  ghost_box)
protectedinherited

This protected method is used by concrete patch data subclasses to set the ghost box over which the patch data will be allocated. Note that this allows the ghost box to be inconsistant with its standard interpretation as the patch domain box grown by the ghost cell width (as set in the constructor).

This function is included to treat some special cases for concrete patch data types and should be used with caution.

Member Data Documentation

◆ d_depth

template<int DIM, class TYPE >
int SAMRAI::pdat::NodeData< DIM, TYPE >::d_depth
private

◆ d_data

template<int DIM, class TYPE >
ArrayData<DIM,TYPE> SAMRAI::pdat::NodeData< DIM, TYPE >::d_data
private

◆ d_box

template<int DIM>
Box<DIM> SAMRAI::hier::PatchData< DIM >::d_box
privateinherited

◆ d_ghost_box

template<int DIM>
Box<DIM> SAMRAI::hier::PatchData< DIM >::d_ghost_box
privateinherited

◆ d_ghosts

template<int DIM>
IntVector<DIM> SAMRAI::hier::PatchData< DIM >::d_ghosts
privateinherited

◆ d_timestamp

template<int DIM>
double SAMRAI::hier::PatchData< DIM >::d_timestamp
privateinherited

The documentation for this class was generated from the following file: