aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/MultiParticleContainer.H
diff options
context:
space:
mode:
authorGravatar NeilZaim <49716072+NeilZaim@users.noreply.github.com> 2020-10-23 04:48:16 +0200
committerGravatar GitHub <noreply@github.com> 2020-10-22 19:48:16 -0700
commitcb199e221ae698ac13fdda691985e001ee84039b (patch)
tree0f4f84bec9ceccfcb326571a9e96aa1940cbb4c0 /Source/Particles/MultiParticleContainer.H
parent536c3b417666b11c7143d17cc5a7759b7af0da9c (diff)
downloadWarpX-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.H17
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);