Chombo + EB + MF  3.2
ParticleDataI.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  // ANAG, LBNL
12 
13 #ifndef _PARTICLEDATAI_H_
14 #define _PARTICLEDATAI_H_
15 
16 #include "MPI_util.H"
17 #include "NamespaceHeader.H"
18 
19 using std::vector;
20 using std::map;
21 using std::binary_function;
22 
23 //
24 // Implementation
25 //
26 
27 template <class P>
28 void collectValidParticles(List<P>& a_partValid,
29  ParticleData<P>& a_PD,
30  const LevelData<BaseFab<bool> >* a_mask,
31  const RealVect a_meshSpacing,
32  const int a_refRatio,
33  const bool a_flip,
34  const RealVect a_origin)
35 {
36  CH_TIMERS("collectValidParticles(List)");
37 
38  BoxLayout fromBL;
39  if (a_refRatio>0) refine (fromBL,a_PD.getBoxes(), a_refRatio);
40  else coarsen(fromBL,a_PD.getBoxes(),-a_refRatio);
41 
42  BoxLayoutData<BaseFab<bool> > valid(fromBL,1);
43  for (DataIterator di(fromBL); di.ok(); ++di)
44  {
45  valid[di].setVal(false);
46  }
47  a_mask->copyTo(valid);
48 
49  for (DataIterator di(fromBL); di.ok(); ++di)
50  {
51  for (ListIterator<P> li (a_PD[di].listItems()); li.ok(); )
52  {
53  const RealVect x=li().position();
54  const IntVect iv(D_DECL6((int)floor((x[0] - a_origin[0])/a_meshSpacing[0]),
55  (int)floor((x[1] - a_origin[1])/a_meshSpacing[1]),
56  (int)floor((x[2] - a_origin[2])/a_meshSpacing[2]),
57  (int)floor((x[3] - a_origin[3])/a_meshSpacing[3]),
58  (int)floor((x[4] - a_origin[4])/a_meshSpacing[4]),
59  (int)floor((x[5] - a_origin[5])/a_meshSpacing[5])));
60 
61  if (valid[di](iv) ^ a_flip) a_partValid.transfer(li);
62  else ++li;
63  }
64  }
65 }
66 
67 template <class P>
69  ParticleData<P>& a_PD,
70  const LevelData<BaseFab<bool> >* a_mask,
71  const RealVect a_meshSpacing,
72  const int a_refRatio,
73  const bool a_flip,
74  const RealVect a_origin)
75 {
76  CH_TIMERS("collectValidParticles(ParticleData)");
77 
78  BoxLayout fromBL;
79  if (a_refRatio>0) refine (fromBL,a_PD.getBoxes(), a_refRatio);
80  else coarsen(fromBL,a_PD.getBoxes(),-a_refRatio);
81 
82  BoxLayoutData<BaseFab<bool> > valid(fromBL,1);
83  for (DataIterator di(fromBL); di.ok(); ++di)
84  {
85  valid[di].setVal(false);
86  }
87  a_mask->copyTo(valid);
88 
89  for (DataIterator di(fromBL); di.ok(); ++di)
90  {
91  for (ListIterator<P> li (a_PD[di].listItems()); li.ok(); )
92  {
93  const RealVect x=li().position();
94  const IntVect iv(D_DECL6((int)floor((x[0] - a_origin[0])/a_meshSpacing[0]),
95  (int)floor((x[1] - a_origin[1])/a_meshSpacing[1]),
96  (int)floor((x[2] - a_origin[2])/a_meshSpacing[2]),
97  (int)floor((x[3] - a_origin[3])/a_meshSpacing[3]),
98  (int)floor((x[4] - a_origin[4])/a_meshSpacing[4]),
99  (int)floor((x[5] - a_origin[5])/a_meshSpacing[5])));
100 
101  if (valid[di](iv) ^ a_flip)
102  a_PDValid[di].listItems().transfer(li);
103  else
104  ++li;
105  }
106  }
107 }
108 
109 inline void myswap(pair<const IntVect,boxids>& aa, pair<const IntVect,boxids>& bb)
110 {
111  pair<IntVect,boxids> a=(pair<IntVect,boxids>)aa;
112  pair<IntVect,boxids> b=(pair<IntVect,boxids>)bb;
113  pair<IntVect,boxids> t=make_pair(b.first,b.second);
114  a.first=b.first;
115  a.second=b.second;
116 
117  b.first=t.first;
118  b.second=t.second;
119 }
120 
121 template <class ForwardIterator>
122  void myrotate ( ForwardIterator first, ForwardIterator middle,
123  ForwardIterator last )
124 {
125  ForwardIterator next = middle;
126  while (first!=next)
127  {
128  myswap (*first++,*next++);
129  if (next==last) next=middle;
130  else if (first == middle) middle=next;
131  }
132 }
133 
134 typedef multimap<IntVect, boxids>::iterator RmIt;
135 
136 template <class P>
137 class CompCounts : public binary_function<pair<IntVect,boxids>,
138  pair<IntVect,boxids>,bool>
139 {
140 public:
141  // constructor
142  explicit CompCounts(vector<map<unsigned,List<P> > >& a_pp)
143  : pp(a_pp) {}
144 
145  bool operator() (const pair<const IntVect,boxids>& a,
146  const pair<const IntVect,boxids>& b) const
147  {
148  return (pp[a.second.pid][a.second.idx].length() <
149  pp[b.second.pid][b.second.idx].length());
150  }
151 
152 protected:
153  vector<map<unsigned, List<P> > >& pp;
154 };
155 
156 template <class P>
158  :
159  LayoutData<ListBox<P> >()
160 {
161  m_isDefined = false;
162 }
163 
164 template <class P>
166  const ProblemDomain& a_domain,
167  const int& a_fixedBoxSize,
168  const RealVect& a_meshSpacing,
169  const RealVect& a_origin)
170 {
171  define(a_dp, a_domain, a_fixedBoxSize, a_meshSpacing, a_origin);
172 }
173 
174 template <class P>
176  const ProblemDomain& a_domain,
177  const int& a_fixedBoxSize,
178  const RealVect& a_meshSpacing,
179  const RealVect& a_origin)
180 {
182  m_physDomain = a_domain;
183  m_fixedBoxSize = a_fixedBoxSize;
184  m_meshSpacing = a_meshSpacing;
185  m_origin = a_origin;
187  allocateVector();
188  m_isDefined = true;
189 }
190 
191 
192 template <class P>
194 {
196 }
197 
198 template <class P>
200 {
201  if (m_isDefined)
202  {
203  for (DataIterator di=this->dataIterator(); di.ok(); ++di)
204  {
205  (*this)[di].listItems().clear();
206  }
207  m_outcast.clear();
208  }
209 }
210 
211 template <class P>
213 {
214  if (!m_isDefined) return 0;
215  else
216  {
217  size_t numParticles = 0;
218  for (DataIterator di=this->dataIterator(); di.ok(); ++di)
219  {
220  numParticles += (*this)[di].numItems();
221  }
222  numParticles +=m_outcast.length();
223 
224  return numParticles;
225  }
226 }
227 
228 template <class P>
230 {
231  if (!m_isDefined) return 0;
232  else
233  {
234  size_t countLocal;
235  countLocal = numParticlesLocal();
236 
237  // gather all countLocals onto process 0
238  int srcProc = 0;
239  Vector<size_t> allCounts(numProc());
240  gather(allCounts, countLocal, srcProc);
241 
242  size_t count = 0;
243  if(procID() == srcProc)
244  {
245  for(int ivec = 0; ivec < numProc(); ivec++)
246  {
247  count += allCounts[ivec];
248  }
249  }
250 
251  // broadcast right answer to all procs
252  broadcast(count, srcProc);
253  return count;
254  }
255 }
256 
257 template <class P>
259 {
260  if (!m_isDefined) return 0;
261  else
262  {
263  size_t numValid = 0;
264  for (DataIterator di=this->dataIterator(); di.ok(); ++di)
265  {
266  numValid += (*this)[di].numItems();
267  }
268  return numValid;
269  }
270 }
271 
272 template <class P>
274 {
275  if (!m_isDefined) return 0;
276  else
277  {
278  size_t countLocal;
279  countLocal = numValidLocal();
280 
281  // gather all countLocals onto process 0
282  int srcProc = 0;
283  Vector<size_t> allCounts(numProc());
284  gather(allCounts, countLocal, srcProc);
285 
286  size_t count = 0;
287  if(procID() == srcProc)
288  {
289  for(int ivec = 0; ivec < numProc(); ivec++)
290  {
291  count += allCounts[ivec];
292  }
293  }
294 
295  // broadcast right answer to all procs
296  broadcast(count, srcProc);
297  return count;
298  }
299 }
300 
301 template <class P>
303 {
304  if (!m_isDefined) return 0;
305  else
306  {
307  size_t numOutcast = m_outcast.length();
308  return numOutcast;
309  }
310 }
311 
312 template <class P>
314 {
315  if (!m_isDefined) return 0;
316  else
317  {
318  size_t countLocal;
319  countLocal = numOutcastLocal();
320 
321  // gather all countLocals onto process 0
322  int srcProc = 0;
323  Vector<size_t> allCounts(numProc());
324  gather(allCounts, countLocal, srcProc);
325 
326  size_t count = 0;
327  if(procID() == srcProc)
328  {
329  for(int ivec = 0; ivec < numProc(); ivec++)
330  {
331  count += allCounts[ivec];
332  }
333  }
334 
335  // broadcast right answer to all procs
336  broadcast(count, srcProc);
337  return count;
338  }
339 }
340 
341 template <class P>
343 {
344  return m_outcast;
345 }
346 
347 template <class P>
349 {
350  return m_outcast.isEmpty();
351 }
352 
353 template <class P>
355 {
356  return m_physDomain;
357 }
358 
359 template <class P>
361 {
362  return m_meshSpacing;
363 }
364 
365 template <class P>
367 {
368  return m_origin;
369 }
370 
371 template <class P>
373 {
374  return m_fixedBoxSize;
375 }
376 
377 template <class P>
379 {
380  if (this->m_callDelete == true)
381  {
382  for (unsigned int i=0; i<this->m_vector.size(); ++i)
383  {
384  delete this->m_vector[i];
385  this->m_vector[i] = NULL;
386  }
387  }
388 
390 
391  DataIterator it(this->dataIterator()); int nbox=it.size();
392  this->m_vector.resize(it.size(), NULL);
393  for(int i=0; i<nbox; i++)
394  {
395  unsigned int index = it[i].datInd();
396  Box abox = this->box(it[i]);
397  this->m_vector[index] = m_factory.create(abox, 1, it[i]);
398  if (this->m_vector[index] == NULL)
399  {
400  MayDay::Error("OutOfMemory in ParticleData::Vector");
401  }
402  }
403 }
404 
405 template <class P>
407 {
408  BoxLayout grids = getBoxes();
409  for (DataIterator dit(grids); dit.ok(); ++dit)
410  {
411  (*this)[dit].getInvalidDestructive(m_outcast,
412  grids[dit]);
413  }
414 }
415 
416 template <class P>
418 {
419  CH_TIMERS("ParticleData::remapOutcast"); // barrier before this
420 
421  // this proc id
422  const unsigned myPID = procID();
423 
424  // storage for particles to be delivered to each box/proc
425  vector<map<unsigned, List<P> > > pp(numProc());
426  CompCounts<P> compCounts(pp);
427 
428  BoxLayout grids = getBoxes();
429  List<P>& p = m_outcast;
430 
431  if (!p.isEmpty())
432  {
433  // pseudo grid spacing
435  set<IntVect,CompIntVect> bivs;
436  map<IntVect,unsigned,CompIntVect> mil;
437  multimap<IntVect,boxids,CompIntVect> mip;
438  for (LayoutIterator li = grids.layoutIterator(); li.ok(); ++li)
439  {
440  // shrink box to get valid region
441  const Box sbox = coarsen(grids[li],
443  const IntVect biv=sbox.smallEnd();
444 #ifdef CH_MPI
445  const unsigned pid=grids.procID(li());
446  const unsigned idx=grids.index(li());
447  if (pid==myPID)
448  {
449  mil[biv] = idx;
450  }
451  else
452  {
453  mip.insert(pair<IntVect,boxids>(biv,boxids(idx,pid)));
454  }
455  bivs.insert(biv);
456 #else
457  mil[biv] = grids.index(li());
458 #endif
459  }
460 #ifdef CH_MPI
461  // rotate
462  {
463  set<IntVect,CompIntVect>::iterator it;
464  for ( it=bivs.begin() ; it != bivs.end(); ++it )
465  {
466  const int count=mip.count(*it);
467  if (count>1)
468  {
469  unsigned midn= myPID%count;
470  pair<RmIt,RmIt> rit=mip.equal_range(*it);
471  RmIt mid=rit.first;
472  while (midn-->0) mid++;
473  myrotate(rit.first,mid,rit.second);
474  }
475  }
476  }
477 #endif
478  // map particles to local boxes
479  map<IntVect,unsigned,CompIntVect>::iterator lit=mil.begin();
480  // map particles to pid-boxes
481  map<IntVect,boxids,CompIntVect>::iterator pit;
482 
483  pair<RmIt,RmIt> rit=mip.equal_range(mip.begin()->first);
484 
485  for (ListIterator<P> pi(p); pi.ok(); )
486  {
487  const IntVect ip=locateBin(pi().position(), dx, m_origin);
488  if (ip==lit->first)
489  {
490  pp[myPID][lit->second].transfer(pi);
491  }
492  else
493  {
494  lit=mil.find(ip);
495  if (lit!=mil.end())
496  {
497  pp[myPID][lit->second].transfer(pi);
498  }
499 #ifdef CH_MPI
500  else if (ip==rit.first->first)
501  {
502  pit = min_element(rit.first,rit.second,compCounts);
503  pp[pit->second.pid][pit->second.idx].transfer(pi);
504  lit=mil.begin();
505  }
506  else
507  {
508  if (mip.count(ip)>0)
509  {
510  rit=mip.equal_range(ip);
511  pit= min_element(rit.first,rit.second,compCounts);
512  pp[pit->second.pid][pit->second.idx].transfer(pi);
513  lit=mil.begin();
514  }
515  else ++pi;
516  }
517 #else
518  else ++pi;
519 #endif
520  }
521  }
522  }
523 
524  // collect local mapping
525  map<unsigned,List<P> > lp;
526  typename map<unsigned,List<P> >::iterator mi;
527  for (mi=pp[myPID].begin(); mi!=pp[myPID].end(); ++mi)
528  {
529  lp[mi->first].catenate(mi->second);
530  }
531  pp[myPID].clear();
532 
533 #ifdef CH_MPI
534  // distribute particles
535  mpi_scatter_part(lp,pp);
536 #endif
537 
538  // finally assign particles to boxes
539  for (DataIterator di(grids); di.ok(); ++di)
540  {
541  unsigned idx = grids.index(di());
542  if (lp.find(idx) != lp.end())
543  {
544  (*this)[di].listItems().catenate(lp[idx]);
545  }
546  }
547 }
548 
549 template <class P>
551 {
552  Box domainBox = m_physDomain.domainBox();
553  Box cbox = coarsen(domainBox, m_fixedBoxSize);
554  IntVect lo = cbox.smallEnd();
555  IntVect hi = cbox.bigEnd();
556  IntVect dim = hi - lo + 1;
557  IntVect new_index = a_index;
558 
559  for (int d = 0; d < CH_SPACEDIM; d++)
560  {
561  if (m_physDomain.isPeriodic())
562  {
563 
564  if (a_index[d] < lo[d])
565  {
566  new_index[d] += dim[d];
567  }
568 
569  if (a_index[d] > hi[d])
570  {
571  new_index[d] -= dim[d];
572  }
573  }
574  }
575  return new_index;
576 }
577 
578 template <class P>
579 void ParticleData<P>::fillGhosts(ParticleData<P>& a_particlesWithGhosts,
580  const int a_numGhost) const
581 {
582  CH_TIMERS("ParticleData::fillGhosts");
583  BoxLayout grids = getBoxes();
584  BoxLayout ghostGrids = a_particlesWithGhosts.getBoxes();
585 
586  const Box& domainBox = m_physDomain.domainBox();
587  IntVect domLo = domainBox.smallEnd();
588  IntVect domHi = domainBox.bigEnd();
589  RealVect domLE = ((RealVect) domLo) * m_meshSpacing + m_origin;
590  RealVect domRE = ((RealVect) domHi + IntVect::Unit) * m_meshSpacing + m_origin;
591  RealVect domainWidth = domRE - domLE;
592 
593  // Because we are dealing with fixed size BoxLayouts, each box has a unique IntVect index.
594  // Here, we construct a mapping between those IntVect indices, the integer indices, and the
595  // process numbers.
596  map<IntVect, boxids, CompIntVect> IntVectToBoxIDMap;
597  for (LayoutIterator lit = grids.layoutIterator(); lit.ok(); ++lit)
598  {
599  const Box sbox = coarsen(grids[lit],
601 
602  IntVectToBoxIDMap[sbox.smallEnd()].idx = grids.index(lit());
603  IntVectToBoxIDMap[sbox.smallEnd()].pid = grids.procID(lit());
604  }
605 
606  // define and initialize an iterator over that map
607  map<IntVect, boxids, CompIntVect>::iterator IntVectToBoxIDIterator;
608  IntVectToBoxIDIterator = IntVectToBoxIDMap.begin();
609 
610  // each proc will store the ghost particle lists that it needs to send to each other proc.
611  vector<map<unsigned, List<P> > > ghostsToSend(numProc());
612 
613  for (DataIterator dit = grids.dataIterator(); dit.ok(); ++dit)
614  {
615  const Box& thisBox = grids[dit];
616  const ListBox<P>& thisListBox = (*this)[dit];
617  unsigned thisIndex = grids.index(dit());
618 
619  // theseGhosts stores the particles that will need to be copied and sent elsewhere
620  List<P> theseGhosts;
621  thisListBox.getInvalid(theseGhosts, grow(thisBox, -a_numGhost));
622  const RealVect boxSpacing = m_meshSpacing*(Real)m_fixedBoxSize;
623 
624  // keep track of where we are sending each ghost to avoid duplication
625  vector<unsigned> alreadySentTo;
626 
627  // For each ghost particle, we shift its position in each direction
628  // to figure out where it should go.
629  for (ListIterator<P> pi(theseGhosts); pi.ok(); ++pi)
630  {
631  alreadySentTo.clear();
632 
633  D_TERM6( for (int i = -1; i < 2; i++) {,
634  for (int j = -1; j < 2; j++) {,
635  for (int k = -1; k < 2; k++) {,
636  for (int l = -1; l < 2; l++) {,
637  for (int m = -1; m < 2; m++) {,
638  for (int n = -1; n < 2; n++) {)
639 
640  IntVect offset(D_DECL6(i, j, k, l, m, n));
641  RealVect shift = m_meshSpacing * a_numGhost * offset;
642  RealVect shiftedPosition = pi().position() + shift;
643 
644  IntVect srcIntVectIndex;
645  srcIntVectIndex = locateBin(pi().position(),
646  boxSpacing,
647  m_origin);
648 
649  IntVect destIntVectIndex;
650  destIntVectIndex = locateBin(shiftedPosition,
651  boxSpacing,
652  m_origin);
653 
654  bool doSend = false;
655  if (destIntVectIndex != srcIntVectIndex)
656  {
657  doSend = true;
658  }
659 
660  IntVect periodicIntVectIndex;
661  periodicIntVectIndex = enforcePeriodic(destIntVectIndex);
662 
663  IntVectToBoxIDIterator = IntVectToBoxIDMap.find(periodicIntVectIndex);
664  unsigned destPID = IntVectToBoxIDIterator->second.pid;
665  unsigned destBoxID = IntVectToBoxIDIterator->second.idx;
666 
667  // do not send the same particle to given box more than once
668  for (unsigned id=0; id < alreadySentTo.size(); id++)
669  {
670  if (destBoxID == alreadySentTo[id])
671  {
672  doSend = false;
673  }
674  }
675 
676  if (doSend)
677  {
678  alreadySentTo.push_back(destBoxID);
679  P p = pi();
680 
681  // if the particle is being shipped across the domain due to
682  // periodic boundary conditions, we shift its position here
683  // so that a naive distance calculation between the particle
684  // and a point on its box will return the *shortest* distance
685  // between them.
686  if (periodicIntVectIndex != destIntVectIndex)
687  {
688  RealVect x = pi().position();
689  for (int idim = 0; idim < SpaceDim; idim++)
690  {
691  if (periodicIntVectIndex[idim] < destIntVectIndex[idim]) {
692  x[idim] -= domainWidth[idim];
693  }
694  if (periodicIntVectIndex[idim] > destIntVectIndex[idim]) {
695  x[idim] += domainWidth[idim];
696  }
697  }
698  p.setPosition(x);
699  }
700 
701  ghostsToSend[destPID][destBoxID].add(p);
702  }
703  D_TERM6( }, }, }, }, }, })
704  }
705  }
706 
707  // after communication, localGhosts will have the ghost particles that belong on each proc
708  // for particles going to local boxes, we perform this move here
709  unsigned myPID = procID();
710  map<unsigned, List<P> > localGhosts;
711  typename map<unsigned, List<P> >::iterator ghostMapIterator;
712  for (ghostMapIterator = ghostsToSend[myPID].begin(); ghostMapIterator != ghostsToSend[myPID].end(); ++ghostMapIterator)
713  {
714  unsigned myBoxID = ghostMapIterator->first;
715  List<P>& myGhosts = ghostMapIterator->second;
716  localGhosts[myBoxID].catenate(myGhosts);
717  }
718  ghostsToSend[myPID].clear();
719 
720 #ifdef CH_MPI
721  // distribute particles
722  mpi_scatter_part(localGhosts, ghostsToSend);
723 #endif
724 
725  // put the particles, together with Ghosts, in a_particlesWithGhosts
726  for (DataIterator dit(grids); dit.ok(); ++dit)
727  {
728  unsigned idx = grids.index(dit());
729  if (localGhosts.find(idx) != localGhosts.end())
730  {
731  a_particlesWithGhosts[dit].listItems().join((*this)[dit].listItems());
732  a_particlesWithGhosts[dit].listItems().catenate(localGhosts[idx]);
733  }
734  }
735 }
736 
737 template <class P>
738 bool ParticleData<P>::isDefined() const
739 {
740  return m_isDefined;
741 }
742 
743 #include "NamespaceFooter.H"
744 
745 #endif
#define D_DECL6(a, b, c, d, e, f)
Definition: CHArray.H:39
void myrotate(ForwardIterator first, ForwardIterator middle, ForwardIterator last)
Definition: ParticleDataI.H:122
void catenate(List< T > &src)
Appends a copy of all items in List<T> src to this List<T>.
Definition: ListImplem.H:211
multimap< IntVect, boxids >::iterator RmIt
Definition: ParticleDataI.H:134
void fillGhosts(ParticleData< P > &a_particlesWithGhosts, const int a_numGhost) const
Definition: ParticleDataI.H:579
#define CH_TIMERS(name)
Definition: CH_Timer.H:133
virtual ListBox< T > * create(const Box &a_box, int a_numComps, const DataIndex &a_datInd) const
Factory function. Note that both a_numComps and a_dit are ignored.
Definition: ListBoxFactoryI.H:45
IntVect locateBin(const RealVect a_x, const RealVect a_dx, const RealVect a_origin)
compute the cell index containing the physical position of the item
Definition: ParticleData.H:47
Definition: ParticleDataI.H:137
bool m_callDelete
Definition: LayoutData.H:131
#define D_TERM6(a, b, c, d, e, f)
Definition: CHArray.H:40
#define CH_SPACEDIM
Definition: SPACE.H:51
size_t numValid() const
Definition: ParticleDataI.H:273
Box refine(const Box &b, const IntVect &refinement_ratio)
A class to facilitate interaction with physical boundary conditions.
Definition: ProblemDomain.H:141
Vector< ListBox< P > *> m_vector
Definition: LayoutData.H:124
Definition: ListBox.H:31
void transfer(ListIterator< T > &lit)
Transfer the object pointed to by lit from the List<T> lit is associated with to this one...
Definition: ListImplem.H:317
const ProblemDomain & physDomain() const
Get the physical domain associated with this ParticleData.
Definition: ParticleDataI.H:354
void gatherOutcast()
Definition: ParticleDataI.H:406
A not-necessarily-disjoint collective of boxes.
Definition: BoxLayout.H:145
Data that maintains a one-to-one mapping of T to the boxes in a BoxLayout.
Definition: BoxLayout.H:26
void clear()
Removes all the items from all the boxes in the container.
Definition: ParticleDataI.H:199
void clear()
Removes all objects from the List<T>.
Definition: ListImplem.H:263
const BoxLayout & boxLayout() const
Definition: LayoutData.H:107
DataIterator dataIterator() const
Definition: LayoutDataI.H:78
size_t numOutcastLocal() const
Return the number of particles in the outcast list.
Definition: ParticleDataI.H:302
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
void remapOutcast()
Definition: ParticleDataI.H:417
Definition: DataIterator.H:190
IntVect enforcePeriodic(const IntVect &a_index) const
Definition: ParticleDataI.H:550
virtual bool callDelete() const
Definition: BoxLayoutData.H:43
bool operator()(const pair< const IntVect, boxids > &a, const pair< const IntVect, boxids > &b) const
Definition: ParticleDataI.H:145
unsigned int numProc()
number of parallel processes
An Iterator based on a BoxLayout object.
Definition: LayoutIterator.H:35
const int SpaceDim
Definition: SPACE.H:38
void resize(unsigned int isize)
Definition: Vector.H:346
IndexTM< T, N > coarsen(const IndexTM< T, N > &a_p, T a_s)
Definition: IndexTMI.H:430
ProblemDomain m_physDomain
Definition: ParticleData.H:187
void gather(Vector< T > &a_outVec, const T &a_input, int a_dest)
Definition: SPMDI.H:197
bool ok() const
Return true if the iterator is not past the end of the list.
Definition: List.H:465
const RealVect & meshSpacing() const
Get the mesh spacing associated with this ParticleData,.
Definition: ParticleDataI.H:360
const IntVect & bigEnd() const
Definition: Box.H:1784
unsigned int index(const LayoutIndex &index) const
Definition: BoxLayout.H:748
int size() const
Definition: DataIterator.H:218
RealVect m_origin
Definition: ParticleData.H:189
static const IntVect Unit
Definition: IntVect.H:663
bool m_isDefined
Definition: ParticleData.H:192
new code
Definition: BoxLayoutData.H:170
bool isClosed() const
Is this ParticleData.
Definition: ParticleDataI.H:348
Iterator over a List.
Definition: List.H:20
const IntVect & smallEnd() const
{ Accessors}
Definition: Box.H:1770
Data on a BoxLayout.
Definition: BoxLayoutData.H:97
double Real
Definition: REAL.H:33
vector< map< unsigned, List< P > > > & pp
Definition: ParticleDataI.H:153
void myswap(pair< const IntVect, boxids > &aa, pair< const IntVect, boxids > &bb)
Definition: ParticleDataI.H:109
Box grow(const Box &b, int i)
Definition: Box.H:2277
List< P > m_outcast
Definition: ParticleData.H:186
CompCounts(vector< map< unsigned, List< P > > > &a_pp)
Definition: ParticleDataI.H:142
bool isPeriodic(int a_dir) const
Returns true if BC is periodic in direction a_dir.
Definition: ProblemDomain.H:894
size_t size() const
Definition: Vector.H:192
size_t numOutcast() const
Definition: ParticleDataI.H:313
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.
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
const BoxLayout & getBoxes() const
Get the BoxLayout on which this ParticleData.
Definition: ParticleDataI.H:193
void collectValidParticles(List< P > &a_partValid, ParticleData< P > &a_PD, const LevelData< BaseFab< bool > > *a_mask, const RealVect a_meshSpacing, const int a_refRatio, const bool a_flip, const RealVect a_origin)
Definition: ParticleDataI.H:28
size_t numParticlesLocal() const
Return the number of particles in the container, outcast and valid.
Definition: ParticleDataI.H:212
ParticleData()
Weak Constructor.
Definition: ParticleDataI.H:157
int length() const
Returns the number of objects in the List<T>.
Definition: ListImplem.H:56
RealVect m_meshSpacing
Definition: ParticleData.H:188
Definition: ParticleData.H:26
void define(const BoxLayout &a_dp, const ProblemDomain &a_domain, const int &a_fixedBoxSize, const RealVect &a_meshSpacing, const RealVect &a_origin)
Define function. Same as the full constructor.
Definition: ParticleDataI.H:175
void allocateVector()
Definition: ParticleDataI.H:378
int m_fixedBoxSize
Definition: ParticleData.H:190
size_t numValidLocal() const
Return the number of valid particles in the container, not counting outcasts.
Definition: ParticleDataI.H:258
size_t numParticles() const
Definition: ParticleDataI.H:229
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
List< P > & outcast()
Definition: ParticleDataI.H:342
const RealVect & origin() const
Get the origin of the coordinate system.
Definition: ParticleDataI.H:366
bool isEmpty() const
Returns true if the List<T> is empty.
Definition: List.H:619
void broadcast(T &a_inAndOut, int a_src)
broadcast to every process
Definition: SPMDI.H:207
const Box & domainBox() const
Returns the logical computational domain.
Definition: ProblemDomain.H:887
LayoutIterator layoutIterator() const
Iterator that processes through ALL the boxes in a BoxLayout.
virtual void getInvalid(List< T > &a_list, const Box &a_valid) const
Definition: ListBoxI.H:189
DataIterator dataIterator() const
Parallel iterator.
bool isDefined() const
int dim
Definition: EBInterface.H:146
int procID()
local process ID
const int & fixedBoxSize() const
Get the fixed Box size.
Definition: ParticleDataI.H:372
Definition: ParticleData.H:67
ListBoxFactory< P > m_factory
Definition: ParticleData.H:191
unsigned int procID(const LayoutIndex &a_index) const
Definition: BoxLayout.H:760
void define(const RealVect &a_meshSpacing, const RealVect &a_origin)
Use these parameters for all manufactured ListBox instances.
Definition: ListBoxFactoryI.H:36