#include <BoxLayoutData.H>
A collection of Box-oriented objects. The arrangement of Boxes is given by the underlying BoxLayout object. BoxLayoutData attempt to prevent users from manipulating the template class T to become out of sync with the boxes in the BoxLayout. Caveat emptor.
All access to the data in a BoxLayoutData is forced to be data-parallel, by use of the DataIterator.
class T must provide the following methods:
T()
T(const Box& box, int comps)
define(const Box& box, int comps)
void copy(const Box& Rfrom, const Interval& Cd, const Box& Rto, const T& source, const Interval Cs) Cs and Cd must have same length, but can be displaced; Rfrom and Rto must be the same size, but can be translated.
static int preAllocatable() returns 0 if the size(...) function is strictly a function of Box and Interval, and does not depend on the current state of the T object. return 1 if size(..) is symmetric, in that sender and receiver T object can size their message buffers, but a static object cannot. returns 2 if the object is truly dynamic. the message size is subject to unique object data.
int size(const Box& R, const Interval& comps)
void linearOut(void* buf, const Box& R, const Interval& comps) writes the T object into the byte stream buf, already allocated.
void linearIn(void* buf, const Box& R, const Interval& comps) reads in the T object from the byte stream buf.
In sequential codes, many of these functions will not be called, but in the general parallel case, they all will be.
Public Member Functions | |
BoxLayoutData () | |
virtual | ~BoxLayoutData () |
BoxLayoutData (const BoxLayout &boxes, int comps, const DataFactory< T > &factory=DefaultDataFactory< T >()) | |
virtual void | define (const BoxLayout &boxes, int comps, const DataFactory< T > &factory=DefaultDataFactory< T >()) |
virtual void | define (const BoxLayoutData< T > &da, const DataFactory< T > &factory=DefaultDataFactory< T >()) |
virtual void | define (const BoxLayoutData< T > &da, const Interval &comps, const DataFactory< T > &factory=DefaultDataFactory< T >()) |
virtual void | define (const BoxLayout &boxes) |
overridden and throws an error. | |
virtual bool | threadSafe () const |
int | nComp () const |
Interval | interval () const |
void | generalCopyTo (const BoxLayout &a_destGrids, LayoutData< Vector< RefCountedPtr< T > > > &a_dest, const Interval &a_interval, const ProblemDomain &a_domain, const DataFactory< T > &factory=DefaultDataFactory< T >()) const |
General data copying operation. | |
void | generalCopyTo (const BoxLayout &a_destGrids, LayoutData< Vector< RefCountedPtr< T > > > &a_dest, const Interval &a_interval, const ProblemDomain &a_domain, const Copier &a_copier, const DataFactory< T > &factory=DefaultDataFactory< T >()) const |
void | addTo (const Interval &a_srcComps, BoxLayoutData< T > &a_dest, const Interval &a_destComps, const ProblemDomain &a_domain) const |
void | addTo (const Interval &a_srcComps, BoxLayoutData< T > &a_dest, const Interval &a_destComps, const ProblemDomain &a_domain, const Copier &a_copier) const |
virtual void | apply (void(*a_Function)(const Box &box, int comps, T &t)) |
virtual bool | isDefined () const |
virtual void | clear () |
Static Public Attributes | |
static int | s_verbosity = 0 |
Protected Member Functions | |
void | setVector (const BoxLayoutData< T > &da, const Interval &srcComps, const Interval &destComps) |
void | allocateGhostVector (const DataFactory< T > &factory, const IntVect &ghost=IntVect::Zero) |
void | makeItSo (const Interval &a_srcComps, const BoxLayoutData< T > &a_src, BoxLayoutData< T > &a_dest, const Interval &a_destComps, const Copier &a_copier, const LDOperator< T > &a_op=LDOperator< T >()) const |
void | makeItSoBegin (const Interval &a_srcComps, const BoxLayoutData< T > &a_src, BoxLayoutData< T > &a_dest, const Interval &a_destComps, const Copier &a_copier, const LDOperator< T > &a_op=LDOperator< T >()) const |
void | makeItSoLocalCopy (const Interval &a_srcComps, const BoxLayoutData< T > &a_src, BoxLayoutData< T > &a_dest, const Interval &a_destComps, const Copier &a_copier, const LDOperator< T > &a_op=LDOperator< T >()) const |
void | makeItSoEnd (BoxLayoutData< T > &a_dest, const Interval &a_destComps, const LDOperator< T > &a_op=LDOperator< T >()) const |
void | completePendingSends () const |
void | allocateBuffers (const BoxLayoutData< T > &a_src, const Interval &a_srcComps, const BoxLayoutData< T > &a_dest, const Interval &a_destComps, const Copier &a_copier, const LDOperator< T > &a_op) const |
void | writeSendDataFromMeIntoBuffers (const BoxLayoutData< T > &a_src, const Interval &a_srcComps, const LDOperator< T > &a_op) const |
void | postSendsFromMe () const |
void | postReceivesToMe () const |
void | unpackReceivesToMe (BoxLayoutData< T > &a_dest, const Interval &a_destComps, const LDOperator< T > &a_op) const |
void | unpackReceivesToMe_append (LayoutData< Vector< RefCountedPtr< T > > > &a_dest, const Interval &a_destComps, int ncomp, const DataFactory< T > &factory, const LDOperator< T > &a_op) const |
Protected Attributes | |
int | m_comps |
bool | m_threadSafe |
bool | m_isdefined |
Parallel messaging members | |
CopierBuffer * | m_buff |
Friends | |
class | LevelData< T > |
BoxLayoutData< T >::BoxLayoutData | ( | ) | [inline] |
References BoxLayoutData< T >::m_isdefined.
BoxLayoutData< T >::~BoxLayoutData | ( | ) | [inline, virtual] |
References CH_TIME, and BoxLayoutData< T >::completePendingSends().
BoxLayoutData< T >::BoxLayoutData | ( | const BoxLayout & | boxes, | |
int | comps, | |||
const DataFactory< T > & | factory = DefaultDataFactory<T>() | |||
) | [inline] |
void BoxLayoutData< T >::define | ( | const BoxLayout & | boxes, | |
int | comps, | |||
const DataFactory< T > & | factory = DefaultDataFactory<T>() | |||
) | [inline, virtual] |
Reimplemented in LevelData< T >, LevelData< EBGraph >, LevelData< NodeFArrayBox >, LevelData< CodimBox< FArrayBox > >, LevelData< BaseFab< IntVect > >, LevelData< FluxBox >, LevelData< BaseIVFAB< double > >, LevelData< BaseIFFAB< double > >, LevelData< BaseFab< PetscInt > >, LevelData< EBCellFAB >, LevelData< EdgeDataBox >, LevelData< BaseFab< bool > >, LevelData< FArrayBox >, LevelData< EBData >, LevelData< EBFluxFAB >, and LevelData< BaseFab< int > >.
References BoxLayoutData< T >::allocateGhostVector(), CH_assert, BoxLayout::isClosed(), LayoutData< T >::m_boxLayout, BoxLayoutData< T >::m_comps, BoxLayoutData< T >::m_isdefined, BoxLayoutData< T >::m_threadSafe, and DataFactory< T >::threadSafe().
Referenced by BoxLayoutData< T >::generalCopyTo(), and read().
void BoxLayoutData< T >::define | ( | const BoxLayoutData< T > & | da, | |
const DataFactory< T > & | factory = DefaultDataFactory<T>() | |||
) | [inline, virtual] |
Reimplemented in LevelData< T >, LevelData< EBGraph >, LevelData< NodeFArrayBox >, LevelData< CodimBox< FArrayBox > >, LevelData< BaseFab< IntVect > >, LevelData< FluxBox >, LevelData< BaseIVFAB< double > >, LevelData< BaseIFFAB< double > >, LevelData< BaseFab< PetscInt > >, LevelData< EBCellFAB >, LevelData< EdgeDataBox >, LevelData< BaseFab< bool > >, LevelData< FArrayBox >, LevelData< EBData >, LevelData< EBFluxFAB >, and LevelData< BaseFab< int > >.
References BoxLayoutData< T >::allocateGhostVector(), LayoutData< T >::boxLayout(), LayoutData< T >::m_boxLayout, BoxLayoutData< T >::m_comps, BoxLayoutData< T >::m_isdefined, BoxLayoutData< T >::m_threadSafe, BoxLayoutData< T >::nComp(), BoxLayoutData< T >::setVector(), and DataFactory< T >::threadSafe().
void BoxLayoutData< T >::define | ( | const BoxLayoutData< T > & | da, | |
const Interval & | comps, | |||
const DataFactory< T > & | factory = DefaultDataFactory<T>() | |||
) | [inline, virtual] |
Define this BoxLayoutData to be the subset of the data in da defined by the Interval comps.
Reimplemented in LevelData< T >, LevelData< EBGraph >, LevelData< NodeFArrayBox >, LevelData< CodimBox< FArrayBox > >, LevelData< BaseFab< IntVect > >, LevelData< FluxBox >, LevelData< BaseIVFAB< double > >, LevelData< BaseIFFAB< double > >, LevelData< BaseFab< PetscInt > >, LevelData< EBCellFAB >, LevelData< EdgeDataBox >, LevelData< BaseFab< bool > >, LevelData< FArrayBox >, LevelData< EBData >, LevelData< EBFluxFAB >, and LevelData< BaseFab< int > >.
References BoxLayoutData< T >::allocateGhostVector(), Interval::begin(), LayoutData< T >::boxLayout(), CH_assert, Interval::end(), MayDay::Error(), LayoutData< T >::m_boxLayout, BoxLayoutData< T >::m_comps, BoxLayoutData< T >::m_threadSafe, BoxLayoutData< T >::setVector(), Interval::size(), and DataFactory< T >::threadSafe().
void BoxLayoutData< T >::define | ( | const BoxLayout & | boxes | ) | [inline, virtual] |
overridden and throws an error.
Reimplemented from LayoutData< T >.
Reimplemented in LevelData< T >, LevelData< EBGraph >, LevelData< NodeFArrayBox >, LevelData< CodimBox< FArrayBox > >, LevelData< BaseFab< IntVect > >, LevelData< FluxBox >, LevelData< BaseIVFAB< double > >, LevelData< BaseIFFAB< double > >, LevelData< BaseFab< PetscInt > >, LevelData< EBCellFAB >, LevelData< EdgeDataBox >, LevelData< BaseFab< bool > >, LevelData< FArrayBox >, LevelData< EBData >, LevelData< EBFluxFAB >, and LevelData< BaseFab< int > >.
References MayDay::Error().
virtual bool BoxLayoutData< T >::threadSafe | ( | ) | const [inline, virtual] |
Referenced by BoxLayoutData< T >::makeItSoLocalCopy().
int BoxLayoutData< T >::nComp | ( | ) | const [inline] |
Referenced by LevelDataOps< T >::assign(), LevelData< T >::copyTo(), LevelDataOps< T >::copyToZero(), LevelDataOps< T >::create(), BoxLayoutData< T >::define(), LevelData< T >::degenerate(), LevelData< T >::degenerateLocalOnly(), MultilevelLinearOp< T >::dotProduct(), VCAMRPoissonOp2::getFlux(), AMRPoissonOp::getFlux(), LevelDataOps< T >::incr(), LevelData< T >::localCopyTo(), MergeSolver< T >::solve(), and WriteMultiData< T >::writeData().
Interval BoxLayoutData< T >::interval | ( | ) | const [inline] |
void BoxLayoutData< T >::generalCopyTo | ( | const BoxLayout & | a_destGrids, | |
LayoutData< Vector< RefCountedPtr< T > > > & | a_dest, | |||
const Interval & | a_interval, | |||
const ProblemDomain & | a_domain, | |||
const DataFactory< T > & | factory = DefaultDataFactory<T>() | |||
) | const [inline] |
General data copying operation.
a_destGrids | BoxLayout for the destination data holder | |
a_dest | return argument. upon completion contains a Vector of T objects for each Box in a_destGrids that overlaps this->boxLayout() | |
a_interval | range of components to source | |
a_domain | ProblemDomain that this grid and a_destGrids reside on. | |
factory | optional data factory for template classes that have non-trivial construction |
References Copier::define(), LayoutData< T >::m_boxLayout, and IntVect::Zero.
void BoxLayoutData< T >::generalCopyTo | ( | const BoxLayout & | a_destGrids, | |
LayoutData< Vector< RefCountedPtr< T > > > & | a_dest, | |||
const Interval & | a_interval, | |||
const ProblemDomain & | a_domain, | |||
const Copier & | a_copier, | |||
const DataFactory< T > & | factory = DefaultDataFactory<T>() | |||
) | const [inline] |
References BoxLayoutData< T >::allocateBuffers(), CH_assert, BoxLayoutData< T >::completePendingSends(), DataFactory< T >::create(), BoxLayoutData< T >::define(), MotionItem::fromIndex, MotionItem::fromRegion, CopyIterator::LOCAL, BoxLayoutData< T >::m_buff, CopierBuffer::m_fromMe, CopierBuffer::m_toMe, LDOperator< T >::op(), BoxLayoutData< T >::postReceivesToMe(), BoxLayoutData< T >::postSendsFromMe(), CopyIterator::size(), Interval::size(), MotionItem::toIndex, MotionItem::toRegion, BoxLayoutData< T >::unpackReceivesToMe_append(), and BoxLayoutData< T >::writeSendDataFromMeIntoBuffers().
void BoxLayoutData< T >::addTo | ( | const Interval & | a_srcComps, | |
BoxLayoutData< T > & | a_dest, | |||
const Interval & | a_destComps, | |||
const ProblemDomain & | a_domain | |||
) | const [inline] |
Special version of generalCopyTo that performs increment-on-intersection of the destination instead of replacement
References Copier::define(), LayoutData< T >::m_boxLayout, and IntVect::Zero.
void BoxLayoutData< T >::addTo | ( | const Interval & | a_srcComps, | |
BoxLayoutData< T > & | a_dest, | |||
const Interval & | a_destComps, | |||
const ProblemDomain & | a_domain, | |||
const Copier & | a_copier | |||
) | const [inline] |
Special version of generalCopyTo that performs increment-on-intersection of the destination instead of replacement. This version lets the user send in a pre-built Copier.
References CH_TIME, and BoxLayoutData< T >::makeItSo().
void BoxLayoutData< T >::apply | ( | void(*)(const Box &box, int comps, T &t) | a_Function | ) | [inline, virtual] |
bool BoxLayoutData< T >::isDefined | ( | ) | const [inline, virtual] |
References BoxLayoutData< T >::m_isdefined.
void BoxLayoutData< T >::clear | ( | ) | [inline, virtual] |
void BoxLayoutData< T >::setVector | ( | const BoxLayoutData< T > & | da, | |
const Interval & | srcComps, | |||
const Interval & | destComps | |||
) | [inline, protected] |
References LayoutData< T >::box(), LayoutData< T >::dataIterator(), LayoutData< T >::m_vector, and DataIterator::size().
Referenced by LevelData< T >::define(), BoxLayoutData< T >::define(), and LevelData< T >::LevelData().
void BoxLayoutData< T >::allocateGhostVector | ( | const DataFactory< T > & | factory, | |
const IntVect & | ghost = IntVect::Zero | |||
) | [inline, protected] |
References LayoutData< T >::box(), DataFactory< T >::callDelete(), DataFactory< T >::create(), LayoutData< T >::dataIterator(), MayDay::Error(), Box::grow(), LayoutData< T >::m_callDelete, BoxLayoutData< T >::m_comps, LayoutData< T >::m_vector, Vector< T >::resize(), DataIterator::size(), and Vector< T >::size().
Referenced by BoxLayoutData< T >::BoxLayoutData(), LevelData< T >::define(), BoxLayoutData< T >::define(), and LevelData< T >::LevelData().
void BoxLayoutData< T >::makeItSo | ( | const Interval & | a_srcComps, | |
const BoxLayoutData< T > & | a_src, | |||
BoxLayoutData< T > & | a_dest, | |||
const Interval & | a_destComps, | |||
const Copier & | a_copier, | |||
const LDOperator< T > & | a_op = LDOperator<T>() | |||
) | const [inline, protected] |
void BoxLayoutData< T >::makeItSoBegin | ( | const Interval & | a_srcComps, | |
const BoxLayoutData< T > & | a_src, | |||
BoxLayoutData< T > & | a_dest, | |||
const Interval & | a_destComps, | |||
const Copier & | a_copier, | |||
const LDOperator< T > & | a_op = LDOperator<T>() | |||
) | const [inline, protected] |
References BoxLayoutData< T >::allocateBuffers(), CH_TIME, BoxLayoutData< T >::m_buff, CopierBuffer::m_fromMe, CopierBuffer::m_toMe, BoxLayoutData< T >::postReceivesToMe(), BoxLayoutData< T >::postSendsFromMe(), and BoxLayoutData< T >::writeSendDataFromMeIntoBuffers().
Referenced by LevelData< T >::exchangeBegin(), LevelData< T >::exchangeNoOverlap(), and BoxLayoutData< T >::makeItSo().
void BoxLayoutData< T >::makeItSoLocalCopy | ( | const Interval & | a_srcComps, | |
const BoxLayoutData< T > & | a_src, | |||
BoxLayoutData< T > & | a_dest, | |||
const Interval & | a_destComps, | |||
const Copier & | a_copier, | |||
const LDOperator< T > & | a_op = LDOperator<T>() | |||
) | const [inline, protected] |
References CH_TIME, MotionItem::fromIndex, MotionItem::fromRegion, CopyIterator::LOCAL, BoxLayoutData< T >::m_threadSafe, LDOperator< T >::op(), CopyIterator::size(), LDOperator< T >::threadSafe(), BoxLayoutData< T >::threadSafe(), MotionItem::toIndex, and MotionItem::toRegion.
Referenced by LevelData< T >::exchangeBegin(), LevelData< T >::exchangeNoOverlap(), and BoxLayoutData< T >::makeItSo().
void BoxLayoutData< T >::makeItSoEnd | ( | BoxLayoutData< T > & | a_dest, | |
const Interval & | a_destComps, | |||
const LDOperator< T > & | a_op = LDOperator<T>() | |||
) | const [inline, protected] |
void BoxLayoutData< T >::completePendingSends | ( | ) | const [inline, protected] |
void BoxLayoutData< T >::allocateBuffers | ( | const BoxLayoutData< T > & | a_src, | |
const Interval & | a_srcComps, | |||
const BoxLayoutData< T > & | a_dest, | |||
const Interval & | a_destComps, | |||
const Copier & | a_copier, | |||
const LDOperator< T > & | a_op | |||
) | const [inline, protected] |
Referenced by BoxLayoutData< T >::generalCopyTo(), and BoxLayoutData< T >::makeItSoBegin().
void BoxLayoutData< T >::writeSendDataFromMeIntoBuffers | ( | const BoxLayoutData< T > & | a_src, | |
const Interval & | a_srcComps, | |||
const LDOperator< T > & | a_op | |||
) | const [inline, protected] |
Referenced by BoxLayoutData< T >::generalCopyTo(), and BoxLayoutData< T >::makeItSoBegin().
void BoxLayoutData< T >::postSendsFromMe | ( | ) | const [inline, protected] |
Referenced by BoxLayoutData< T >::generalCopyTo(), and BoxLayoutData< T >::makeItSoBegin().
void BoxLayoutData< T >::postReceivesToMe | ( | ) | const [inline, protected] |
Referenced by BoxLayoutData< T >::generalCopyTo(), and BoxLayoutData< T >::makeItSoBegin().
void BoxLayoutData< T >::unpackReceivesToMe | ( | BoxLayoutData< T > & | a_dest, | |
const Interval & | a_destComps, | |||
const LDOperator< T > & | a_op | |||
) | const [inline, protected] |
Referenced by BoxLayoutData< T >::makeItSoEnd().
void BoxLayoutData< T >::unpackReceivesToMe_append | ( | LayoutData< Vector< RefCountedPtr< T > > > & | a_dest, | |
const Interval & | a_destComps, | |||
int | ncomp, | |||
const DataFactory< T > & | factory, | |||
const LDOperator< T > & | a_op | |||
) | const [inline, protected] |
Referenced by BoxLayoutData< T >::generalCopyTo().
friend class LevelData< T > [friend] |
int BoxLayoutData< T >::s_verbosity = 0 [inline, static] |
int BoxLayoutData< T >::m_comps [protected] |
bool BoxLayoutData< T >::m_threadSafe [protected] |
bool BoxLayoutData< T >::m_isdefined [protected] |
CopierBuffer* BoxLayoutData< T >::m_buff [mutable, protected] |
Referenced by BoxLayoutData< T >::generalCopyTo(), and BoxLayoutData< T >::makeItSoBegin().