Chombo + EB + MF  3.2
ParticleBCI.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 _PARTICLEBCI_H_
12 #define _PARTICLEBCI_H_
13 
14 #include "CH_Timer.H"
15 #include "NamespaceHeader.H"
16 
17 template <class P>
19  const RealVect& a_leftEdge,
20  const RealVect& a_rightEdge)
21 {
22 
23  CH_TIME("ParticleBC::enforcePeriodic");
24 
25  RealVect Lbox = a_rightEdge - a_leftEdge;
26  BoxLayout BL = a_particleData.getBoxes();
27  DataIterator dit(BL);
28 
29  // for each ListBox on this proc
30  for (dit.reset(); dit.ok(); ++dit)
31  {
32  // loop over all the particles in this ListBox
33  for (ListIterator<P> lit(a_particleData[dit()].listItems()); lit; ++lit)
34  {
35  // and apply periodic BCs...
36 
37  P& this_particle = lit();
38  RealVect& this_x = this_particle.position();
39 
40  for (int idir = 0; idir < CH_SPACEDIM; idir++)
41  {
42  if (this_x[idir] > a_rightEdge[idir])
43  {
44  this_x[idir] = this_x[idir] - Lbox[idir];
45  }
46 
47  else if (this_x[idir] < a_leftEdge[idir])
48  {
49  this_x[idir] = this_x[idir] + Lbox[idir];
50  }
51  }
52 
53  this_particle.setPosition(this_x);
54  }
55  }
56 }
57 
58 #include "NamespaceFooter.H"
59 
60 #endif // include guard
static void enforcePeriodic(ParticleData< P > &a_particleData, const RealVect &a_leftEdge, const RealVect &a_rightEdge)
Definition: ParticleBCI.H:18
#define CH_SPACEDIM
Definition: SPACE.H:51
A not-necessarily-disjoint collective of boxes.
Definition: BoxLayout.H:145
virtual bool ok() const
return true if this iterator is still in its Layout
Definition: LayoutIterator.H:117
Definition: DataIterator.H:190
void reset()
same as begin()
#define CH_TIME(name)
Definition: CH_Timer.H:82
Iterator over a List.
Definition: List.H:20
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
Definition: ParticleData.H:67