Proto  3.2
Public Member Functions | Private Attributes | List of all members
Proto::AMRData< T, C, MEM, CTR > Class Template Reference

AMR Data Hierarchy. More...

#include <Proto_AMRData.H>

Public Member Functions

 AMRData ()
 Trivial Constructor. More...
 
 AMRData (AMRGrid &a_grid, Point a_ghost)
 Grid Constructor. More...
 
 AMRData (std::vector< std::shared_ptr< LevelBoxData< T, C, MEM, CTR >>> a_data)
 Alias Constructor. More...
 
void define (AMRGrid &a_grid, Point a_ghost)
 Define. More...
 
void define (std::vector< std::shared_ptr< LevelBoxData< T, C, MEM, CTR >>> a_data)
 Alias Define. More...
 
void regrid (AMRGrid &a_newgrid, int a_lbase, int a_order)
 Reinitialize grids and data due to regridding. More...
 
const AMRGridgrid () const
 Grid Access (Const) More...
 
AMRGridgrid ()
 Grid Access (Non-Const) More...
 
const LevelBoxData< T, C, MEM, CTR > & operator[] (unsigned int a_level) const
 Level Data Access (Const) More...
 
LevelBoxData< T, C, MEM, CTR > & operator[] (unsigned int a_level)
 Level Data Access (Non-Const) More...
 
void setToZero ()
 Zero Initialize. More...
 
template<typename Func , typename... Srcs>
void initialize (T a_dx0, Func &a_func, Srcs... a_srcs)
 Function Initialization. More...
 
template<typename Func , typename... Srcs>
void initialize (const Array< T, DIM > a_dx0, Func &a_func, Srcs... a_srcs)
 
void averageDown ()
 Function Initialization (With Convolution) More...
 
void increment (AMRData< T, C, MEM, CTR > &a_data, T a_scale=1.0)
 Average Down Single Level. More...
 
void operator*= (T a_value)
 Multiply by a Constant. More...
 
void operator+= (T a_value)
 Increment by a Constant. More...
 
integrate (T a_cdx, unsigned int a_c=0)
 Compute Integral. More...
 
integrate (const Array< T, DIM > &a_cdx, unsigned int a_c=0)
 
integrateAbs (T a_cdx, unsigned int a_c=0)
 Compute Integral of Absolute Value. More...
 
integrateAbs (const Array< T, DIM > &a_cdx, unsigned int a_c=0)
 
absMax (unsigned int a_c=0)
 Compute Max Norm. More...
 
void exchange ()
 Exchange. More...
 
void copyTo (AMRData< T, C, MEM, CTR > &a_rhs)
 Copy To. More...
 
int numLevels () const
 Get Number of Levels. More...
 
int maxLevels () const
 Get Max Levels. More...
 

Private Attributes

bool m_defined
 
AMRGrid m_grid
 
Point m_ghost
 
int m_counter = 0
 
std::vector< std::shared_ptr< LevelBoxData< T, C, MEM, CTR > > > m_data
 

Detailed Description

template<typename T, unsigned int C = 1, MemType MEM = MEMTYPE_DEFAULT, Centering CTR = PR_CELL>
class Proto::AMRData< T, C, MEM, CTR >

AMR Data Hierarchy.

A nested hierarchy of data defined on an AMRGrid. Each level is stored as a LevelBoxData<T, C, MEM, CTR>.

Template Parameters
TType of data in array (int, double, etc.)
CNumber of components
MEMProto::MemType. HOST or DEVICE.
CTRCentering of underlying LevelBoxData

Constructor & Destructor Documentation

◆ AMRData() [1/3]

template<typename T, unsigned int C = 1, MemType MEM = MEMTYPE_DEFAULT, Centering CTR = PR_CELL>
Proto::AMRData< T, C, MEM, CTR >::AMRData ( )
inline

◆ AMRData() [2/3]

template<typename T, unsigned int C = 1, MemType MEM = MEMTYPE_DEFAULT, Centering CTR = PR_CELL>
Proto::AMRData< T, C, MEM, CTR >::AMRData ( AMRGrid a_grid,
Point  a_ghost 
)
inline

Grid Constructor.

Creates data holders for each layout level in the input grid with specified ghost data space.

Parameters
gridAn AMR Grid. Data is allocated only for existing levels
ghostSpecifies the number of ghost cells to allocate

References Proto::AMRData< T, C, MEM, CTR >::AMRData(), and Proto::AMRData< T, C, MEM, CTR >::define().

◆ AMRData() [3/3]

template<typename T , unsigned int C, MemType MEM, Centering CTR>
Proto::AMRData< T, C, MEM, CTR >::AMRData ( std::vector< std::shared_ptr< LevelBoxData< T, C, MEM, CTR >>>  a_data)

Alias Constructor.

Member Function Documentation

◆ define() [1/2]

template<typename T , unsigned int C, MemType MEM, Centering CTR>
void Proto::AMRData< T, C, MEM, CTR >::define ( AMRGrid a_grid,
Point  a_ghost 
)
inline

Define.

Lazy construction. If *this is not yet defined, data holders are created based on the inputs. TODO: If *this was previously defined, redefine it based on the new grid TODO: Determine how exiting data should be moved / reinitialized

Referenced by Proto::AMRData< T, C, MEM, CTR >::AMRData().

◆ define() [2/2]

template<typename T , unsigned int C, MemType MEM, Centering CTR>
void Proto::AMRData< T, C, MEM, CTR >::define ( std::vector< std::shared_ptr< LevelBoxData< T, C, MEM, CTR >>>  a_data)
inline

Alias Define.

◆ regrid()

template<typename T , unsigned int C, MemType MEM, Centering CTR>
void Proto::AMRData< T, C, MEM, CTR >::regrid ( AMRGrid a_newgrid,
int  a_lbase,
int  a_order 
)
inline

Reinitialize grids and data due to regridding.

For all levels starting at level a_lbase + 1, initialize new data holders. (1) Define new DisjointBoxLayout, LevelBoxData. (2) Interpolate / initialize from next coarser level. (3) Copy on intersection from ald data at this level.

◆ grid() [1/2]

template<typename T, unsigned int C = 1, MemType MEM = MEMTYPE_DEFAULT, Centering CTR = PR_CELL>
const AMRGrid& Proto::AMRData< T, C, MEM, CTR >::grid ( ) const
inline

Grid Access (Const)

References Proto::AMRData< T, C, MEM, CTR >::m_grid.

◆ grid() [2/2]

template<typename T, unsigned int C = 1, MemType MEM = MEMTYPE_DEFAULT, Centering CTR = PR_CELL>
AMRGrid& Proto::AMRData< T, C, MEM, CTR >::grid ( )
inline

◆ operator[]() [1/2]

template<typename T , unsigned int C, MemType MEM, Centering CTR>
const LevelBoxData< T, C, MEM, CTR > & Proto::AMRData< T, C, MEM, CTR >::operator[] ( unsigned int  a_level) const
inline

Level Data Access (Const)

Referenced by Proto::AMRData< T, C, MEM, CTR >::grid().

◆ operator[]() [2/2]

template<typename T , unsigned int C, MemType MEM, Centering CTR>
LevelBoxData< T, C, MEM, CTR > & Proto::AMRData< T, C, MEM, CTR >::operator[] ( unsigned int  a_level)
inline

Level Data Access (Non-Const)

◆ setToZero()

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

Zero Initialize.

Referenced by Proto::AMRData< T, C, MEM, CTR >::grid().

◆ initialize() [1/2]

template<typename T , unsigned int C, MemType MEM, Centering CTR>
template<typename Func , typename... Srcs>
void Proto::AMRData< T, C, MEM, CTR >::initialize ( a_dx0,
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. The input function must have the signature:

void a_func(Point& a_point, Var<T, C, MEM>& a_thisData, Array<T, DIM> a_dx, ... )

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). Unlike LevelBoxData::initialize(...), valid input functions must also include a double argument representing the grid spacing, even if it is not used by the function itself. Elements of a_srcs should be plain-old-data such as single values, Points, or Boxes.

Parameters
dx0Isotropic grid spacing on the coarsest level
funcInitialization function
srcsVariadic arguments after the grid spacing in func

Referenced by Proto::AMRData< T, C, MEM, CTR >::grid().

◆ initialize() [2/2]

template<typename T , unsigned int C, MemType MEM, Centering CTR>
template<typename Func , typename... Srcs>
void Proto::AMRData< T, C, MEM, CTR >::initialize ( const Array< T, DIM >  a_dx0,
Func &  a_func,
Srcs...  a_srcs 
)
inline

◆ averageDown()

template<typename T , unsigned int C, MemType MEM, Centering CTR>
void Proto::AMRData< T, C, MEM, CTR >::averageDown ( )
inline

Function Initialization (With Convolution)

Initialize *this as in initialize and then convolve the result using a 4th-order convolution stencil to yield a cell-averaged field useful for finite volume operations. TODO: Do the correct thing here if CTR != PR_CELL

Parameters
dx0Isotropic grid spacing on the coarsest level
funcInitialization function
srcsVariadic arguments after the grid spacing in funcAverage Down All Levels Synchronizes data between levels by recursively replacing coarse level data with the geometric average of overlying fine data where it exists.

TODO: Do the correct thing here if CTR != PR_CELL TODO: Remove this from the AMRData API and make standalone(?)

Referenced by Proto::AMRData< T, C, MEM, CTR >::grid().

◆ increment()

template<typename T , unsigned int C, MemType MEM, Centering CTR>
void Proto::AMRData< T, C, MEM, CTR >::increment ( AMRData< T, C, MEM, CTR > &  a_data,
a_scale = 1.0 
)
inline

Average Down Single Level.

Replace the data on a specified level with the geometric average of the overlying fine data should any exist. If the specified level is the finest in the hierarchy, this function is a null-op. There are more than one level finer than the specified level, the average down is NOT computed recursively as in averageDown(). TODO: Do the correct thing here if CTR != PR_CELL TODO: Remove this from the AMRData API and make standalone(?)

Parameters
crseLevelThe level onto which finer level data will be averaged. Interpolate Fine Boundaries Populate coarse-fine boundary ghost cells with data interpolated from the next coarser level for all levels > 0.

TODO: figure out how this should be defined for CTR != 0 (if at all) TODO: Remove this from the AMRData API and make standalone

Parameters
a_orderOrder of interpolation. Valid values: 3, 5 (default 5)Interpolate Fine Boundaries Populate coarse-fine boundary ghost cells with data interpolated from the next coarser level for the specified fine level ( > 0 )

TODO: figure out how this should be defined for CTR != 0 (if at all) TODO: Remove this from the AMRData API and make standalone

Parameters
a_orderOrder of interpolation. Valid values: 3, 5 (default 5)Increment Add a scaled multiple of another AMRData to this. This function will fail if the two AMRData do not share an AMRGrid configuration. TODO: Implement += and -= operators for completeness
dataAnother AMRData with the same AMRGrid configuration as *this
scaleOptional scaling for the right-hand side data

◆ operator*=()

template<typename T , unsigned int C, MemType MEM, Centering CTR>
void Proto::AMRData< T, C, MEM, CTR >::operator*= ( a_value)
inline

Multiply by a Constant.

◆ operator+=()

template<typename T , unsigned int C, MemType MEM, Centering CTR>
void Proto::AMRData< T, C, MEM, CTR >::operator+= ( a_value)
inline

Increment by a Constant.

◆ integrate() [1/2]

template<typename T , unsigned int C, MemType MEM, Centering CTR>
T Proto::AMRData< T, C, MEM, CTR >::integrate ( a_cdx,
unsigned int  a_c = 0 
)
inline

Compute Integral.

Compute the discrete integral over all valid data. TODO: Right now this is just the integral over level 0. This is the correct thing to do so long as averageDown has been called prior.

Parameters
cdxCoarsest grid spacing (Level 0)

◆ integrate() [2/2]

template<typename T , unsigned int C, MemType MEM, Centering CTR>
T Proto::AMRData< T, C, MEM, CTR >::integrate ( const Array< T, DIM > &  a_cdx,
unsigned int  a_c = 0 
)
inline

◆ integrateAbs() [1/2]

template<typename T , unsigned int C, MemType MEM, Centering CTR>
T Proto::AMRData< T, C, MEM, CTR >::integrateAbs ( a_cdx,
unsigned int  a_c = 0 
)
inline

Compute Integral of Absolute Value.

Compute the discrete integral over all valid data. TODO: Right now this is just the integral over level 0. This is the correct thing to do so long as averageDown has been called prior.

Parameters
cdxCoarsest grid spacing (Level 0)

◆ integrateAbs() [2/2]

template<typename T , unsigned int C, MemType MEM, Centering CTR>
T Proto::AMRData< T, C, MEM, CTR >::integrateAbs ( const Array< T, DIM > &  a_cdx,
unsigned int  a_c = 0 
)
inline

◆ absMax()

template<typename T , unsigned int C, MemType MEM, Centering CTR>
T Proto::AMRData< T, C, MEM, CTR >::absMax ( unsigned int  a_c = 0)
inline

Compute Max Norm.

Compute the max norm of a specified component.

Parameters
cA component in [0, C)

◆ exchange()

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

Exchange.

Exchanges ghost cell data on all levels.

◆ copyTo()

template<typename T , unsigned int C, MemType MEM, Centering CTR>
void Proto::AMRData< T, C, MEM, CTR >::copyTo ( AMRData< T, C, MEM, CTR > &  a_rhs)
inline

Copy To.

Copies data from this into a_rhs on all levels shared by the two AMRData objects.

Parameters
a_rhsAnother AMRData.

◆ numLevels()

template<typename T, unsigned int C = 1, MemType MEM = MEMTYPE_DEFAULT, Centering CTR = PR_CELL>
int Proto::AMRData< T, C, MEM, CTR >::numLevels ( ) const
inline

Get Number of Levels.

Returns the number of levels in *this with a defined LevelBoxData. This value will in general be different from the maximum number of levels. TODO: if numLevels() and grid().numLevels() are different, this is probably a bug. -CLG

References Proto::AMRData< T, C, MEM, CTR >::m_data.

◆ maxLevels()

template<typename T, unsigned int C = 1, MemType MEM = MEMTYPE_DEFAULT, Centering CTR = PR_CELL>
int Proto::AMRData< T, C, MEM, CTR >::maxLevels ( ) const
inline

Member Data Documentation

◆ m_defined

template<typename T, unsigned int C = 1, MemType MEM = MEMTYPE_DEFAULT, Centering CTR = PR_CELL>
bool Proto::AMRData< T, C, MEM, CTR >::m_defined
private

◆ m_grid

template<typename T, unsigned int C = 1, MemType MEM = MEMTYPE_DEFAULT, Centering CTR = PR_CELL>
AMRGrid Proto::AMRData< T, C, MEM, CTR >::m_grid
private

◆ m_ghost

template<typename T, unsigned int C = 1, MemType MEM = MEMTYPE_DEFAULT, Centering CTR = PR_CELL>
Point Proto::AMRData< T, C, MEM, CTR >::m_ghost
private

◆ m_counter

template<typename T, unsigned int C = 1, MemType MEM = MEMTYPE_DEFAULT, Centering CTR = PR_CELL>
int Proto::AMRData< T, C, MEM, CTR >::m_counter = 0
private

◆ m_data

template<typename T, unsigned int C = 1, MemType MEM = MEMTYPE_DEFAULT, Centering CTR = PR_CELL>
std::vector<std::shared_ptr<LevelBoxData<T, C, MEM, CTR> > > Proto::AMRData< T, C, MEM, CTR >::m_data
private

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