diff --git a/src/Particle/ParticleContainer.H b/src/Particle/ParticleContainer.H index 5dfcdc36..76e23a80 100644 --- a/src/Particle/ParticleContainer.H +++ b/src/Particle/ParticleContainer.H @@ -380,13 +380,17 @@ void make_ParticleContainer_and_Iterators (py::module &m, std::string allocstr) // } ; + py_pc + .def("InitRandom", py::overload_cast(&ParticleContainerType::InitRandom)) + ; + // TODO for pure SoA // depends on https://github.com/AMReX-Codes/amrex/pull/3280 if constexpr (!T_ParticleType::is_soa_particle) { py_pc - .def("InitRandom", py::overload_cast(&ParticleContainerType::InitRandom)) // TODO pure SoA - .def("InitRandomPerBox", py::overload_cast(&ParticleContainerType::InitRandomPerBox)) // TODO pure SoA - .def("InitOnePerCell", &ParticleContainerType::InitOnePerCell); + .def("InitRandomPerBox", py::overload_cast(&ParticleContainerType::InitRandomPerBox)) + .def("InitOnePerCell", &ParticleContainerType::InitOnePerCell) + ; } using iterator = amrex::ParIter_impl; @@ -408,10 +412,7 @@ void make_ParticleContainer_and_Iterators (py::module &m, std::string allocstr) template void make_ParticleContainer_and_Iterators (py::module &m) { - // TODO for pure SoA - // depends on https://github.com/AMReX-Codes/amrex/pull/3280 - if constexpr (!T_ParticleType::is_soa_particle) - make_ParticleInitData(m); + make_ParticleInitData(m); // first, because used as copy target in methods in containers with other allocators make_ParticleContainer_and_Iterators, 5, 0>(m); // ImpactX 22.07 - 24.02 make_ParticleContainer_and_Iterators, 8, 0>(m); // ImpactX 24.03+ } diff --git a/src/Particle/ParticleContainer_WarpX.cpp b/src/Particle/ParticleContainer_WarpX.cpp index 36f75e45..b2c7bd3d 100644 --- a/src/Particle/ParticleContainer_WarpX.cpp +++ b/src/Particle/ParticleContainer_WarpX.cpp @@ -13,9 +13,6 @@ void init_ParticleContainer_WarpX(py::module& m) { // TODO: we might need to move all or most of the defines in here into a // test/example submodule, so they do not collide with downstream projects - make_ParticleContainer_and_Iterators, 4, 0>(m); // WarpX 22.07 - 24.02 1D-3D - //make_ParticleContainer_and_Iterators, 5, 0> (m); // WarpX 22.07 - 24.02 RZ - #if AMREX_SPACEDIM == 1 make_ParticleContainer_and_Iterators, 5, 0>(m); // WarpX 24.03+ 1D #elif AMREX_SPACEDIM == 2 diff --git a/tests/test_particleContainer.py b/tests/test_particleContainer.py index 1b974ebc..3742a7ce 100644 --- a/tests/test_particleContainer.py +++ b/tests/test_particleContainer.py @@ -300,19 +300,19 @@ class Config: # pc = sim.get_particles() # Config = sim.extension.Config - # iterate over every mesh-refinement levels (no MR: lev=0) + # iterate over mesh-refinement level (no MR: lev=0) for lvl in range(pc.finest_level + 1): # get every local chunk of particles for pti in pc.iterator(pc, level=lvl): - # additional compile-time and runtime attributes in SoA format + # compile-time and runtime attributes in SoA format soa = pti.soa().to_cupy() if Config.have_gpu else pti.soa().to_numpy() # notes: # Only the next lines are the "HOT LOOP" of the computation. - # For efficiency, use numpy array operation for speed. + # For speed, use array operations. # write to all particles in the chunk - # note: careful, if you change particle positions, you need to + # note: careful, if you change particle positions, you might need to # redistribute particles before continuing the simulation step print(soa.real) soa.real[0][()] = 0.30 # x @@ -341,7 +341,7 @@ class Config: # pc = sim.get_particles() # Config = sim.extension.Config - # iterate over every mesh-refinement levels (no MR: lev=0) + # iterate over mesh-refinement level (no MR: lev=0) for lvl in range(pc.finest_level + 1): # get every local chunk of particles for pti in pc.iterator(pc, level=lvl):