Chombo + EB  3.2
Classes | Public Member Functions | Protected Attributes | Friends | List of all members
LevelData< T > Class Template Reference

new code More...

#include <BoxLayoutData.H>

Inheritance diagram for LevelData< T >:
Inheritance graph
[legend]

Classes

struct  ApplyFunctor
 

Public Member Functions

 LevelData ()
 
 LevelData (const DisjointBoxLayout &dp, int comps, const IntVect &ghost=IntVect::Zero, const DataFactory< T > &a_factory=DefaultDataFactory< T >())
 
 LevelData (const DisjointBoxLayout &dp, int comps, const Copier &a_exchangeCopier, const IntVect &ghost=IntVect::Zero, const DataFactory< T > &a_factory=DefaultDataFactory< T >())
 constructor which also takes a copier for use in exchanges. More...
 
virtual ~LevelData ()
 
virtual void define (const DisjointBoxLayout &dp, int comps, const IntVect &ghost=IntVect::Zero, const DataFactory< T > &a_factory=DefaultDataFactory< T >())
 
virtual void define (const DisjointBoxLayout &dp, int comps, const Copier &a_exchangeCopier, const IntVect &ghost=IntVect::Zero, const DataFactory< T > &a_factory=DefaultDataFactory< T >())
 
virtual void define (const LevelData< T > &da, const DataFactory< T > &a_factory=DefaultDataFactory< T >())
 
virtual void define (const LevelData< T > &da, const Interval &comps, const DataFactory< T > &a_factory=DefaultDataFactory< T >())
 
virtual void copyTo (const Interval &srcComps, BoxLayoutData< T > &dest, const Interval &destComps) const
 
virtual void localCopyTo (const Interval &srcComps, LevelData< T > &dest, const Interval &destComps) const
 only works if source and dest have the same disjointboxlayout More...
 
virtual void localCopyTo (LevelData< T > &dest) const
 assumes source and dest have same interval More...
 
virtual void copyTo (BoxLayoutData< T > &dest) const
 Simplest case – assumes source and dest have same interval. More...
 
virtual void copyTo (const Interval &srcComps, BoxLayoutData< T > &dest, const Interval &destComps, const Copier &copier, const LDOperator< T > &a_op=LDOperator< T >()) const
 
virtual void copyTo (BoxLayoutData< T > &dest, const Copier &copier, const LDOperator< T > &a_op=LDOperator< T >()) const
 Simplest case – assumes source and dest have same interval. More...
 
virtual void copyTo (const Interval &srcComps, LevelData< T > &dest, const Interval &destComps) const
 
virtual void copyTo (LevelData< T > &dest) const
 Simplest case – assumes source and dest have same interval. More...
 
virtual void copyTo (const Interval &srcComps, LevelData< T > &dest, const Interval &destComps, const Copier &copier, const LDOperator< T > &a_op=LDOperator< T >()) const
 
virtual void copyTo (LevelData< T > &dest, const Copier &copier, const LDOperator< T > &a_op=LDOperator< T >()) const
 Simplest case – assumes source and dest have same interval. More...
 
virtual void exchange (void)
 Simplest case – do all components. More...
 
virtual void exchange (const Copier &copier)
 Simplest case – do all components. Accepts a pre-built copier. More...
 
virtual void exchange (const Interval &comps)
 Accepts an arbitrary component range. More...
 
virtual void exchange (const Interval &comps, const Copier &copier, const LDOperator< T > &a_op=LDOperator< T >())
 
virtual void exchangeBegin (const Copier &copier)
 asynchronous exchange start. load and fire off messages. More...
 
virtual void exchangeEnd ()
 finish asynchronous exchange More...
 
virtual void exchangeNoOverlap (const Copier &copier)
 
virtual void setExchangeCopier (const Copier &copier)
 allows one to set the default copier for all exchanges going forward. More...
 
const IntVectghostVect () const
 
const DisjointBoxLayoutgetBoxes () const
 
const DisjointBoxLayoutdisjointBoxLayout () const
 
virtual void apply (void(*a_Function)(const Box &, int, T &))
 
virtual void apply (const ApplyFunctor &)
 
void degenerate (LevelData< T > &a_to, const SliceSpec &a_ss) const
 
void degenerateLocalOnly (LevelData< T > &a_to, const SliceSpec &a_ss) const
 version of degenerate which does strictly local copying More...
 
overidden virtual functions

These functions will invoke error messages when invoked. C++ will ensure that constructors are not called for the base class by a user, but a 'define' function has no such protection, hence the need to prevent such usage. A runtime error is not a perfect solution...(strong construction gets around this sigh). classes that derive from LevelData will have to turn its valid defines into runtime errors also and make its own defines. Thus taking over the job of the compiler.

virtual void define (const BoxLayout &dp, int comps, const DataFactory< T > &factory)
 
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 &deadFunction)
 overridden and throws an error. More...
 
- Public Member Functions inherited from BoxLayoutData< T >
 BoxLayoutData ()
 
virtual ~BoxLayoutData ()
 
 BoxLayoutData (const BoxLayout &boxes, int comps, const DataFactory< T > &factory=DefaultDataFactory< T >())
 
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. More...
 
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 ()
 
- Public Member Functions inherited from LayoutData< T >
 LayoutData ()
 
 LayoutData (const BoxLayout &a_dp)
 
virtual ~LayoutData ()
 
DataIterator dataIterator () const
 
TimedDataIterator timedDataIterator () const
 
const T & operator[] (const DataIndex &a_index) const
 const accessor function More...
 
const T & operator[] (const DataIterator &a_iterator) const
 const accessor function More...
 
T & operator[] (const DataIndex &a_index)
 non-const accessor function More...
 
T & operator[] (const DataIterator &a_iterator)
 non-const accessor function More...
 
Box box (const DataIndex &a_index) const
 
Box box (const DataIterator &a_iterator) const
 
const BoxLayoutboxLayout () const
 

Protected Attributes

DisjointBoxLayout m_disjointBoxLayout
 
IntVect m_ghost
 
Copier m_exchangeCopier
 
- Protected Attributes inherited from BoxLayoutData< T >
int m_comps
 
bool m_threadSafe
 
bool m_isdefined
 
CopierBufferm_buff
 
- Protected Attributes inherited from LayoutData< T >
BoxLayout m_boxLayout
 
Vector< T * > m_vector
 
bool m_callDelete
 

Friends

void aliasLevelData (LevelData< T > &a_alias, LevelData< T > *a_original, const Interval &a_interval)
 Data over a disjoint union of rectangles. More...
 

Additional Inherited Members

- Static Public Attributes inherited from BoxLayoutData< T >
static int s_verbosity = 0
 
- Protected Member Functions inherited from BoxLayoutData< T >
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
 

Detailed Description

template<class T>
class LevelData< T >

new code

Constructor & Destructor Documentation

◆ LevelData() [1/3]

template<class T >
LevelData< T >::LevelData ( )

◆ LevelData() [2/3]

template<class T>
LevelData< T >::LevelData ( const DisjointBoxLayout dp,
int  comps,
const IntVect ghost = IntVect::Zero,
const DataFactory< T > &  a_factory = DefaultDataFactory<T>() 
)

◆ LevelData() [3/3]

template<class T>
LevelData< T >::LevelData ( const DisjointBoxLayout dp,
int  comps,
const Copier a_exchangeCopier,
const IntVect ghost = IntVect::Zero,
const DataFactory< T > &  a_factory = DefaultDataFactory<T>() 
)

constructor which also takes a copier for use in exchanges.

◆ ~LevelData()

template<class T >
LevelData< T >::~LevelData ( )
virtual

Member Function Documentation

◆ define() [1/8]

template<class T>
void LevelData< T >::define ( const DisjointBoxLayout dp,
int  comps,
const IntVect ghost = IntVect::Zero,
const DataFactory< T > &  a_factory = DefaultDataFactory<T>() 
)
virtual

◆ define() [2/8]

template<class T>
void LevelData< T >::define ( const DisjointBoxLayout dp,
int  comps,
const Copier a_exchangeCopier,
const IntVect ghost = IntVect::Zero,
const DataFactory< T > &  a_factory = DefaultDataFactory<T>() 
)
virtual

◆ define() [3/8]

template<class T>
void LevelData< T >::define ( const LevelData< T > &  da,
const DataFactory< T > &  a_factory = DefaultDataFactory<T>() 
)
virtual

copy definer. this LevelData thrown away and da's LevelData copied

◆ define() [4/8]

template<class T>
void LevelData< T >::define ( const LevelData< T > &  da,
const Interval comps,
const DataFactory< T > &  a_factory = DefaultDataFactory<T>() 
)
virtual

Copy definer. 'this' LevelData thrown away and da's LevelData copied. This LevelData is now defined for the range [0, comps.size()] and filled with the data in da from [comps.begin(), comps.end()]

◆ copyTo() [1/8]

template<class T>
void LevelData< T >::copyTo ( const Interval srcComps,
BoxLayoutData< T > &  dest,
const Interval destComps 
) const
virtual

◆ localCopyTo() [1/2]

template<class T>
void LevelData< T >::localCopyTo ( const Interval srcComps,
LevelData< T > &  dest,
const Interval destComps 
) const
virtual

only works if source and dest have the same disjointboxlayout

Referenced by LevelData< BaseFab< int > >::localCopyTo().

◆ localCopyTo() [2/2]

template<class T>
void LevelData< T >::localCopyTo ( LevelData< T > &  dest) const
virtual

assumes source and dest have same interval

◆ copyTo() [2/8]

template<class T>
void LevelData< T >::copyTo ( BoxLayoutData< T > &  dest) const
virtual

Simplest case – assumes source and dest have same interval.

◆ copyTo() [3/8]

template<class T>
void LevelData< T >::copyTo ( const Interval srcComps,
BoxLayoutData< T > &  dest,
const Interval destComps,
const Copier copier,
const LDOperator< T > &  a_op = LDOperator<T>() 
) const
virtual

FM MOD START ////////////////////////// same as copyTo that takes a BoxLayoutData, except that it fills the ghost cells of 'dest' with data from 'this' also. USer passes in a prebuilt Copier object

◆ copyTo() [4/8]

template<class T>
void LevelData< T >::copyTo ( BoxLayoutData< T > &  dest,
const Copier copier,
const LDOperator< T > &  a_op = LDOperator<T>() 
) const
virtual

Simplest case – assumes source and dest have same interval.

◆ copyTo() [5/8]

template<class T>
void LevelData< T >::copyTo ( const Interval srcComps,
LevelData< T > &  dest,
const Interval destComps 
) const
virtual

FM MOD. END //////////////////////////// same as copyTo that takes a BoxLayoutData, except that it fills the ghost cells of 'dest' with data from 'this' also.

◆ copyTo() [6/8]

template<class T>
void LevelData< T >::copyTo ( LevelData< T > &  dest) const
virtual

Simplest case – assumes source and dest have same interval.

◆ copyTo() [7/8]

template<class T>
void LevelData< T >::copyTo ( const Interval srcComps,
LevelData< T > &  dest,
const Interval destComps,
const Copier copier,
const LDOperator< T > &  a_op = LDOperator<T>() 
) const
virtual

same as copyTo that takes a BoxLayoutData, except that it fills the ghost cells of 'dest' with data from 'this' also. USer passes in a prebuilt Copier object

◆ copyTo() [8/8]

template<class T>
void LevelData< T >::copyTo ( LevelData< T > &  dest,
const Copier copier,
const LDOperator< T > &  a_op = LDOperator<T>() 
) const
virtual

Simplest case – assumes source and dest have same interval.

◆ exchange() [1/4]

template<class T >
void LevelData< T >::exchange ( void  )
virtual

◆ exchange() [2/4]

template<class T >
void LevelData< T >::exchange ( const Copier copier)
virtual

Simplest case – do all components. Accepts a pre-built copier.

◆ exchange() [3/4]

template<class T >
void LevelData< T >::exchange ( const Interval comps)
virtual

Accepts an arbitrary component range.

◆ exchange() [4/4]

template<class T>
void LevelData< T >::exchange ( const Interval comps,
const Copier copier,
const LDOperator< T > &  a_op = LDOperator<T>() 
)
virtual

The most general case – can accept an arbitrary component range, a pre-built Copier object, and an arbitrary accumulation operator.

◆ exchangeBegin()

template<class T >
void LevelData< T >::exchangeBegin ( const Copier copier)
virtual

asynchronous exchange start. load and fire off messages.

◆ exchangeEnd()

template<class T >
void LevelData< T >::exchangeEnd ( )
virtual

finish asynchronous exchange

◆ exchangeNoOverlap()

template<class T >
void LevelData< T >::exchangeNoOverlap ( const Copier copier)
virtual

◆ setExchangeCopier()

template<class T >
void LevelData< T >::setExchangeCopier ( const Copier copier)
virtual

allows one to set the default copier for all exchanges going forward.

◆ ghostVect()

template<class T>
const IntVect& LevelData< T >::ghostVect ( ) const
inline

◆ define() [5/8]

template<class T>
void LevelData< T >::define ( const BoxLayout dp,
int  comps,
const DataFactory< T > &  factory 
)
virtual

Reimplemented from BoxLayoutData< T >.

◆ define() [6/8]

template<class T>
void LevelData< T >::define ( const BoxLayoutData< T > &  da,
const DataFactory< T > &  factory = DefaultDataFactory<T>() 
)
virtual

Reimplemented from BoxLayoutData< T >.

◆ define() [7/8]

template<class T>
void LevelData< T >::define ( const BoxLayoutData< T > &  da,
const Interval comps,
const DataFactory< T > &  factory = DefaultDataFactory<T>() 
)
virtual

Define this BoxLayoutData to be the subset of the data in da defined by the Interval comps.

Reimplemented from BoxLayoutData< T >.

◆ define() [8/8]

template<class T>
void LevelData< T >::define ( const BoxLayout boxes)
virtual

overridden and throws an error.

Reimplemented from BoxLayoutData< T >.

◆ getBoxes()

template<class T>
const DisjointBoxLayout& LevelData< T >::getBoxes ( ) const
inline

◆ disjointBoxLayout()

template<class T>
const DisjointBoxLayout& LevelData< T >::disjointBoxLayout ( ) const
inline

◆ apply() [1/2]

template<class T>
virtual void LevelData< T >::apply ( void(*)(const Box &, int, T &)  a_Function)
virtual

User writes a function with the signature:

void myfunction(const Box& box, int n_comps, T& t)
{
your code here;
}

They can then hand this off to LayoutData::apply, which invokes this function for every T. The argument "box" is the Box (as known to the DisjointBoxLayout here) associated with that T and the argument "n_comps" is the number of components in this LevelData.

Your function must not be inline.

For example:

struct val
{
static void set1(const Box& box, int n_comps, const FArrayBox& fab)
{
fab.setVal( box.smallEnd(0), box, 0, n_comps );
}
};
data.apply(val::set1);

Referenced by LevelData< BaseFab< int > >::define(), LevelData< BaseFab< int > >::disjointBoxLayout(), and LevelData< T >::ApplyFunctor::~ApplyFunctor().

◆ apply() [2/2]

template<class T>
void LevelData< T >::apply ( const ApplyFunctor f)
virtual

Like the other apply(), but here the argument is an instance of a class derived from LevelData::ApplyFunctor, and which implements ApplyFunctor's pure virtual void operator()(const Box& box, int n_comps, T& t) const.

Going with an instance of such a class is more convenient if you want the thing you pass to apply() to have state.

For example:

class MyFunctor : public LevelData<FArrayBox>::ApplyFunctor
{
public:
MyFunctor( Real x ) : m_x(x)
{
...
}
virtual void operator()(const Box& box, int n_comps, FArrayBox& fab) const
{
fab.setVal( m_x, box, 0, n_comps );
}
private:
const Real m_x;
}
data.apply( MyFunctor(3.14, 0) );

◆ degenerate()

template<class T>
void LevelData< T >::degenerate ( LevelData< T > &  a_to,
const SliceSpec a_ss 
) const

◆ degenerateLocalOnly()

template<class T>
void LevelData< T >::degenerateLocalOnly ( LevelData< T > &  a_to,
const SliceSpec a_ss 
) const

version of degenerate which does strictly local copying

this means that it maintains source ghost cell values in the destination

Referenced by LevelData< T >::ApplyFunctor::~ApplyFunctor().

Friends And Related Function Documentation

◆ aliasLevelData

template<class T>
void aliasLevelData ( LevelData< T > &  a_alias,
LevelData< T > *  a_original,
const Interval a_interval 
)
friend

Data over a disjoint union of rectangles.

LevelData aliasing function.

LevelData is-a BoxLayoutData. It is built from a DisjointBoxLayout instead though, thus making the data in a DisjointBoxLayout uniquely defined for all spatial indices defined by the underlying DisjointBoxLayout. It carries within it an inherent concept of ghost cells (which the user can choose to be empty).

Since LevelData is-a BoxLayoutData, all the methods required of the template class T for BoxLayoutData are also required for LevelData. LevelData does not have any extra requirements.

Parameters
a_aliasaliased LevelData<T> object. original data in a_alias is destroyed and new aliasing role assumed.
a_originalpointer to LevelData<T> that will be aliased.
a_intervalrange of components of each T in a_original that will be created in the a_alias argument.
LevelData<FArrayBox> original(dbl, 4, 2*IntVect::Unit);
Interval subcomps(2, 3);
aliasLevelData<FArrayBox>(alias, &original, subcomps);
// component 0 of every FArrayBox in alias references the same data as
// component 2 in original

The template class T must have an 'alias' constructor

class A
{
public:
A(const Interval& subcomps, A& original);// alias constructor
...
};

Member Data Documentation

◆ m_disjointBoxLayout

template<class T>
DisjointBoxLayout LevelData< T >::m_disjointBoxLayout
protected

◆ m_ghost

template<class T>
IntVect LevelData< T >::m_ghost
protected

◆ m_exchangeCopier

template<class T>
Copier LevelData< T >::m_exchangeCopier
protected

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