aboutsummaryrefslogtreecommitdiff
path: root/Source/PhysicalParticleContainer.cpp
diff options
context:
space:
mode:
authorGravatar Andrew Myers <atmyers@lbl.gov> 2018-10-23 00:34:31 -0400
committerGravatar Andrew Myers <atmyers@lbl.gov> 2018-10-23 00:34:31 -0400
commite6ab607f7e88026fb272917d18f5acecb3b3b06a (patch)
tree2f146c086c6ed11f99f93b3a8f160659f203f92b /Source/PhysicalParticleContainer.cpp
parentf47839dd9c2f9342596950a344996996bbc4535a (diff)
downloadWarpX-e6ab607f7e88026fb272917d18f5acecb3b3b06a.tar.gz
WarpX-e6ab607f7e88026fb272917d18f5acecb3b3b06a.tar.zst
WarpX-e6ab607f7e88026fb272917d18f5acecb3b3b06a.zip
avoid repeated memory allocations in PhysicalParticleContainer
Diffstat (limited to 'Source/PhysicalParticleContainer.cpp')
-rw-r--r--Source/PhysicalParticleContainer.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/Source/PhysicalParticleContainer.cpp b/Source/PhysicalParticleContainer.cpp
index 812231590..b9fb45f23 100644
--- a/Source/PhysicalParticleContainer.cpp
+++ b/Source/PhysicalParticleContainer.cpp
@@ -725,12 +725,10 @@ PhysicalParticleContainer::Evolve (int lev,
#pragma omp parallel
#endif
{
- Cuda::DeviceVector<Real> xp, yp, zp, giv;
-
- std::unique_ptr<FArrayBox> local_rho(new FArrayBox());
- std::unique_ptr<FArrayBox> local_jx(new FArrayBox());
- std::unique_ptr<FArrayBox> local_jy(new FArrayBox());
- std::unique_ptr<FArrayBox> local_jz(new FArrayBox());
+ if (local_rho == nullptr) local_rho.reset(new amrex::FArrayBox());
+ if (local_jx == nullptr) local_jx.reset( new amrex::FArrayBox());
+ if (local_jy == nullptr) local_jy.reset( new amrex::FArrayBox());
+ if (local_jz == nullptr) local_jz.reset( new amrex::FArrayBox());
FArrayBox filtered_Ex, filtered_Ey, filtered_Ez;
FArrayBox filtered_Bx, filtered_By, filtered_Bz;