11 #ifndef _LEVELDATAI_H_ 12 #define _LEVELDATAI_H_ 21 #include "NamespaceHeader.H" 47 : m_disjointBoxLayout(dp), m_ghost(ghost)
56 MayDay::Error(
"non-disjoint DisjointBoxLayout: LevelData<T>::LevelData(const DisjointBoxLayout& dp, int comps)");
64 this->
setVector(*
this, interval, interval);
71 const Copier& a_exchangeCopier,
77 define(dp, comps, a_exchangeCopier, ghost, a_factory);
93 CH_TIME(
"LevelData<T>::define(dbl,comps,ghost,factory)");
103 MayDay::Error(
"non-disjoint DisjointBoxLayout: LevelData<T>::define(const DisjointBoxLayout& dp,....)");
107 MayDay::Error(
"LevelData::LevelData(const BoxLayout& dp, int comps) comps<=0");
136 CH_TIME(
"LevelData<T>::define(dbl,comps,copier,ghost,factory)");
138 define(dp, comps, a_exchangeCopier, ghost, a_factory);
148 CH_TIME(
"LevelData<T>::define(LevelData<T>,factory)");
155 if (
this == &da)
return;
177 PR_TIME(
"Chombo::LevelData::define");
179 CH_TIME(
"LevelData<T>::define(LevelData<T>,comps,factory)");
191 MayDay::Error(
" LevelData<T>::define(const LevelData<T>& da, const Interval& comps) called with 'this'");
223 PR_TIME(
"Chombo::LevelData::copyTo");
232 PR_TIME(
"Chombo::LevelData::copyTo::local");
238 int nbox = it.
size();
239 #pragma omp parallel for if(this->m_threadSafe) 240 for (
int ibox = 0; ibox < nbox; ibox++)
242 dest[it[ibox]].copy(this->
box(it[ibox]),
245 this->
operator[](it[ibox]),
252 copyTo(srcComps, dest, destComps, copier);
261 PR_TIME(
"Chombo::LevelData::localCopyTo");
263 CH_TIME(
"LevelData::localCopyTo");
270 int nbox = it.
size();
271 #pragma omp parallel for if(this->m_threadSafe) 272 for (
int ibox = 0; ibox < nbox; ibox++)
274 Box srcBox = this->
box(it[ibox]);
275 Box dstBox = this->
box(it[ibox]);
280 dest[it[ibox]].copy(minBox,
283 this->
operator[](it[ibox]),
321 MayDay::Error(
"src == dest in copyTo function. Perhaps you want exchange ?");
328 int nbox = it.
size();
329 #pragma omp parallel for if(this->m_threadSafe) 330 for (
int ibox = 0; ibox < nbox; ibox++)
332 dest[it[ibox]].copy(this->
box(it[ibox]),
335 this->
operator[](it[ibox]),
342 copyTo(srcComps, dest, destComps, copier);
364 PR_TIME(
"Chombo::LevelData::copyTo");
375 this->
makeItSo(srcComps, *
this, dest, destComps, copier, a_op);
399 PR_TIME(
"Chombo::LevelData::copyTo");
409 this->
makeItSo(srcComps, *
this, dest, destComps, copier, a_op);
429 PR_TIME(
"Chombo::LevelData::exchange (exchange + copier)");
431 CH_TIME(
"LevelData::exchange (exchange + copier)");
441 PR_TIME(
"Chombo::LevelData::exchange (defining copier)");
443 CH_TIME(
"LevelData::exchange (defining copier)");
449 PR_TIME(
"Chombo::LevelData::exchange (actual exchange)");
451 CH_TIME(
"LevelData::exchange (actual exchange)");
480 PR_TIME(
"Chombo::LevelData::exchange");
490 this->
makeItSo(comps, *
this, *
this, comps, copier, a_op);
551 MayDay::Error(
"LevelData<T>::define called with BoxLayout input");
559 MayDay::Error(
"LevelData<T>::define called with BoxLayout input");
567 MayDay::Error(
"LevelData<T>::define called with BoxLayout input");
576 MayDay::Error(
"LevelData<T>::define called with BoxLayout input");
585 int nbox = it.
size();
586 #pragma omp parallel for 587 for (
int ibox = 0; ibox < nbox; ibox++)
600 int nbox = it.
size();
601 #pragma omp parallel for 602 for (
int ibox = 0; ibox < nbox; ibox++)
611 template<
class T>
void 634 template<
class T>
void 656 for (toDit.
begin(); toDit.
ok(); ++toDit)
668 Box intersectBox = toFAB.
box();
669 intersectBox &= fromFAB.
box();
671 toFAB.
copy(fromFAB, intersectBox);
680 if (!fromDit.
ok()) done =
true;
689 #include "NamespaceFooter.H" int m_comps
Definition: BoxLayoutData.H:403
bool isDefined() const
Definition: Copier.H:333
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:612
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:152
int begin() const
Definition: Interval.H:99
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:45
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:467
void degenerateLocalOnly(LevelData< T > &a_to, const SliceSpec &a_ss) const
version of degenerate which does strictly local copying
Definition: LevelDataI.H:635
Definition: EBInterface.H:45
virtual void exchangeBegin(const Copier &copier)
asynchronous exchange start. load and fire off messages.
Definition: LevelDataI.H:530
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:256
void allocateGhostVector(const DataFactory< T > &factory, const IntVect &ghost=IntVect::Zero)
Definition: BoxLayoutDataI.H:167
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:90
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:232
virtual void copyTo(const Interval &srcComps, BoxLayoutData< T > &dest, const Interval &destComps) const
Definition: LevelDataI.H:218
A BoxLayout that has a concept of disjointedness.
Definition: DisjointBoxLayout.H:30
Box get(const LayoutIndex &it) const
Definition: BoxLayout.H:741
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:658
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
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:405
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
void makeItSoEnd(const Interval &a_destComps, const LDOperator< T > &a_op=LDOperator< T >())
Definition: BoxLayoutDataI.H:335
Box & grow(int i)
grow functions
Definition: Box.H:2263
bool isClosed() const
Definition: BoxLayout.H:754
Definition: BoxLayoutData.H:173
bool m_threadSafe
Definition: BoxLayoutData.H:404
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:540
int direction
Definition: SliceSpec.H:48
virtual void exchangeNoOverlap(const Copier &copier)
Definition: LevelDataI.H:504
virtual void setExchangeCopier(const Copier &copier)
allows one to set the default copier for all exchanges going forward.
Definition: LevelDataI.H:514