diff options
-rwxr-xr-x | Python/pywarpx/_libwarpx.py | 8 | ||||
-rw-r--r-- | Source/Diagnostics/BoundaryScrapingDiagnostics.cpp | 2 | ||||
-rw-r--r-- | Source/Particles/ParticleBoundaryBuffer.H | 2 | ||||
-rw-r--r-- | Source/Particles/ParticleBoundaryBuffer.cpp | 4 | ||||
-rw-r--r-- | Source/Python/WarpXWrappers.H | 2 | ||||
-rw-r--r-- | Source/Python/WarpXWrappers.cpp | 4 |
6 files changed, 13 insertions, 9 deletions
diff --git a/Python/pywarpx/_libwarpx.py b/Python/pywarpx/_libwarpx.py index c2c3a774b..47a0737b7 100755 --- a/Python/pywarpx/_libwarpx.py +++ b/Python/pywarpx/_libwarpx.py @@ -1042,7 +1042,7 @@ class LibWarpX(): ctypes.c_char_p(species_name.encode('utf-8')), local ) - def get_particle_boundary_buffer_size(self, species_name, boundary): + def get_particle_boundary_buffer_size(self, species_name, boundary, local=False): ''' This returns the number of particles that have been scraped so far in the simulation from the specified boundary and of the specified species. @@ -1056,11 +1056,15 @@ class LibWarpX(): boundary : str The boundary from which to get the scraped particle data in the form x/y/z_hi/lo + + local : bool + Whether to only return the number of particles in the current + processor's buffer ''' return self.libwarpx_so.warpx_getParticleBoundaryBufferSize( ctypes.c_char_p(species_name.encode('utf-8')), - self._get_boundary_number(boundary) + self._get_boundary_number(boundary), local ) def get_particle_boundary_buffer_structs(self, species_name, boundary, level): diff --git a/Source/Diagnostics/BoundaryScrapingDiagnostics.cpp b/Source/Diagnostics/BoundaryScrapingDiagnostics.cpp index dff036343..5b5bf4761 100644 --- a/Source/Diagnostics/BoundaryScrapingDiagnostics.cpp +++ b/Source/Diagnostics/BoundaryScrapingDiagnostics.cpp @@ -136,7 +136,7 @@ BoundaryScrapingDiagnostics::Flush (int i_buffer) int n_particles = 0; for (auto const& species_name : m_output_species_names) { - n_particles += particle_buffer.getNumParticlesInContainer(species_name, i_buffer); + n_particles += particle_buffer.getNumParticlesInContainer(species_name, i_buffer, false); } // If the saving of the particles was not set up for any of the species for this boundary diff --git a/Source/Particles/ParticleBoundaryBuffer.H b/Source/Particles/ParticleBoundaryBuffer.H index 9f6ad9066..6026c1610 100644 --- a/Source/Particles/ParticleBoundaryBuffer.H +++ b/Source/Particles/ParticleBoundaryBuffer.H @@ -43,7 +43,7 @@ public: void printNumParticles () const; - int getNumParticlesInContainer(const std::string species_name, int boundary); + int getNumParticlesInContainer(const std::string species_name, int boundary, bool local); PinnedMemoryParticleContainer& getParticleBuffer(const std::string species_name, int boundary); diff --git a/Source/Particles/ParticleBoundaryBuffer.cpp b/Source/Particles/ParticleBoundaryBuffer.cpp index f1ee10593..a5c3bcd90 100644 --- a/Source/Particles/ParticleBoundaryBuffer.cpp +++ b/Source/Particles/ParticleBoundaryBuffer.cpp @@ -352,12 +352,12 @@ void ParticleBoundaryBuffer::gatherParticles (MultiParticleContainer& mypc, } int ParticleBoundaryBuffer::getNumParticlesInContainer( - const std::string species_name, int boundary) { + const std::string species_name, int boundary, bool local) { auto& buffer = m_particle_containers[boundary]; auto index = WarpX::GetInstance().GetPartContainer().getSpeciesID(species_name); - if (buffer[index].isDefined()) return buffer[index].TotalNumberOfParticles(false); + if (buffer[index].isDefined()) return buffer[index].TotalNumberOfParticles(false, local); else return 0; } diff --git a/Source/Python/WarpXWrappers.H b/Source/Python/WarpXWrappers.H index 708a97cc3..0c2002d65 100644 --- a/Source/Python/WarpXWrappers.H +++ b/Source/Python/WarpXWrappers.H @@ -102,7 +102,7 @@ extern "C" { amrex::Real warpx_sumParticleCharge(const char* char_species_name, const bool local); - int warpx_getParticleBoundaryBufferSize(const char* species_name, int boundary); + int warpx_getParticleBoundaryBufferSize(const char* species_name, int boundary, bool local); int** warpx_getParticleBoundaryBufferScrapedSteps( const char* species_name, int boundary, int lev, diff --git a/Source/Python/WarpXWrappers.cpp b/Source/Python/WarpXWrappers.cpp index 05a2a1061..f2c022365 100644 --- a/Source/Python/WarpXWrappers.cpp +++ b/Source/Python/WarpXWrappers.cpp @@ -565,11 +565,11 @@ namespace return myspc.sumParticleCharge(local); } - int warpx_getParticleBoundaryBufferSize(const char* species_name, int boundary) + int warpx_getParticleBoundaryBufferSize(const char* species_name, int boundary, bool local) { const std::string name(species_name); auto& particle_buffers = WarpX::GetInstance().GetParticleBoundaryBuffer(); - return particle_buffers.getNumParticlesInContainer(species_name, boundary); + return particle_buffers.getNumParticlesInContainer(species_name, boundary, local); } int** warpx_getParticleBoundaryBufferScrapedSteps(const char* species_name, int boundary, int lev, |