#include <LevelData.H>
Public Member Functions | |
LevelData () | |
LevelData (const DisjointBoxLayout &dp, int comps, const IntVect &ghost=IntVect::Zero, const DataFactory< T > &a_factory=DefaultDataFactory< T >()) | |
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 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 | |
virtual void | localCopyTo (LevelData< T > &dest) const |
assumes source and dest have same interval | |
virtual void | copyTo (BoxLayoutData< T > &dest) const |
Simplest case -- assumes source and dest have same interval. | |
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. | |
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. | |
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. | |
virtual void | exchange (void) |
Simplest case -- do all components. | |
virtual void | exchange (const Copier &copier) |
Simplest case -- do all components. Accepts a pre-built copier. | |
virtual void | exchange (const Interval &comps) |
Accepts an arbitrary component range. | |
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. | |
virtual void | exchangeEnd () |
finish asynchronous exchange | |
virtual void | exchangeNoOverlap (const Copier &copier) |
const IntVect & | ghostVect () const |
const DisjointBoxLayout & | getBoxes () const |
const DisjointBoxLayout & | disjointBoxLayout () 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 | |
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. | |
Protected Attributes | |
DisjointBoxLayout | m_disjointBoxLayout |
IntVect | m_ghost |
Copier | m_exchangeCopier |
Friends | |
void | aliasLevelData (LevelData< T > &a_alias, LevelData< T > *a_original, const Interval &a_interval) |
Data over a disjoint union of rectangles. | |
Classes | |
struct | ApplyFunctor |
LevelData< T >::LevelData | ( | const DisjointBoxLayout & | dp, | |
int | comps, | |||
const IntVect & | ghost = IntVect::Zero , |
|||
const DataFactory< T > & | a_factory = DefaultDataFactory<T>() | |||
) | [inline] |
References BoxLayoutData< T >::allocateGhostVector(), Copier::define(), MayDay::Error(), BoxLayoutData< T >::interval(), BoxLayout::isClosed(), LayoutData< T >::m_boxLayout, BoxLayoutData< T >::m_comps, LevelData< T >::m_disjointBoxLayout, LevelData< T >::m_exchangeCopier, LevelData< T >::m_ghost, BoxLayoutData< T >::m_isdefined, BoxLayoutData< T >::m_threadSafe, BoxLayoutData< T >::setVector(), DataFactory< T >::threadSafe(), and IntVect::Zero.
void LevelData< T >::define | ( | const DisjointBoxLayout & | dp, | |
int | comps, | |||
const IntVect & | ghost = IntVect::Zero , |
|||
const DataFactory< T > & | a_factory = DefaultDataFactory<T>() | |||
) | [inline, virtual] |
References BoxLayoutData< T >::allocateGhostVector(), CH_TIME, Copier::clear(), Copier::define(), MayDay::Error(), BoxLayout::isClosed(), ProblemDomain::isPeriodic(), LayoutData< T >::m_boxLayout, BoxLayoutData< T >::m_comps, LevelData< T >::m_disjointBoxLayout, LevelData< T >::m_exchangeCopier, LevelData< T >::m_ghost, BoxLayoutData< T >::m_isdefined, BoxLayoutData< T >::m_threadSafe, DisjointBoxLayout::physDomain(), DataFactory< T >::threadSafe(), and IntVect::Zero.
Referenced by aliasLevelData(), blockRead(), PetscSolver< T >::computeResidual(), LevelDataOps< T >::create(), PetscSolver< T >::create_mat_vec(), LevelData< T >::degenerate(), LevelData< T >::degenerateLocalOnly(), BaseLevelHeatSolver< LevelData< FArrayBox >, FluxBox, LevelFluxRegister >::incrementFlux(), and read().
void LevelData< T >::define | ( | const LevelData< T > & | da, | |
const DataFactory< T > & | a_factory = DefaultDataFactory<T>() | |||
) | [inline, virtual] |
copy definer. this LevelData thrown away and da's LevelData copied
References BoxLayoutData< T >::allocateGhostVector(), CH_TIME, Copier::clear(), LevelData< T >::copyTo(), Copier::define(), LayoutData< T >::m_boxLayout, BoxLayoutData< T >::m_comps, LevelData< T >::m_disjointBoxLayout, LevelData< T >::m_exchangeCopier, LevelData< T >::m_ghost, BoxLayoutData< T >::m_isdefined, BoxLayoutData< T >::m_threadSafe, DataFactory< T >::threadSafe(), and IntVect::Zero.
void LevelData< T >::define | ( | const LevelData< T > & | da, | |
const Interval & | comps, | |||
const DataFactory< T > & | a_factory = DefaultDataFactory<T>() | |||
) | [inline, 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()]
References BoxLayoutData< T >::allocateGhostVector(), Interval::begin(), CH_assert, CH_TIME, Copier::clear(), Copier::define(), MayDay::Error(), LayoutData< T >::m_boxLayout, BoxLayoutData< T >::m_comps, LevelData< T >::m_disjointBoxLayout, LevelData< T >::m_exchangeCopier, LevelData< T >::m_ghost, BoxLayoutData< T >::m_isdefined, BoxLayoutData< T >::m_threadSafe, BoxLayoutData< T >::setVector(), Interval::size(), DataFactory< T >::threadSafe(), and IntVect::Zero.
void LevelData< T >::copyTo | ( | const Interval & | srcComps, | |
BoxLayoutData< T > & | dest, | |||
const Interval & | destComps | |||
) | const [inline, virtual] |
References LayoutData< T >::box(), LayoutData< T >::boxLayout(), CH_TIME, LayoutData< T >::dataIterator(), LevelData< T >::m_disjointBoxLayout, and DataIterator::size().
Referenced by LevelDataOps< T >::assign(), LevelData< T >::copyTo(), LevelData< T >::define(), LevelData< T >::degenerate(), and MergeSolver< T >::solve().
void LevelData< T >::localCopyTo | ( | const Interval & | srcComps, | |
LevelData< T > & | dest, | |||
const Interval & | destComps | |||
) | const [inline, virtual] |
only works if source and dest have the same disjointboxlayout
References LayoutData< T >::box(), CH_TIME, LayoutData< T >::dataIterator(), LevelData< T >::disjointBoxLayout(), MayDay::Error(), LevelData< T >::ghostVect(), Box::grow(), minBox(), and DataIterator::size().
Referenced by LevelData< T >::localCopyTo().
void LevelData< T >::localCopyTo | ( | LevelData< T > & | dest | ) | const [inline, virtual] |
assumes source and dest have same interval
References CH_assert, BoxLayoutData< T >::interval(), LevelData< T >::localCopyTo(), and BoxLayoutData< T >::nComp().
void LevelData< T >::copyTo | ( | BoxLayoutData< T > & | dest | ) | const [inline, virtual] |
Simplest case -- assumes source and dest have same interval.
References CH_assert, LevelData< T >::copyTo(), BoxLayoutData< T >::interval(), and BoxLayoutData< T >::nComp().
void LevelData< T >::copyTo | ( | const Interval & | srcComps, | |
BoxLayoutData< T > & | dest, | |||
const Interval & | destComps, | |||
const Copier & | copier, | |||
const LDOperator< T > & | a_op = LDOperator<T>() | |||
) | const [inline, 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
References CH_TIME, and BoxLayoutData< T >::makeItSo().
void LevelData< T >::copyTo | ( | BoxLayoutData< T > & | dest, | |
const Copier & | copier, | |||
const LDOperator< T > & | a_op = LDOperator<T>() | |||
) | const [inline, virtual] |
Simplest case -- assumes source and dest have same interval.
References CH_assert, LevelData< T >::copyTo(), BoxLayoutData< T >::interval(), and BoxLayoutData< T >::nComp().
void LevelData< T >::copyTo | ( | const Interval & | srcComps, | |
LevelData< T > & | dest, | |||
const Interval & | destComps | |||
) | const [inline, 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.
References LayoutData< T >::box(), LayoutData< T >::boxLayout(), LevelData< T >::copyTo(), LayoutData< T >::dataIterator(), MayDay::Error(), LevelData< T >::getBoxes(), LevelData< T >::ghostVect(), LevelData< T >::m_disjointBoxLayout, LevelData< T >::m_ghost, DataIterator::size(), and IntVect::Zero.
Simplest case -- assumes source and dest have same interval.
References CH_assert, LevelData< T >::copyTo(), BoxLayoutData< T >::interval(), and BoxLayoutData< T >::nComp().
void LevelData< T >::copyTo | ( | const Interval & | srcComps, | |
LevelData< T > & | dest, | |||
const Interval & | destComps, | |||
const Copier & | copier, | |||
const LDOperator< T > & | a_op = LDOperator<T>() | |||
) | const [inline, 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
References CH_TIME, and BoxLayoutData< T >::makeItSo().
void LevelData< T >::copyTo | ( | LevelData< T > & | dest, | |
const Copier & | copier, | |||
const LDOperator< T > & | a_op = LDOperator<T>() | |||
) | const [inline, virtual] |
Simplest case -- assumes source and dest have same interval.
References CH_assert, LevelData< T >::copyTo(), BoxLayoutData< T >::interval(), and BoxLayoutData< T >::nComp().
void LevelData< T >::exchange | ( | void | ) | [inline, virtual] |
Simplest case -- do all components.
References BoxLayoutData< T >::interval().
Referenced by PetscSolver< T >::computeResidual(), PetscSolver< T >::create_mat_vec(), and LevelData< T >::exchange().
Simplest case -- do all components. Accepts a pre-built copier.
References LevelData< T >::exchange(), and BoxLayoutData< T >::interval().
Accepts an arbitrary component range.
References CH_TIME, Copier::define(), LevelData< T >::exchange(), Copier::isDefined(), LevelData< T >::m_disjointBoxLayout, LevelData< T >::m_exchangeCopier, LevelData< T >::m_ghost, and IntVect::Zero.
void LevelData< T >::exchange | ( | const Interval & | comps, | |
const Copier & | copier, | |||
const LDOperator< T > & | a_op = LDOperator<T>() | |||
) | [inline, virtual] |
The most general case -- can accept an arbitrary component range, a pre-built Copier object, and an arbitrary accumulation operator.
References CH_TIME, and BoxLayoutData< T >::makeItSo().
asynchronous exchange start. load and fire off messages.
References CH_TIME, BoxLayoutData< T >::interval(), BoxLayoutData< T >::makeItSoBegin(), and BoxLayoutData< T >::makeItSoLocalCopy().
void LevelData< T >::exchangeEnd | ( | ) | [inline, virtual] |
finish asynchronous exchange
References CH_TIME, BoxLayoutData< T >::interval(), and BoxLayoutData< T >::makeItSoEnd().
void LevelData< T >::define | ( | const BoxLayout & | dp, | |
int | comps, | |||
const DataFactory< T > & | factory | |||
) | [inline, virtual] |
void LevelData< T >::define | ( | const BoxLayoutData< T > & | da, | |
const DataFactory< T > & | factory = DefaultDataFactory<T>() | |||
) | [inline, virtual] |
void LevelData< 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 from BoxLayoutData< T >.
References MayDay::Error().
const DisjointBoxLayout& LevelData< T >::getBoxes | ( | ) | const [inline] |
Referenced by LevelData< T >::copyTo().
const DisjointBoxLayout& LevelData< T >::disjointBoxLayout | ( | ) | const [inline] |
Referenced by aliasLevelData(), PetscSolver< T >::computeResidual(), LevelDataOps< T >::create(), VCAMRPoissonOp2::diagonalScale(), NWOViscousTensorOp::diagonalScale(), ViscousTensorOp::diagonalScale(), VCAMRPoissonOp2::divideByIdentityCoef(), NWOViscousTensorOp::divideByIdentityCoef(), ViscousTensorOp::divideByIdentityCoef(), LevelDataOps< T >::dotProduct(), BCFunction::fillGhostCells(), LevelDataOps< T >::incr(), LevelData< T >::localCopyTo(), LevelDataOps< T >::mDotProduct(), and MergeSolver< T >::solve().
virtual void LevelData< T >::apply | ( | void(*)(const Box &, int, T &) | a_Function | ) | [virtual] |
User writes a function with the signature:
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:
LevelData<FArrayBox> data(layout, 3, IntVect::Unit); 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);
void LevelData< T >::apply | ( | const ApplyFunctor & | f | ) | [inline, 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; } LevelData<FArrayBox> data(layout, 3, IntVect::Unit); data.apply( MyFunctor(3.14, 0) );
References LayoutData< T >::dataIterator(), BoxLayout::get(), BoxLayoutData< T >::m_comps, LevelData< T >::m_disjointBoxLayout, LayoutData< T >::m_vector, and DataIterator::size().
void LevelData< T >::degenerateLocalOnly | ( | LevelData< T > & | a_to, | |
const SliceSpec & | a_ss | |||
) | const [inline] |
version of degenerate which does strictly local copying
this means that it maintains source ghost cell values in the destination
References LayoutIterator::begin(), BaseFab< T >::box(), CH_SPACEDIM, BaseFab< T >::copy(), LayoutData< T >::dataIterator(), LevelData< T >::define(), DisjointBoxLayout::degenerate(), SliceSpec::direction, LevelData< T >::m_disjointBoxLayout, LevelData< T >::m_ghost, BoxLayoutData< T >::nComp(), LayoutIterator::ok(), and LayoutData< T >::operator[]().
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.
a_alias | aliased LevelData<T> object. original data in a_alias is destroyed and new aliasing role assumed. | |
a_original | pointer to LevelData<T> that will be aliased. | |
a_interval | range 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); LevelData<FArrayBox> alias; 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
DisjointBoxLayout LevelData< T >::m_disjointBoxLayout [protected] |
Referenced by LevelData< T >::apply(), LevelData< T >::copyTo(), LevelData< T >::define(), LevelData< T >::degenerate(), LevelData< T >::degenerateLocalOnly(), LevelData< BaseFab< int > >::disjointBoxLayout(), LevelData< T >::exchange(), LevelData< BaseFab< int > >::getBoxes(), and LevelData< T >::LevelData().
Copier LevelData< T >::m_exchangeCopier [protected] |
Referenced by LevelData< T >::define(), LevelData< T >::exchange(), and LevelData< T >::LevelData().