diff --git a/Source/Particles/NamedComponentParticleContainer.H b/Source/Particles/NamedComponentParticleContainer.H index e7a7a20fad5..983d417d9c0 100644 --- a/Source/Particles/NamedComponentParticleContainer.H +++ b/Source/Particles/NamedComponentParticleContainer.H @@ -190,6 +190,19 @@ public: } } + void defineAllParticleTiles () noexcept + { + for (int lev = 0; lev <= amrex::ParticleContainerPureSoA::finestLevel(); ++lev) + { + for (auto mfi = amrex::ParticleContainerPureSoA::MakeMFIter(lev); mfi.isValid(); ++mfi) + { + const int grid_id = mfi.index(); + const int tile_id = mfi.LocalTileIndex(); + amrex::ParticleContainerPureSoA::DefineAndReturnParticleTile(lev, grid_id, tile_id); + } + } + } + /** Return the name-to-index map for the compile-time and runtime-time real components */ [[nodiscard]] std::map getParticleComps () const noexcept { return particle_comps;} /** Return the name-to-index map for the compile-time and runtime-time integer components */ diff --git a/Source/Particles/WarpXParticleContainer.cpp b/Source/Particles/WarpXParticleContainer.cpp index 6e6c0b27c85..912dd3a5a40 100644 --- a/Source/Particles/WarpXParticleContainer.cpp +++ b/Source/Particles/WarpXParticleContainer.cpp @@ -1517,6 +1517,10 @@ WarpXParticleContainer::PushX (int lev, amrex::Real dt) // without runtime component). void WarpXParticleContainer::defineAllParticleTiles () noexcept { + // Call the parent class's method + NamedComponentParticleContainer::defineAllParticleTiles(); + + // Resize the tmp_particle_data (no present in parent class) tmp_particle_data.resize(finestLevel()+1); for (int lev = 0; lev <= finestLevel(); ++lev) { @@ -1525,7 +1529,6 @@ void WarpXParticleContainer::defineAllParticleTiles () noexcept const int grid_id = mfi.index(); const int tile_id = mfi.LocalTileIndex(); tmp_particle_data[lev][std::make_pair(grid_id,tile_id)]; - DefineAndReturnParticleTile(lev, grid_id, tile_id); } } }