diff options
author | 2022-01-26 09:19:15 -0800 | |
---|---|---|
committer | 2022-01-26 09:19:15 -0800 | |
commit | 2476d50439e39843d75720c3f857ad05c4f89e23 (patch) | |
tree | da291de040a39398c48bb3cbea05a5ad91f1cafc /Python/pywarpx/_libwarpx.py | |
parent | 139d8d1a815e3632a6bf7c15a17858e85eb20fee (diff) | |
download | WarpX-2476d50439e39843d75720c3f857ad05c4f89e23.tar.gz WarpX-2476d50439e39843d75720c3f857ad05c4f89e23.tar.zst WarpX-2476d50439e39843d75720c3f857ad05c4f89e23.zip |
expose WarpXParticleContainer::sumParticleCharge to Python (#2790)
Diffstat (limited to 'Python/pywarpx/_libwarpx.py')
-rwxr-xr-x | Python/pywarpx/_libwarpx.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Python/pywarpx/_libwarpx.py b/Python/pywarpx/_libwarpx.py index 85888a616..8840ed37a 100755 --- a/Python/pywarpx/_libwarpx.py +++ b/Python/pywarpx/_libwarpx.py @@ -224,6 +224,7 @@ class LibWarpX(): self.libwarpx_so.warpx_getFaceAreas.restype = _LP_LP_c_real self.libwarpx_so.warpx_getFaceAreasLoVects.restype = _LP_c_int + self.libwarpx_so.warpx_sumParticleCharge.restype = c_real self.libwarpx_so.warpx_getParticleBoundaryBufferSize.restype = ctypes.c_int self.libwarpx_so.warpx_getParticleBoundaryBufferStructs.restype = _LP_LP_c_particlereal self.libwarpx_so.warpx_getParticleBoundaryBuffer.restype = _LP_LP_c_particlereal @@ -910,6 +911,22 @@ class LibWarpX(): ctypes.c_char_p(pid_name.encode('utf-8')), comm ) + def get_species_charge_sum(self, species_name, local=False): + ''' + + Returns the total charge in the simulation due to the given species. + + Parameters + ---------- + + species_name : the species name for which charge will be summed + local : If True return total charge per processor + + ''' + return self.libwarpx_so.warpx_sumParticleCharge( + ctypes.c_char_p(species_name.encode('utf-8')), local + ) + def get_particle_boundary_buffer_size(self, species_name, boundary): ''' |