From 1f1b15b7b018c95025ce7afebd5e0b350d60f610 Mon Sep 17 00:00:00 2001 From: Edoardo Zoni <59625522+EZoni@users.noreply.github.com> Date: Thu, 27 Jul 2023 13:18:06 -0700 Subject: Fix bug with MLMG solver, always pass ghost cells to `SumBoundary` (#4078) * Must pass number of ghost cells to call `SumBoundary` * Apply suggestions from #4093 * Add inline comments on possible performance optimization --- Source/Particles/MultiParticleContainer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Source/Particles/MultiParticleContainer.cpp') diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp index 7bbb973bb..529a78c8e 100644 --- a/Source/Particles/MultiParticleContainer.cpp +++ b/Source/Particles/MultiParticleContainer.cpp @@ -613,7 +613,11 @@ MultiParticleContainer::GetChargeDensity (int lev, bool local) } if (!local) { const Geometry& gm = allcontainers[0]->Geom(lev); - ablastr::utils::communication::SumBoundary(*rho, WarpX::do_single_precision_comms, gm.periodicity()); + // Possible performance optimization: + // pass less than `rho->nGrowVect()` in the fifth input variable `dst_ng` + ablastr::utils::communication::SumBoundary( + *rho, 0, rho->nComp(), rho->nGrowVect(), rho->nGrowVect(), + WarpX::do_single_precision_comms, gm.periodicity()); } return rho; -- cgit v1.2.3