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