Chombo + EB + MF  3.2
LevelDataI.H
Go to the documentation of this file.
1 #ifdef CH_LANG_CC
2 /*
3  * _______ __
4  * / ___/ / ___ __ _ / / ___
5  * / /__/ _ \/ _ \/ V \/ _ \/ _ \
6  * \___/_//_/\___/_/_/_/_.__/\___/
7  * Please refer to Copyright.txt, in Chombo's root directory.
8  */
9 #endif
10 
11 #ifndef _LEVELDATAI_H_
12 #define _LEVELDATAI_H_
13 
14 #include <cstdlib>
15 #include <algorithm>
16 using std::sort;
17 
18 #include "parstream.H"
19 #include "CH_Timer.H"
20 #include <float.h>
21 #include "NamespaceHeader.H"
22 
23 //
24 // LevelData<FluxBox> specializations
25 
26 template < > void LevelData<FluxBox>::degenerateLocalOnly( LevelData<FluxBox>& a_to, const SliceSpec& a_ss ) const;
27 
28 //-----------------------------------------------------------------------
29 template<class T>
31 {
32 }
33 //-----------------------------------------------------------------------
34 
35 //-----------------------------------------------------------------------
36 template<class T>
38 {
39  CH_TIME("~LevelData");
40 }
41 //-----------------------------------------------------------------------
42 
43 //-----------------------------------------------------------------------
44 template<class T>
45 LevelData<T>::LevelData(const DisjointBoxLayout& dp, int comps, const IntVect& ghost,
46  const DataFactory<T>& a_factory)
47  : m_disjointBoxLayout(dp), m_ghost(ghost)
48 {
49 
50  this->m_boxLayout = dp;
51  this->m_comps = comps;
52  this->m_isdefined = true;
53 
54  if (!dp.isClosed())
55  {
56  MayDay::Error("non-disjoint DisjointBoxLayout: LevelData<T>::LevelData(const DisjointBoxLayout& dp, int comps)");
57  }
58 
59  this->m_threadSafe = a_factory.threadSafe();
60  //this->m_threadSafe = false;
61 
62  Interval interval(0, comps-1);
63  this->allocateGhostVector(a_factory, ghost);
64  this->setVector(*this, interval, interval); // Does nothing.
65 }
66 
67 
68 //-----------------------------------------------------------------------
69 template<class T>
71  const Copier& a_exchangeCopier,
72  const IntVect& ghost,
73  const DataFactory<T>& a_factory)
74  : m_disjointBoxLayout(dp), m_ghost(ghost)
75 {
76 
77  define(dp, comps, a_exchangeCopier, ghost, a_factory);
78 
79 }
80 
81 //-----------------------------------------------------------------------
82 
83 // Since I need to thwart the user from invoking the
84 // 'define' methods that use a general BoxLayout, I cannot
85 // get at said functions myself now. Ha! So, I have to recode
86 // them here.
87 
88 //-----------------------------------------------------------------------
89 template<class T>
90 void LevelData<T>::define(const DisjointBoxLayout& dp, int comps, const IntVect& ghost,
91  const DataFactory<T> & a_factory)
92 {
93  CH_TIME("LevelData<T>::define(dbl,comps,ghost,factory)");
94  // clear exchange copier if it's already been defined
95  if (this->m_exchangeCopier.isDefined())
96  {
98  }
99 
100  this->m_isdefined = true;
101  if (!dp.isClosed())
102  {
103  MayDay::Error("non-disjoint DisjointBoxLayout: LevelData<T>::define(const DisjointBoxLayout& dp,....)");
104  }
105  if (comps<=0)
106  {
107  MayDay::Error("LevelData::LevelData(const BoxLayout& dp, int comps) comps<=0");
108  }
109  this->m_comps = comps;
110  this->m_boxLayout = dp;
111 
112  this->m_threadSafe = a_factory.threadSafe();
113  //this->m_threadSafe = false;
114 
115  m_disjointBoxLayout = dp;
116  m_ghost = ghost;
117  // don't define exchange copier until it's needed
118 
119  // Interval interval(0, comps-1);
120  this->allocateGhostVector(a_factory, ghost);
121  // this->setVector(*this, interval, interval);
122 }
123 
124 
125 // Since I need to thwart the user from invoking the
126 // 'define' methods that use a general BoxLayout, I cannot
127 // get at said functions myself now. Ha! So, I have to recode
128 // them here.
129 
130 //-----------------------------------------------------------------------
131 template<class T>
132 void LevelData<T>::define(const DisjointBoxLayout& dp, int comps,
133  const Copier& a_exchangeCopier, const IntVect& ghost,
134  const DataFactory<T> & a_factory)
135 {
136  CH_TIME("LevelData<T>::define(dbl,comps,copier,ghost,factory)");
137 
138  define(dp, comps, a_exchangeCopier, ghost, a_factory);
139 
140 }
141 
142 //-----------------------------------------------------------------------
143 
144 //-----------------------------------------------------------------------
145 template<class T>
146 void LevelData<T>::define(const LevelData<T>& da, const DataFactory<T> & a_factory)
147 {
148  CH_TIME("LevelData<T>::define(LevelData<T>,factory)");
149  // clear exchange copier if it's already been defined
150  if (this->m_exchangeCopier.isDefined() )
151  {
153  }
154  this->m_isdefined = true;
155  if (this == &da) return;
157  this->m_boxLayout = da.m_disjointBoxLayout;
158  this->m_comps = da.m_comps;
159  this->m_threadSafe = a_factory.threadSafe();
160  //this->m_threadSafe = false;
161 
162  m_ghost = da.m_ghost;
163 
165 
166  this->allocateGhostVector(a_factory, m_ghost);
167  da.copyTo(*this);
168 }
169 //-----------------------------------------------------------------------
170 
171 //-----------------------------------------------------------------------
172 template<class T>
173 void LevelData<T>::define(const LevelData<T>& da, const Interval& comps,
174  const DataFactory<T>& a_factory)
175 {
176 #ifdef USE_PROTO
177  PR_TIME("Chombo::LevelData::define");
178 #else
179  CH_TIME("LevelData<T>::define(LevelData<T>,comps,factory)");
180 #endif
181  // clear exchange copier if it's already been defined
182  if (this->m_exchangeCopier.isDefined() )
183  {
185  }
186  this->m_isdefined = true;
187  this->m_threadSafe = a_factory.threadSafe();
188  //this->m_threadSafe = false;
189  if (this == &da)
190  {
191  MayDay::Error(" LevelData<T>::define(const LevelData<T>& da, const Interval& comps) called with 'this'");
192  }
193  CH_assert(comps.size()>0);
194  // this line doesn't make any sense!
195  //CH_assert(comps.end()<=this->m_comps);
196  CH_assert(comps.begin()>=0);
197 
199  this->m_boxLayout = da.m_disjointBoxLayout;
200 
201  this->m_comps = comps.size();
202 
203  m_ghost = da.m_ghost;
204 
206 
207  Interval dest(0, this->m_comps-1);
208 
209  this->allocateGhostVector(a_factory, m_ghost);
210 
211  this->setVector(da, comps, dest);
212 
213 }
214 //-----------------------------------------------------------------------
215 //-----------------------------------------------------------------------
216 
217 template<class T>
218 void LevelData<T>::copyTo(const Interval& srcComps,
219  BoxLayoutData<T>& dest,
220  const Interval& destComps) const
221 {
222 #ifdef USE_PROTO
223  PR_TIME("Chombo::LevelData::copyTo");
224 #else
225  CH_TIME("copyTo");
226 #endif
227  if ((BoxLayoutData<T>*)this == &dest) return;
228 
229  if (this->boxLayout() == dest.boxLayout())
230  {
231 #ifdef USE_PROTO
232  PR_TIME("Chombo::LevelData::copyTo::local");
233 #else
234  CH_TIME("local copy");
235 #endif
236  // parallel direct copy here, no communication issues
237  DataIterator it = this->dataIterator();
238  int nbox = it.size();
239 #pragma omp parallel for if(this->m_threadSafe)
240  for (int ibox = 0; ibox < nbox; ibox++)
241  {
242  dest[it[ibox]].copy(this->box(it[ibox]),
243  destComps,
244  this->box(it[ibox]),
245  this->operator[](it[ibox]),
246  srcComps);
247  }
248  return;
249  }
250 
251  Copier copier(m_disjointBoxLayout, dest.boxLayout());
252  copyTo(srcComps, dest, destComps, copier);
253 }
254 
255 template<class T>
256 void LevelData<T>::localCopyTo(const Interval& srcComps,
257  LevelData<T>& dest,
258  const Interval& destComps) const
259 {
260 #ifdef USE_PROTO
261  PR_TIME("Chombo::LevelData::localCopyTo");
262 #else
263  CH_TIME("LevelData::localCopyTo");
264 #endif
265  if ((BoxLayoutData<T>*)this == &dest) return;
266 
267  if(this->disjointBoxLayout() == dest.disjointBoxLayout())
268  {
269  DataIterator it = this->dataIterator();
270  int nbox = it.size();
271 #pragma omp parallel for if(this->m_threadSafe)
272  for (int ibox = 0; ibox < nbox; ibox++)
273  {
274  Box srcBox = this->box(it[ibox]);
275  Box dstBox = this->box(it[ibox]);
276  srcBox.grow(this->ghostVect());
277  dstBox.grow(dest.ghostVect());
278  Box minBox = srcBox;
279  minBox &= dstBox;
280  dest[it[ibox]].copy(minBox,
281  destComps,
282  minBox,
283  this->operator[](it[ibox]),
284  srcComps);
285  }
286  }
287  else
288  {
289  MayDay::Error("localCopyTo only works with identical DBLs");
290  }
291 
292  return;
293 }
294 
295 template<class T>
297 {
298  CH_assert(this->nComp() == dest.nComp());
299  this->localCopyTo(this->interval(), dest, dest.interval());
300 }
301 
302 //-----------------------------------------------------------------------
303 
304 //-----------------------------------------------------------------------
305 template<class T>
307 {
308  CH_assert(this->nComp() == dest.nComp());
309  this->copyTo(this->interval(), dest, dest.interval());
310 }
311 //-----------------------------------------------------------------------
312 
313 //-----------------------------------------------------------------------
314 template<class T>
315 void LevelData<T>::copyTo(const Interval& srcComps,
316  LevelData<T>& dest,
317  const Interval& destComps) const
318 {
319  if (this == &dest)
320  {
321  MayDay::Error("src == dest in copyTo function. Perhaps you want exchange ?");
322  }
323 
324  if (this->boxLayout() == dest.boxLayout() && dest.ghostVect() == IntVect::Zero)
325  {
326  // parallel direct copy here, no communication issues
327  DataIterator it = this->dataIterator();
328  int nbox = it.size();
329 #pragma omp parallel for if(this->m_threadSafe)
330  for (int ibox = 0; ibox < nbox; ibox++)
331  {
332  dest[it[ibox]].copy(this->box(it[ibox]),
333  destComps,
334  this->box(it[ibox]),
335  this->operator[](it[ibox]),
336  srcComps);
337  }
338  return;
339  }
340 
341  Copier copier(m_disjointBoxLayout, dest.getBoxes(), dest.m_ghost);
342  copyTo(srcComps, dest, destComps, copier);
343 }
344 //-----------------------------------------------------------------------
345 
346 //-----------------------------------------------------------------------
347 template<class T>
349 {
350  CH_assert(this->nComp() == dest.nComp());
351  this->copyTo(this->interval(), dest, dest.interval());
352 }
353 //-----------------------------------------------------------------------
354 
355 //-----------------------------------------------------------------------
356 template<class T>
357 void LevelData<T>::copyTo(const Interval& srcComps,
358  BoxLayoutData<T>& dest,
359  const Interval& destComps,
360  const Copier& copier,
361  const LDOperator<T>& a_op) const
362 {
363 #ifdef USE_PROTO
364  PR_TIME("Chombo::LevelData::copyTo");
365 #else
366  CH_TIME("copyTo");
367 #endif
368 #ifdef CH_MPI
369  {
370 // CH_TIME("MPI_Barrier copyTo");
371 // MPI_Barrier(Chombo_MPI::comm);
372  }
373 #endif
374 
375  this->makeItSo(srcComps, *this, dest, destComps, copier, a_op);
376 }
377 //-----------------------------------------------------------------------
378 
379 //-----------------------------------------------------------------------
380 template<class T>
382  const Copier& copier,
383  const LDOperator<T>& a_op) const
384 {
385  CH_assert(this->nComp() == dest.nComp());
386  this->copyTo(this->interval(), dest, dest.interval(), copier, a_op);
387 }
388 //-----------------------------------------------------------------------
389 
390 //-----------------------------------------------------------------------
391 template<class T>
392 void LevelData<T>::copyTo(const Interval& srcComps,
393  LevelData<T>& dest,
394  const Interval& destComps,
395  const Copier& copier,
396  const LDOperator<T>& a_op) const
397 {
398 #ifdef USE_PROTO
399  PR_TIME("Chombo::LevelData::copyTo");
400 #else
401  CH_TIME("LevelData::copyTo");
402 #endif
403 #ifdef CH_MPI
404  {
405 // CH_TIME("MPI_Barrier copyTo");
406 // MPI_Barrier(Chombo_MPI::comm);
407  }
408 #endif
409  this->makeItSo(srcComps, *this, dest, destComps, copier, a_op);
410 }
411 //-----------------------------------------------------------------------
412 
413 //-----------------------------------------------------------------------
414 template<class T>
416  const Copier& copier,
417  const LDOperator<T>& a_op) const
418 {
419  CH_assert(this->nComp() == dest.nComp());
420  this->copyTo(this->interval(), dest, dest.interval(), copier, a_op);
421 }
422 //-----------------------------------------------------------------------
423 
424 //-----------------------------------------------------------------------
425 template<class T>
427 {
428 #ifdef USE_PROTO
429  PR_TIME("Chombo::LevelData::exchange (exchange + copier)");
430 #else
431  CH_TIME("LevelData::exchange (exchange + copier)");
432 #endif
433  // later on we can code this part as a direct algorithm
434  // by copying and pasting the code from the Copier::define code
435  // for now, just do the easy to debug approach.
436  if(m_ghost != IntVect::Zero)//no need for exchange copier if no ghost
437  {
439  {
440 #ifdef USE_PROTO
441  PR_TIME("Chombo::LevelData::exchange (defining copier)");
442 #else
443  CH_TIME("LevelData::exchange (defining copier)");
444 #endif
446  }
447  {
448 #ifdef USE_PROTO
449  PR_TIME("Chombo::LevelData::exchange (actual exchange)");
450 #else
451  CH_TIME("LevelData::exchange (actual exchange)");
452 #endif
453  exchange(comps, m_exchangeCopier);
454  }
455  }
456 
457  // if there aren't any ghost cells, there isn't really anything
458  // to do here (also, if m_ghost == Zero, m_exchangeCopier
459  // wasn't defined!
460  //if (m_ghost != IntVect::Zero)
461  //this->makeItSo(comps, *this, *this, comps, m_exchangeCopier);
462 }
463 //-----------------------------------------------------------------------
464 
465 //-----------------------------------------------------------------------
466 template<class T>
468 {
469  exchange(this->interval());
470 }
471 //-----------------------------------------------------------------------
472 
473 //-----------------------------------------------------------------------
474 template<class T>
476  const Copier& copier,
477  const LDOperator<T>& a_op)
478 {
479 #ifdef USE_PROTO
480  PR_TIME("Chombo::LevelData::exchange");
481 #else
482  CH_TIME("exchange");
483 #endif
484 #ifdef CH_MPI
485  {
486 // CH_TIME("MPI_Barrier exchange");
487 // MPI_Barrier(Chombo_MPI::comm);
488  }
489 #endif
490  this->makeItSo(comps, *this, *this, comps, copier, a_op);
491 }
492 //-----------------------------------------------------------------------
493 
494 //-----------------------------------------------------------------------
495 template<class T>
496 void LevelData<T>::exchange(const Copier& copier)
497 {
498  exchange(this->interval(), copier);
499 }
500 //-----------------------------------------------------------------------
501 
502 //-----------------------------------------------------------------------
503 template<class T>
505 {
506  CH_TIME("exchangeNoOverlap");
507  this->makeItSoBegin(this->interval(), *this, *this, this->interval(), copier);
508  this->makeItSoEnd(this->interval());
509  this->makeItSoLocalCopy(this->interval(), *this, *this, this->interval(), copier);
510 }
511 //-----------------------------------------------------------------------
512 
513 template<class T>
514 void LevelData<T>::setExchangeCopier(const Copier& a_exchangeCopier)
515 {
516 
518  {
520  }
521 
522  m_exchangeCopier = a_exchangeCopier;
523 
524 }
525 
526 
527 
528 //-----------------------------------------------------------------------
529 template<class T>
531 {
532  CH_TIME("exchangeBegin");
533  this->makeItSoBegin(this->interval(), *this, *this, this->interval(), copier);
534  this->makeItSoLocalCopy(this->interval(), *this, *this, this->interval(), copier);
535 }
536 //-----------------------------------------------------------------------
537 
538 //-----------------------------------------------------------------------
539 template<class T>
541 {
542  CH_TIME("exchangeEnd");
543  this->makeItSoEnd(this->interval());
544 }
545 //-----------------------------------------------------------------------
546 
547 //-----------------------------------------------------------------------
548 template<class T>
549 void LevelData<T>::define(const BoxLayout& dp, int comps, const DataFactory<T>& a_factory)
550 {
551  MayDay::Error("LevelData<T>::define called with BoxLayout input");
552 }
553 //-----------------------------------------------------------------------
554 
555 //-----------------------------------------------------------------------
556 template<class T>
558 {
559  MayDay::Error("LevelData<T>::define called with BoxLayout input");
560 }
561 //-----------------------------------------------------------------------
562 
563 //-----------------------------------------------------------------------
564 template<class T>
565 void LevelData<T>::define(const BoxLayoutData<T>& da, const DataFactory<T>& a_factory )
566 {
567  MayDay::Error("LevelData<T>::define called with BoxLayout input");
568 }
569 //-----------------------------------------------------------------------
570 
571 //-----------------------------------------------------------------------
572 template<class T>
573 void LevelData<T>::define(const BoxLayoutData<T>& da, const Interval& comps,
574  const DataFactory<T>& a_factory)
575 {
576  MayDay::Error("LevelData<T>::define called with BoxLayout input");
577 }
578 //-----------------------------------------------------------------------
579 
580 //-----------------------------------------------------------------------
581 template<class T>
582 void LevelData<T>::apply( void (*a_Function)(const Box& box, int comps, T& t) )
583 {
584  DataIterator it = this->dataIterator();
585  int nbox = it.size();
586 #pragma omp parallel for
587  for (int ibox = 0; ibox < nbox; ibox++)
588  {
589 
590  a_Function(m_disjointBoxLayout.get(it[ibox]), this->m_comps, *(this->m_vector[it[ibox].datInd()]));
591  }
592 }
593 //-----------------------------------------------------------------------
594 
595 //-----------------------------------------------------------------------
596 template<class T>
597 void LevelData<T>::apply( const ApplyFunctor & f )
598 {
599  DataIterator it = this->dataIterator();
600  int nbox = it.size();
601 #pragma omp parallel for
602  for (int ibox = 0; ibox < nbox; ibox++)
603  {
604  // unsigned int index = this->m_boxLayout.lindex(it());
605  f(m_disjointBoxLayout.get(it[ibox]), this->m_comps, *(this->m_vector[it[ibox].datInd()]));
606  }
607 }
608 //-----------------------------------------------------------------------
609 
610 //-----------------------------------------------------------------------
611 template<class T> void
613  const SliceSpec& a_sliceSpec ) const
614 {
615  DisjointBoxLayout toDBL;
616  m_disjointBoxLayout.degenerate( toDBL, a_sliceSpec );
617  IntVect toGhost;
618  for ( int i=0;i<CH_SPACEDIM;++i )
619  {
620  if ( i != a_sliceSpec.direction )
621  {
622  toGhost[i] = m_ghost[i];
623  } else
624  {
625  toGhost[i] = 0;
626  }
627  }
628  a_to.define( toDBL, this->nComp(), toGhost );
629  copyTo( a_to );
630 }
631 //-----------------------------------------------------------------------
632 
633 //-----------------------------------------------------------------------
634 template<class T> void
636  const SliceSpec& a_sliceSpec ) const
637 {
638  DisjointBoxLayout toDBL;
639  m_disjointBoxLayout.degenerate( toDBL, a_sliceSpec, true );
640  IntVect toGhost;
641  for ( int i=0;i<CH_SPACEDIM;++i )
642  {
643  if ( i != a_sliceSpec.direction )
644  {
645  toGhost[i] = m_ghost[i];
646  } else
647  {
648  toGhost[i] = 0;
649  }
650  }
651  a_to.define( toDBL, this->nComp(), toGhost );
652 
653  // manage copyTo ourselves to maintain locality
654  DataIterator fromDit = this->dataIterator();
655  DataIterator toDit = a_to.dataIterator();
656  for (toDit.begin(); toDit.ok(); ++toDit)
657  {
658  fromDit.begin();
659  bool done = false;
660  while (!done)
661  {
662  if (m_disjointBoxLayout[fromDit].contains(toDBL[toDit]))
663  {
664  // boxes intersect, do copy
665  FArrayBox& toFAB = a_to[toDit];
666  const FArrayBox& fromFAB = this->operator[](fromDit);
667  // note that we're including ghost cells here
668  Box intersectBox = toFAB.box();
669  intersectBox &= fromFAB.box();
670  // now do copy
671  toFAB.copy(fromFAB, intersectBox);
672  done = true;
673  } // end if we found an intersection
674  else
675  {
676  ++fromDit;
677  // probably want to check for lexigraphical sorting done-ness
678 
679  // are we done looping through fromBoxes?
680  if (!fromDit.ok()) done = true;
681  } // end if we didn't find a match
682  } // end while loop over fromBoxes
683 
684  } // end loop over toBoxes
685 
686 }
687 //-----------------------------------------------------------------------
688 
689 #include "NamespaceFooter.H"
690 #endif
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:717
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
virtual void clear()
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:730
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