Proto
Public Member Functions | Data Fields
Proto::LevelBoxData< T, C, MEM, CTR > Class Template Reference

Level Box Data. More...

#include <Proto_LevelBoxData.H>

Public Member Functions

 LevelBoxData ()
 Default constructor. More...
 
 LevelBoxData (const DisjointBoxLayout &a_dbl, const Point &a_ghost)
 Layout Constructor. More...
 
void define (const DisjointBoxLayout &a_dbl, const Point &a_ghost)
 Define. More...
 
unsigned int size () const
 Size. More...
 
void setToZero ()
 Initialize To Zero. More...
 
template<typename Func , typename... Srcs>
void initialize (Func &a_func, Srcs... a_srcs)
 Function Initialization. More...
 
void exchange ()
 Exchange. More...
 
void copyTo (LevelBoxData &a_dest) const
 Copy To. More...
 
unsigned int offset (int a_proc) const
 Linear Offset. More...
 
unsigned int patchSize () const
 Patch Size. More...
 
void linearIn (void *a_buffer, const Box &a_box, const DataIndex &a_index)
 Linear In (Patch, Box) More...
 
void linearOut (void *a_buffer, const Box &a_box, const DataIndex &a_index) const
 Linear Out (Patch, Box) More...
 
size_t linearSize (const Box &a_box, const DataIndex &a_index) const
 Serial Size (Patch, Box) More...
 
void linearIn (void *a_buffer, const DataIndex &a_index)
 Linear In (Patch) More...
 
void linearOut (void *a_buffer, const DataIndex &a_index) const
 Linear Out (Patch) More...
 
size_t linearSize (const DataIndex &a_index) const
 Size (Patch) More...
 
void linearIn (void *a_buffer)
 Linear In (All Local Data) More...
 
void linearOut (void *a_buffer) const
 Linear Out (All Local Data) More...
 
size_t linearSize () const
 Size (All Local Data) More...
 
DisjointBoxLayout layout () const
 Get Box Layout.
 
DisjointBoxLayout getDBL () const
 Get Box Layout (Overload)
 
Point ghost () const
 Get Ghost Size.
 
Point getGhostVector () const
 Get Ghost Size (Overload)
 
BoxData< T, C, MEM > & operator[] (const DataIndex &a_index)
 Get Patch.
 
const BoxData< T, C, MEM > & operator[] (const DataIndex &a_index) const
 Get Const Patch.
 
DataIterator begin () const
 Get Iterator.
 

Data Fields

int s_verbosity = 0
 For debugging purposes.
 

Detailed Description

template<typename T, unsigned int C = 1, MemType MEM = MemType::HOST, unsigned int CTR = DIM>
class Proto::LevelBoxData< T, C, MEM, CTR >

Level Box Data.

A distributed data holder implementing the abstraction of a union of logically rectangular patches.

Constructor & Destructor Documentation

◆ LevelBoxData() [1/2]

template<typename T , unsigned int C, MemType MEM, unsigned int CTR>
Proto::LevelBoxData< T, C, MEM, CTR >::LevelBoxData ( )
inline

Default constructor.

Constructs an undefined LevelBoxData. Can be initialized through define(...)

◆ LevelBoxData() [2/2]

template<typename T , unsigned int C, MemType MEM, unsigned int CTR>
Proto::LevelBoxData< T, C, MEM, CTR >::LevelBoxData ( const DisjointBoxLayout a_dbl,
const Point a_ghost 
)
inline

Layout Constructor.

Constructs a non-trivial LevelBoxData by calling define.

Member Function Documentation

◆ copyTo()

template<typename T , unsigned int C, MemType MEM, unsigned int CTR>
void Proto::LevelBoxData< T, C, MEM, CTR >::copyTo ( LevelBoxData< T, C, MEM, CTR > &  a_dest) const
inline

Copy To.

Copies data from the valid regions of this into the valid regions of another LevelBoxData. This function only operates on VALID data. To fill ghost regions, use exchange().

◆ define()

template<typename T , unsigned int C, MemType MEM, unsigned int CTR>
void Proto::LevelBoxData< T, C, MEM, CTR >::define ( const DisjointBoxLayout a_dbl,
const Point a_ghost 
)
inline

Define.

Lazily constructs a non-trivial LevelBoxData

◆ exchange()

template<typename T , unsigned int C, MemType MEM, unsigned int CTR>
void Proto::LevelBoxData< T, C, MEM, CTR >::exchange ( )
inline

Exchange.

Copies data from the valid regions of *this into ghost regions. When MPI is enabled, this function also takes care of any necessary communication between patches on different processes.

◆ initialize()

template<typename T , unsigned int C, MemType MEM, unsigned int CTR>
template<typename Func , typename... Srcs>
void Proto::LevelBoxData< T, C, MEM, CTR >::initialize ( Func &  a_func,
Srcs...  a_srcs 
)
inline

Function Initialization.

Initializes *this using a function with a signature similar to that used by Proto::forallInPlace_p. This function is purely for convenience.

Func signature: void a_func(Point& a_point, Var<T, C, MEM>& a_thisData, ... )

Unlike Proto::forall and its variants, this function cannot manage additional data holders (e.g. Srcs should not include a LevelBoxData or similar complex object). Elements of a_srcs should be plain-old-data such as single values, Points, or Boxes.

◆ linearIn() [1/3]

template<typename T , unsigned int C, MemType MEM, unsigned int CTR>
void Proto::LevelBoxData< T, C, MEM, CTR >::linearIn ( void *  a_buffer,
const Box a_box,
const DataIndex a_index 
)
inline

Linear In (Patch, Box)

Reads data from a serial buffer, populating the patch associated with a_index within the subset specified by a_box.

Parameters
a_bufferThe read buffer
a_boxA box defining the subset to read into
a_indexThe index defining the patch to read into

◆ linearIn() [2/3]

template<typename T , unsigned int C, MemType MEM, unsigned int CTR>
void Proto::LevelBoxData< T, C, MEM, CTR >::linearIn ( void *  a_buffer,
const DataIndex a_index 
)
inline

Linear In (Patch)

Overload of LinearIn that always reads in a full patch

◆ linearIn() [3/3]

template<typename T , unsigned int C, MemType MEM, unsigned int CTR>
void Proto::LevelBoxData< T, C, MEM, CTR >::linearIn ( void *  a_buffer)
inline

Linear In (All Local Data)

Overload of LinearIn that reads all local data

◆ linearOut() [1/3]

template<typename T , unsigned int C, MemType MEM, unsigned int CTR>
void Proto::LevelBoxData< T, C, MEM, CTR >::linearOut ( void *  a_buffer,
const Box a_box,
const DataIndex a_index 
) const
inline

Linear Out (Patch, Box)

Writes data to a serial buffer, from the patch associated with a_index within the subset specified by a_box.

Parameters
a_bufferThe write buffer
a_boxA box defining the subset to write from
a_indexThe index defining the patch to write from

◆ linearOut() [2/3]

template<typename T , unsigned int C, MemType MEM, unsigned int CTR>
void Proto::LevelBoxData< T, C, MEM, CTR >::linearOut ( void *  a_buffer,
const DataIndex a_index 
) const
inline

Linear Out (Patch)

Overload of LinearOut that always writes out a full patch

◆ linearOut() [3/3]

template<typename T , unsigned int C, MemType MEM, unsigned int CTR>
void Proto::LevelBoxData< T, C, MEM, CTR >::linearOut ( void *  a_buffer) const
inline

Linear Out (All Local Data)

Overload of LinearOut that writes out all local data

◆ linearSize() [1/3]

template<typename T , unsigned int C, MemType MEM, unsigned int CTR>
size_t Proto::LevelBoxData< T, C, MEM, CTR >::linearSize ( const Box a_box,
const DataIndex a_index 
) const
inline

Serial Size (Patch, Box)

Computes the size in bytes of the serial data buffer needed to hold the patch associated with a_index within the subset specified by a_box.

Parameters
a_boxA box defining the subset of a patch
a_indexThe index defining the patch

◆ linearSize() [2/3]

template<typename T , unsigned int C, MemType MEM, unsigned int CTR>
size_t Proto::LevelBoxData< T, C, MEM, CTR >::linearSize ( const DataIndex a_index) const
inline

Size (Patch)

Overload of Size that always computes the size of a full patch

◆ linearSize() [3/3]

template<typename T , unsigned int C, MemType MEM, unsigned int CTR>
size_t Proto::LevelBoxData< T, C, MEM, CTR >::linearSize ( ) const
inline

Size (All Local Data)

Overload of Size that computes the full local size of the data in *this

◆ offset()

template<typename T , unsigned int C, MemType MEM, unsigned int CTR>
unsigned int Proto::LevelBoxData< T, C, MEM, CTR >::offset ( int  a_proc) const
inline

Linear Offset.

Returns the serial index of the first data element of this stored on this a_proc.

◆ patchSize()

template<typename T , unsigned int C, MemType MEM, unsigned int CTR>
unsigned int Proto::LevelBoxData< T, C, MEM, CTR >::patchSize ( ) const
inline

Patch Size.

Computes the size (in data cells) of a single patch in *this. The resulting patch ACCOUNTS FOR GHOST CELLS

◆ setToZero()

template<typename T , unsigned int C, MemType MEM, unsigned int CTR>
void Proto::LevelBoxData< T, C, MEM, CTR >::setToZero ( )
inline

Initialize To Zero.

Sets all values in all patches equal to zero. This function is mostly for debugging purposes and should be used sparingly if at all in production code.

◆ size()

template<typename T , unsigned int C, MemType MEM, unsigned int CTR>
unsigned int Proto::LevelBoxData< T, C, MEM, CTR >::size ( ) const
inline

Size.

Returns the number of boxes in the union across all processes.


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