aboutsummaryrefslogtreecommitdiff
path: root/Source/WarpXParticleContainer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WarpXParticleContainer.cpp')
-rw-r--r--Source/WarpXParticleContainer.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/Source/WarpXParticleContainer.cpp b/Source/WarpXParticleContainer.cpp
index 5313536f2..b3cf42ad4 100644
--- a/Source/WarpXParticleContainer.cpp
+++ b/Source/WarpXParticleContainer.cpp
@@ -281,15 +281,15 @@ WarpXParticleContainer::GetChargeDensity (int lev, bool local)
data_ptr = rhofab.dataPtr();
rholen = rhofab.length();
#endif
-
+
#if (BL_SPACEDIM == 3)
- long nx = box.length(0);
- long ny = box.length(1);
- long nz = box.length(2);
-#elif (BL_SPACEDIM == 2)
- long nx = box.length(0);
- long ny = 0;
- long nz = box.length(1);
+ const long nx = rholen[0]-1-2*ng;
+ const long ny = rholen[1]-1-2*ng;
+ const long nz = rholen[2]-1-2*ng;
+#else
+ const long nx = rholen[0]-1-2*ng;
+ const long ny = 0;
+ const long nz = rholen[1]-1-2*ng;
#endif
long nxg = ng;