aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/WarpXParticleContainer.cpp
diff options
context:
space:
mode:
authorGravatar Remi Lehe <remi.lehe@normalesup.org> 2022-05-23 19:28:52 -0700
committerGravatar GitHub <noreply@github.com> 2022-05-24 02:28:52 +0000
commit780b24e75c83cf65439012fea739b8a4203ecca1 (patch)
tree570fd26886a3f6d99bcb1f6ea37aabcb574730c1 /Source/Particles/WarpXParticleContainer.cpp
parent008418a0fec06a293089fb091739981b82e60394 (diff)
downloadWarpX-780b24e75c83cf65439012fea739b8a4203ecca1.tar.gz
WarpX-780b24e75c83cf65439012fea739b8a4203ecca1.tar.zst
WarpX-780b24e75c83cf65439012fea739b8a4203ecca1.zip
Add new class `NamedComponentParticleContainer` (#3100)
* Add new class `NamedComponentParticleContainer` * Update docstrings * Fix compilation * Address review comments * Update Doxygen Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
Diffstat (limited to 'Source/Particles/WarpXParticleContainer.cpp')
-rw-r--r--Source/Particles/WarpXParticleContainer.cpp15
1 files changed, 3 insertions, 12 deletions
diff --git a/Source/Particles/WarpXParticleContainer.cpp b/Source/Particles/WarpXParticleContainer.cpp
index ca9b99500..15b431394 100644
--- a/Source/Particles/WarpXParticleContainer.cpp
+++ b/Source/Particles/WarpXParticleContainer.cpp
@@ -81,21 +81,12 @@ WarpXParIter::WarpXParIter (ContainerType& pc, int level, MFItInfo& info)
}
WarpXParticleContainer::WarpXParticleContainer (AmrCore* amr_core, int ispecies)
- : ParticleContainer<0,0,PIdx::nattribs>(amr_core->GetParGDB())
+ : NamedComponentParticleContainer<DefaultAllocator>(amr_core->GetParGDB())
, species_id(ispecies)
{
SetParticleSize();
ReadParameters();
- // build up the map of string names to particle component numbers
- particle_comps["w"] = PIdx::w;
- particle_comps["ux"] = PIdx::ux;
- particle_comps["uy"] = PIdx::uy;
- particle_comps["uz"] = PIdx::uz;
-#ifdef WARPX_DIM_RZ
- particle_comps["theta"] = PIdx::theta;
-#endif
-
// Initialize temporary local arrays for charge/current deposition
int num_threads = 1;
#ifdef AMREX_USE_OMP
@@ -783,8 +774,8 @@ Real WarpXParticleContainer::sumParticleCharge(bool local) {
for (WarpXParIter pti(*this, lev); pti.isValid(); ++pti)
{
auto& wp = pti.GetAttribs(PIdx::w);
- for (const auto& tt : wp) {
- total_charge += tt;
+ for (unsigned long i = 0; i < wp.size(); i++) {
+ total_charge += wp[i];
}
}
}