WarpX
ParticleBoundaryBuffer.H
Go to the documentation of this file.
1 /* Copyright 2021 Andrew Myers
2  *
3  * This file is part of WarpX.
4  *
5  * License: BSD-3-Clause-LBNL
6  */
7 #ifndef PARTICLEBOUNDARYBUFFER_H_
8 #define PARTICLEBOUNDARYBUFFER_H_
9 
13 
14 #include <vector>
15 
20 {
21 public:
23 
24  int numSpecies() const { return getSpeciesNames().size(); }
25 
26  const std::vector<std::string>& getSpeciesNames() const;
27 
29  const amrex::Vector<const amrex::MultiFab*>& distance_to_eb);
30 
31  void redistribute ();
32  void clearParticles ();
33  void clearParticles (int const i);
34 
35  void printNumParticles () const;
36 
37  int getNumParticlesInContainer(const std::string species_name, int boundary, bool local);
38 
39  PinnedMemoryParticleContainer& getParticleBuffer(const std::string species_name, int boundary);
40 
41  PinnedMemoryParticleContainer* getParticleBufferPointer(const std::string species_name, int boundary);
42 
43  static constexpr int numBoundaries () {
44  return AMREX_SPACEDIM*2
45 #ifdef AMREX_USE_EB
46  + 1
47 #endif
48  ;
49  }
50 
51  bool isDefinedForAnySpecies (int const ibuffer) {return (m_do_any_boundary[ibuffer] != 0);}
52 
53  std::string boundaryName (int const ibuffer) {return m_boundary_names[ibuffer];}
54 
55 private:
56  // over boundary, then number of species
57  std::vector<std::vector<PinnedMemoryParticleContainer> > m_particle_containers;
58 
59  // over boundary, then number of species
60  std::vector<std::vector<int> > m_do_boundary_buffer;
61 
62  // over boundary
63  std::vector<int> m_do_any_boundary;
64  std::vector<std::string> m_boundary_names;
65 
66  mutable std::vector<std::string> m_species_names;
67 };
68 
69 #endif /*PARTICLEBOUNDARYBUFFER_H_*/
Definition: MultiParticleContainer.H:65
Definition: NamedComponentParticleContainer.H:48
Definition: ParticleBoundaryBuffer.H:20
std::string boundaryName(int const ibuffer)
Definition: ParticleBoundaryBuffer.H:53
int numSpecies() const
Definition: ParticleBoundaryBuffer.H:24
const std::vector< std::string > & getSpeciesNames() const
Definition: ParticleBoundaryBuffer.cpp:189
ParticleBoundaryBuffer()
Definition: ParticleBoundaryBuffer.cpp:64
void redistribute()
Definition: ParticleBoundaryBuffer.cpp:174
void printNumParticles() const
Definition: ParticleBoundaryBuffer.cpp:144
std::vector< std::vector< PinnedMemoryParticleContainer > > m_particle_containers
Definition: ParticleBoundaryBuffer.H:57
int getNumParticlesInContainer(const std::string species_name, int boundary, bool local)
Definition: ParticleBoundaryBuffer.cpp:367
std::vector< std::string > m_species_names
Definition: ParticleBoundaryBuffer.H:66
PinnedMemoryParticleContainer & getParticleBuffer(const std::string species_name, int boundary)
Definition: ParticleBoundaryBuffer.cpp:378
bool isDefinedForAnySpecies(int const ibuffer)
Definition: ParticleBoundaryBuffer.H:51
std::vector< int > m_do_any_boundary
Definition: ParticleBoundaryBuffer.H:63
void clearParticles()
Definition: ParticleBoundaryBuffer.cpp:201
std::vector< std::vector< int > > m_do_boundary_buffer
Definition: ParticleBoundaryBuffer.H:60
static constexpr int numBoundaries()
Definition: ParticleBoundaryBuffer.H:43
std::vector< std::string > m_boundary_names
Definition: ParticleBoundaryBuffer.H:64
PinnedMemoryParticleContainer * getParticleBufferPointer(const std::string species_name, int boundary)
Definition: ParticleBoundaryBuffer.cpp:393
void gatherParticles(MultiParticleContainer &mypc, const amrex::Vector< const amrex::MultiFab * > &distance_to_eb)
Definition: ParticleBoundaryBuffer.cpp:217
i
Definition: check_interp_points_and_weights.py:174