Skip to content

Commit 9e54910

Browse files
committed
ParticleInitData for PureSoA
1 parent de5215b commit 9e54910

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

src/Particle/ParticleContainer.H

+8-7
Original file line numberDiff line numberDiff line change
@@ -380,13 +380,17 @@ void make_ParticleContainer_and_Iterators (py::module &m, std::string allocstr)
380380
// }
381381
;
382382

383+
py_pc
384+
.def("InitRandom", py::overload_cast<Long, ULong, const ParticleInitData&, bool, RealBox>(&ParticleContainerType::InitRandom))
385+
;
386+
383387
// TODO for pure SoA
384388
// depends on https://github.com/AMReX-Codes/amrex/pull/3280
385389
if constexpr (!T_ParticleType::is_soa_particle) {
386390
py_pc
387-
.def("InitRandom", py::overload_cast<Long, ULong, const ParticleInitData&, bool, RealBox>(&ParticleContainerType::InitRandom)) // TODO pure SoA
388-
.def("InitRandomPerBox", py::overload_cast<Long, ULong, const ParticleInitData&>(&ParticleContainerType::InitRandomPerBox)) // TODO pure SoA
389-
.def("InitOnePerCell", &ParticleContainerType::InitOnePerCell);
391+
.def("InitRandomPerBox", py::overload_cast<Long, ULong, const ParticleInitData&>(&ParticleContainerType::InitRandomPerBox))
392+
.def("InitOnePerCell", &ParticleContainerType::InitOnePerCell)
393+
;
390394
}
391395

392396
using iterator = amrex::ParIter_impl<ParticleType, T_NArrayReal, T_NArrayInt, Allocator>;
@@ -408,10 +412,7 @@ void make_ParticleContainer_and_Iterators (py::module &m, std::string allocstr)
408412
template <typename T_ParticleType, int T_NArrayReal=0, int T_NArrayInt=0>
409413
void make_ParticleContainer_and_Iterators (py::module &m)
410414
{
411-
// TODO for pure SoA
412-
// depends on https://github.com/AMReX-Codes/amrex/pull/3280
413-
if constexpr (!T_ParticleType::is_soa_particle)
414-
make_ParticleInitData<T_ParticleType, T_NArrayReal, T_NArrayInt>(m);
415+
make_ParticleInitData<T_ParticleType, T_NArrayReal, T_NArrayInt>(m);
415416

416417
// first, because used as copy target in methods in containers with other allocators
417418
make_ParticleContainer_and_Iterators<T_ParticleType, T_NArrayReal, T_NArrayInt,

src/Particle/ParticleContainer_ImpactX.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,5 @@ void init_ParticleContainer_ImpactX(py::module& m) {
1414

1515
// TODO: we might need to move all or most of the defines in here into a
1616
// test/example submodule, so they do not collide with downstream projects
17-
make_ParticleContainer_and_Iterators<Particle<0, 0>, 5, 0>(m); // ImpactX 22.07 - 24.02
1817
make_ParticleContainer_and_Iterators<SoAParticle<8, 0>, 8, 0>(m); // ImpactX 24.03+
1918
}

src/Particle/ParticleContainer_WarpX.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ void init_ParticleContainer_WarpX(py::module& m) {
1313

1414
// TODO: we might need to move all or most of the defines in here into a
1515
// test/example submodule, so they do not collide with downstream projects
16-
make_ParticleContainer_and_Iterators<Particle<0, 0>, 4, 0>(m); // WarpX 22.07 - 24.02 1D-3D
17-
//make_ParticleContainer_and_Iterators<Particle<0, 0>, 5, 0> (m); // WarpX 22.07 - 24.02 RZ
18-
1916
#if AMREX_SPACEDIM == 1
2017
make_ParticleContainer_and_Iterators<SoAParticle<5, 0>, 5, 0>(m); // WarpX 24.03+ 1D
2118
#elif AMREX_SPACEDIM == 2

0 commit comments

Comments
 (0)