11 #ifndef _LEVELDATAI_H_ 12 #define _LEVELDATAI_H_ 21 #include "NamespaceHeader.H" 47 : m_disjointBoxLayout(dp), m_ghost(ghost)
51 this->numReceives = 0;
59 MayDay::Error(
"non-disjoint DisjointBoxLayout: LevelData<T>::LevelData(const DisjointBoxLayout& dp, int comps)");
67 this->
setVector(*
this, interval, interval);
74 const Copier& a_exchangeCopier,
80 define(dp, comps, a_exchangeCopier, ghost, a_factory);
96 CH_TIME(
"LevelData<T>::define(dbl,comps,ghost,factory)");
106 MayDay::Error(
"non-disjoint DisjointBoxLayout: LevelData<T>::define(const DisjointBoxLayout& dp,....)");
110 MayDay::Error(
"LevelData::LevelData(const BoxLayout& dp, int comps) comps<=0");
139 CH_TIME(
"LevelData<T>::define(dbl,comps,copier,ghost,factory)");
141 define(dp, comps, a_exchangeCopier, ghost, a_factory);
151 CH_TIME(
"LevelData<T>::define(LevelData<T>,factory)");
158 if (
this == &da)
return;
180 PR_TIME(
"Chombo::LevelData::define");
182 CH_TIME(
"LevelData<T>::define(LevelData<T>,comps,factory)");
194 MayDay::Error(
" LevelData<T>::define(const LevelData<T>& da, const Interval& comps) called with 'this'");
226 PR_TIME(
"Chombo::LevelData::copyTo");
235 PR_TIME(
"Chombo::LevelData::copyTo::local");
241 int nbox = it.
size();
242 #pragma omp parallel for if(this->m_threadSafe) 243 for (
int ibox = 0; ibox < nbox; ibox++)
245 dest[it[ibox]].copy(this->
box(it[ibox]),
248 this->
operator[](it[ibox]),
255 copyTo(srcComps, dest, destComps, copier);
264 PR_TIME(
"Chombo::LevelData::localCopyTo");
266 CH_TIME(
"LevelData::localCopyTo");
273 int nbox = it.
size();
274 #pragma omp parallel for if(this->m_threadSafe) 275 for (
int ibox = 0; ibox < nbox; ibox++)
277 Box srcBox = this->
box(it[ibox]);
278 Box dstBox = this->
box(it[ibox]);
283 dest[it[ibox]].copy(minBox,
286 this->
operator[](it[ibox]),
324 MayDay::Error(
"src == dest in copyTo function. Perhaps you want exchange ?");
331 int nbox = it.
size();
332 #pragma omp parallel for if(this->m_threadSafe) 333 for (
int ibox = 0; ibox < nbox; ibox++)
335 dest[it[ibox]].copy(this->
box(it[ibox]),
338 this->
operator[](it[ibox]),
345 copyTo(srcComps, dest, destComps, copier);
367 PR_TIME(
"Chombo::LevelData::copyTo");
378 this->
makeItSo(srcComps, *
this, dest, destComps, copier, a_op);
402 PR_TIME(
"Chombo::LevelData::copyTo");
412 this->
makeItSo(srcComps, *
this, dest, destComps, copier, a_op);
432 PR_TIME(
"Chombo::LevelData::exchange (exchange + copier)");
434 CH_TIME(
"LevelData::exchange (exchange + copier)");
444 PR_TIME(
"Chombo::LevelData::exchange (defining copier)");
446 CH_TIME(
"LevelData::exchange (defining copier)");
452 PR_TIME(
"Chombo::LevelData::exchange (actual exchange)");
454 CH_TIME(
"LevelData::exchange (actual exchange)");
483 PR_TIME(
"Chombo::LevelData::exchange");
493 this->
makeItSo(comps, *
this, *
this, comps, copier, a_op);
554 MayDay::Error(
"LevelData<T>::define called with BoxLayout input");
562 MayDay::Error(
"LevelData<T>::define called with BoxLayout input");
570 MayDay::Error(
"LevelData<T>::define called with BoxLayout input");
579 MayDay::Error(
"LevelData<T>::define called with BoxLayout input");
588 int nbox = it.
size();
589 #pragma omp parallel for 590 for (
int ibox = 0; ibox < nbox; ibox++)
603 int nbox = it.
size();
604 #pragma omp parallel for 605 for (
int ibox = 0; ibox < nbox; ibox++)
614 template<
class T>
void 637 template<
class T>
void 659 for (toDit.
begin(); toDit.
ok(); ++toDit)
671 Box intersectBox = toFAB.
box();
672 intersectBox &= fromFAB.
box();
674 toFAB.
copy(fromFAB, intersectBox);
683 if (!fromDit.
ok()) done =
true;
692 #include "NamespaceFooter.H" int m_comps
Definition: BoxLayoutData.H:387
bool isDefined() const
Definition: Copier.H:326
Interval interval() const
Definition: BoxLayoutData.H:312
#define CH_SPACEDIM
Definition: SPACE.H:51
#define CH_assert(cond)
Definition: CHArray.H:37
Vector< T * > m_vector
Definition: LayoutData.H:124
void degenerate(LevelData< T > &a_to, const SliceSpec &a_ss) const
Definition: LevelDataI.H:615
LevelData()
Definition: LevelDataI.H:30
DisjointBoxLayout m_disjointBoxLayout
Definition: LevelData.H:313
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
Definition: BoxLayoutDataI.H:291
A not-necessarily-disjoint collective of boxes.
Definition: BoxLayout.H:145
int size() const
Definition: Interval.H:75
A strange but true thing to make copying from one boxlayoutdata to another fast.
Definition: Copier.H:145
int begin() const
Definition: Interval.H:97
Definition: SliceSpec.H:41
IntVect m_ghost
Definition: LevelData.H:315
const BoxLayout & boxLayout() const
Definition: LayoutData.H:107
void begin()
initialize this iterator to the first Box in its Layout
Definition: LayoutIterator.H:122
DataIterator dataIterator() const
Definition: LayoutDataI.H:78
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
Definition: BoxLayoutDataI.H:250
void setVector(const BoxLayoutData< T > &da, const Interval &srcComps, const Interval &destComps)
Definition: BoxLayoutDataI.H:47
Box box(const DataIndex &a_index) const
Definition: LayoutDataI.H:66
virtual bool ok() const
return true if this iterator is still in its Layout
Definition: LayoutIterator.H:117
Definition: DataIterator.H:190
Copier m_exchangeCopier
Definition: LevelData.H:321
const Box & box() const
Definition: BaseFabImplem.H:271
BoxLayout m_boxLayout
Definition: LayoutData.H:118
virtual void exchange(void)
Simplest case – do all components.
Definition: LevelDataI.H:470
void degenerateLocalOnly(LevelData< T > &a_to, const SliceSpec &a_ss) const
version of degenerate which does strictly local copying
Definition: LevelDataI.H:638
Definition: EBInterface.H:45
virtual void exchangeBegin(const Copier &copier)
asynchronous exchange start. load and fire off messages.
Definition: LevelDataI.H:533
Box minBox(const Box &b1, const Box &b2)
virtual void apply(void(*a_Function)(const Box &, int, T &))
int size() const
Definition: DataIterator.H:218
void degenerate(DisjointBoxLayout &a_to, const SliceSpec &a_ss, bool a_maintainProcAssign=false) const
#define CH_TIME(name)
Definition: CH_Timer.H:82
Structure for passing component ranges in code.
Definition: Interval.H:23
virtual void localCopyTo(const Interval &srcComps, LevelData< T > &dest, const Interval &destComps) const
only works if source and dest have the same disjointboxlayout
Definition: LevelDataI.H:259
void allocateGhostVector(const DataFactory< T > &factory, const IntVect &ghost=IntVect::Zero)
Definition: BoxLayoutDataI.H:172
Data on a BoxLayout.
Definition: BoxLayoutData.H:97
virtual void define(const DisjointBoxLayout &dp, int comps, const IntVect &ghost=IntVect::Zero, const DataFactory< T > &a_factory=DefaultDataFactory< T >())
Definition: LevelDataI.H:93
BaseFab< T > & copy(const BaseFab< T > &a_src, const Box &a_srcbox, int a_srccomp, const Box &a_destbox, int a_destcomp, int a_numcomp)
Definition: BaseFabImplem.H:426
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
Definition: BoxLayoutDataI.H:237
virtual void copyTo(const Interval &srcComps, BoxLayoutData< T > &dest, const Interval &destComps) const
Definition: LevelDataI.H:221
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
Box get(const LayoutIndex &it) const
Definition: BoxLayout.H:716
const DisjointBoxLayout & getBoxes() const
Definition: LevelData.H:219
const IntVect & ghostVect() const
Definition: LevelData.H:186
static void Error(const char *const a_msg=m_nullString, int m_exitCode=CH_DEFAULT_ERROR_CODE)
Print out message to cerr and exit with the specified exit code.
virtual bool threadSafe() const
Definition: BoxLayoutData.H:49
static const IntVect Zero
Definition: IntVect.H:654
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
void makeItSoEnd(BoxLayoutData< T > &a_dest, const Interval &a_destComps, const LDOperator< T > &a_op=LDOperator< T >()) const
Definition: BoxLayoutDataI.H:318
int nComp() const
Definition: BoxLayoutData.H:306
const DisjointBoxLayout & disjointBoxLayout() const
Definition: LevelData.H:225
const T & operator[](const DataIndex &a_index) const
const accessor function
Definition: LayoutDataI.H:25
bool m_isdefined
Definition: BoxLayoutData.H:389
virtual ~LevelData()
Definition: LevelDataI.H:37
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
Definition: FArrayBox.H:45
Factory object to data members of a BoxLayoutData container.
Definition: BoxLayoutData.H:30
Box & grow(int i)
grow functions
Definition: Box.H:2247
bool isClosed() const
Definition: BoxLayout.H:729
Definition: BoxLayoutData.H:173
bool m_threadSafe
Definition: BoxLayoutData.H:388
virtual void define(const DisjointBoxLayout &a_level, const BoxLayout &a_dest, bool a_exchange=false, IntVect a_shift=IntVect::Zero)
virtual void exchangeEnd()
finish asynchronous exchange
Definition: LevelDataI.H:543
int direction
Definition: SliceSpec.H:48
virtual void exchangeNoOverlap(const Copier &copier)
Definition: LevelDataI.H:507
virtual void setExchangeCopier(const Copier &copier)
allows one to set the default copier for all exchanges going forward.
Definition: LevelDataI.H:517