diff options
author | 2020-10-23 04:48:16 +0200 | |
---|---|---|
committer | 2020-10-22 19:48:16 -0700 | |
commit | cb199e221ae698ac13fdda691985e001ee84039b (patch) | |
tree | 0f4f84bec9ceccfcb326571a9e96aa1940cbb4c0 /Source/Particles/MultiParticleContainer.H | |
parent | 536c3b417666b11c7143d17cc5a7759b7af0da9c (diff) | |
download | WarpX-cb199e221ae698ac13fdda691985e001ee84039b.tar.gz WarpX-cb199e221ae698ac13fdda691985e001ee84039b.tar.zst WarpX-cb199e221ae698ac13fdda691985e001ee84039b.zip |
Remove a few segfaults when there is zero particle species (#1449)
* Remove a few segfaults when there is zero particle species
* Docs: Update Example
* We don't have `part_per_proc` so exemplify with something else.
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
Diffstat (limited to 'Source/Particles/MultiParticleContainer.H')
-rw-r--r-- | Source/Particles/MultiParticleContainer.H | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Source/Particles/MultiParticleContainer.H b/Source/Particles/MultiParticleContainer.H index 4a515acf8..ed6c277fe 100644 --- a/Source/Particles/MultiParticleContainer.H +++ b/Source/Particles/MultiParticleContainer.H @@ -112,6 +112,14 @@ public: const amrex::MultiFab& Ex, const amrex::MultiFab& Ey, const amrex::MultiFab& Ez, const amrex::MultiFab& Bx, const amrex::MultiFab& By, const amrex::MultiFab& Bz); + /** + * \brief This returns a MultiFAB filled with zeros. It is used to return the charge density + * when there is no particle species. + * + * @param[in] lev the index of the refinement level. + */ + std::unique_ptr<amrex::MultiFab> GetZeroChargeDensity(const int lev); + /// /// This deposits the particle charge onto a node-centered MultiFab and returns a unique ptr /// to it. The charge density is accumulated over all the particles in the MultiParticleContainer @@ -160,6 +168,15 @@ public: * of the whole simulation BC. */ void ApplyBoundaryConditions (); + /** + * \brief This returns a vector filled with zeros whose size is the number of boxes in the + * simulation boxarray. It is used to return the number of particles in each grid when there is + * no particle species. + * + * @param[in] lev the index of the refinement level. + */ + amrex::Vector<long> GetZeroParticlesInGrid(const int lev) const; + amrex::Vector<long> NumberOfParticlesInGrid(int lev) const; void Increment (amrex::MultiFab& mf, int lev); |