WarpX
Loading...
Searching...
No Matches
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 WARPX_PARTICLEBOUNDARYBUFFER_H_
8#define WARPX_PARTICLEBOUNDARYBUFFER_H_
9
12#include "Utils/export.H"
13
15
16#include <vector>
17
18
22class WARPX_EXPORT ParticleBoundaryBuffer
23{
24public:
26
28
32 ParticleBoundaryBuffer& operator= ( const ParticleBoundaryBuffer & ) = delete;
33
38
39 int numSpecies() const { return static_cast<int>(getSpeciesNames().size()); }
40
41 const std::vector<std::string>& getSpeciesNames() const;
42
43 void gatherParticlesFromDomainBoundaries (MultiParticleContainer& mypc, amrex::Real cur_time);
44 void gatherParticlesFromEmbeddedBoundaries (
46 amrex::Real cur_time
47 );
48
49 void redistribute ();
50 void clearParticles ();
51 void clearParticles (int i);
52
53 void printNumParticles () const;
54
55 int getNumParticlesInContainer(const std::string& species_name, int boundary, bool local);
56
57 WarpXParticleContainer::Base& getParticleBuffer(const std::string& species_name, int boundary);
58
59 WarpXParticleContainer::Base* getParticleBufferPointer(const std::string& species_name, int boundary);
60
61 static constexpr int numBoundaries () {
62 return AMREX_SPACEDIM*2
63#ifdef AMREX_USE_EB
64 + 1
65#endif
66 ;
67 }
68
69 bool isDefinedForAnySpecies (int const ibuffer) {return (m_do_any_boundary[ibuffer] != 0);}
70
71 std::string boundaryName (int const ibuffer) {return m_boundary_names[ibuffer];}
72
73private:
74 // over boundary, then number of species
75 std::vector<std::vector<WarpXParticleContainer::Base> > m_particle_containers;
76
77 // over boundary, then number of species
78 std::vector<std::vector<int> > m_do_boundary_buffer;
79
80 // over boundary
81 std::vector<int> m_do_any_boundary;
82 std::vector<std::string> m_boundary_names;
83
84 mutable std::vector<std::string> m_species_names;
85};
86
87#endif /*WARPX_PARTICLEBOUNDARYBUFFER_H_*/
Definition MultiParticleContainer.H:69
std::string boundaryName(int const ibuffer)
Definition ParticleBoundaryBuffer.H:71
int numSpecies() const
Definition ParticleBoundaryBuffer.H:39
const std::vector< std::string > & getSpeciesNames() const
Definition ParticleBoundaryBuffer.cpp:360
ParticleBoundaryBuffer()
Definition ParticleBoundaryBuffer.cpp:227
~ParticleBoundaryBuffer()=default
std::vector< std::string > m_species_names
Definition ParticleBoundaryBuffer.H:84
ParticleBoundaryBuffer(const ParticleBoundaryBuffer &)=delete
std::vector< std::vector< WarpXParticleContainer::Base > > m_particle_containers
Definition ParticleBoundaryBuffer.H:75
bool isDefinedForAnySpecies(int const ibuffer)
Definition ParticleBoundaryBuffer.H:69
ParticleBoundaryBuffer(ParticleBoundaryBuffer &&)=default
std::vector< int > m_do_any_boundary
Definition ParticleBoundaryBuffer.H:81
std::vector< std::vector< int > > m_do_boundary_buffer
Definition ParticleBoundaryBuffer.H:78
static constexpr int numBoundaries()
Definition ParticleBoundaryBuffer.H:61
std::vector< std::string > m_boundary_names
Definition ParticleBoundaryBuffer.H:82
amrex::ParticleContainerPureSoA< PIdx::nattribs, 0, amrex::PolymorphicArenaAllocator > Base
Definition WarpXParticleContainer.H:199
amrex_real Real
amrex::Vector< ScalarField > MultiLevelScalarField
Definition MultiFabRegister.H:210