aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/ParticleBoundaryBuffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Particles/ParticleBoundaryBuffer.cpp')
-rw-r--r--Source/Particles/ParticleBoundaryBuffer.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp
index f84d05b28..16465ac76 100644
--- a/Source/Particles/ParticleBoundaryBuffer.cpp
+++ b/Source/Particles/ParticleBoundaryBuffer.cpp
@@ -97,7 +97,7 @@ void ParticleBoundaryBuffer::printNumParticles () const {
int np = buffer[i].isDefined() ? buffer[i].TotalNumberOfParticles(false) : 0;
amrex::Print() << "Species " << getSpeciesNames()[i] << " has "
<< np << " particles in the boundary buffer "
- << " for side " << iside << " of dim " << idim << "\n";
+ << "for side " << iside << " of dim " << idim << "\n";
}
}
}
@@ -232,3 +232,28 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc,
amrex::ignore_unused(distance_to_eb, dxi);
#endif
}
+
+int ParticleBoundaryBuffer::getNumParticlesInContainer(
+ const std::string species_name, int boundary) {
+
+ auto& buffer = m_particle_containers[boundary];
+ auto index = WarpX::GetInstance().GetPartContainer().getSpeciesID(species_name);
+
+ if (buffer[index].isDefined()) return buffer[index].TotalNumberOfParticles(false);
+ else return 0;
+}
+
+ParticleBuffer::BufferType<amrex::PinnedArenaAllocator>&
+ParticleBoundaryBuffer::getParticleBuffer(const std::string species_name, int boundary) {
+
+ auto& buffer = m_particle_containers[boundary];
+ auto index = WarpX::GetInstance().GetPartContainer().getSpeciesID(species_name);
+
+ AMREX_ALWAYS_ASSERT_WITH_MESSAGE(m_do_boundary_buffer[boundary][index],
+ "Attempted to get particle buffer for boundary "
+ + boundary + ", which is not used!");
+ AMREX_ALWAYS_ASSERT_WITH_MESSAGE(buffer[index].isDefined(),
+ "Tried to get a buffer that is not defined!");
+
+ return buffer[index];
+}