/* Copyright 2021 Andrew Myers * * This file is part of WarpX. * * License: BSD-3-Clause-LBNL */ #ifndef PARTICLEBOUNDARYBUFFER_H_ #define PARTICLEBOUNDARYBUFFER_H_ #include "Particles/ParticleBuffer.H" #include "Particles/MultiParticleContainer_fwd.H" #include /** * This stores particles that have left / been absorbed by domain and embedded boundaries. */ class ParticleBoundaryBuffer { public: ParticleBoundaryBuffer (); int numSpecies() const { return getSpeciesNames().size(); } const std::vector& getSpeciesNames() const { static bool initialized = false; if (!initialized) { amrex::ParmParse pp_particles("particles"); pp_particles.queryarr("species_names", m_species_names); initialized = true; } return m_species_names; } void gatherParticles (MultiParticleContainer& mypc, const amrex::Vector& distance_to_eb); void clearParticles (); void printNumParticles () const; int getNumParticlesInContainer(const std::string species_name, int boundary); ParticleBuffer::BufferType& getParticleBuffer(const std::string species_name, int boundary); constexpr int numBoundaries () const { return AMREX_SPACEDIM*2 #ifdef AMREX_USE_EB + 1 #endif ; } private: // over boundary, then number of species std::vector > > m_particle_containers; // over boundary, then number of species std::vector > m_do_boundary_buffer; mutable std::vector m_species_names; }; #endif /*PARTICLEBOUNDARYBUFFER_H_*/