aboutsummaryrefslogtreecommitdiff
path: root/Source/Python
diff options
context:
space:
mode:
authorGravatar Roelof Groenewald <40245517+roelof-groenewald@users.noreply.github.com> 2022-02-04 15:05:45 -0800
committerGravatar GitHub <noreply@github.com> 2022-02-04 15:05:45 -0800
commit9263e6a9832f7ec69a8cc54fda3f6f1de51caaf1 (patch)
treecd5ac71f1de829d48e7e709b59d419f4fca20c17 /Source/Python
parentf236cd6d20eb4bbc742b69147af47ff6f70302f7 (diff)
downloadWarpX-9263e6a9832f7ec69a8cc54fda3f6f1de51caaf1.tar.gz
WarpX-9263e6a9832f7ec69a8cc54fda3f6f1de51caaf1.tar.zst
WarpX-9263e6a9832f7ec69a8cc54fda3f6f1de51caaf1.zip
added `local` flag to `warpx_getNumParticles` (#2828)
Diffstat (limited to 'Source/Python')
-rw-r--r--Source/Python/WarpXWrappers.H2
-rw-r--r--Source/Python/WarpXWrappers.cpp5
2 files changed, 4 insertions, 3 deletions
diff --git a/Source/Python/WarpXWrappers.H b/Source/Python/WarpXWrappers.H
index 817c1de73..f4fa2a3fd 100644
--- a/Source/Python/WarpXWrappers.H
+++ b/Source/Python/WarpXWrappers.H
@@ -78,7 +78,7 @@ extern "C" {
amrex::Real warpx_getCellSize(int dir, int lev);
- long warpx_getNumParticles(const char* char_species_name);
+ long warpx_getNumParticles(const char* char_species_name, const bool local);
amrex::ParticleReal** warpx_getParticleStructs(
const char* char_species_name, int lev, int* num_tiles,
diff --git a/Source/Python/WarpXWrappers.cpp b/Source/Python/WarpXWrappers.cpp
index d91cd9a88..accecd615 100644
--- a/Source/Python/WarpXWrappers.cpp
+++ b/Source/Python/WarpXWrappers.cpp
@@ -240,11 +240,12 @@ namespace
return dx[dir];
}
- long warpx_getNumParticles(const char* char_species_name) {
+ long warpx_getNumParticles(const char* char_species_name, const bool local) {
const auto & mypc = WarpX::GetInstance().GetPartContainer();
const std::string species_name(char_species_name);
auto & myspc = mypc.GetParticleContainerFromName(species_name);
- return myspc.TotalNumberOfParticles();
+ // the first argument below is to only count valid particles
+ return myspc.TotalNumberOfParticles(true, local);
}
#define WARPX_GET_FIELD(FIELD, GETTER) \