Skip to content

Commit 6edcfa4

Browse files
committed
ParticleContainer: More Pure SoA Init Functions
Depends on upstream.
1 parent 2712b9d commit 6edcfa4

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

src/Particle/ParticleContainer.H

+9-17
Original file line numberDiff line numberDiff line change
@@ -221,14 +221,16 @@ void make_ParticleContainer_and_Iterators (py::module &m, std::string allocstr)
221221
// const IntVect* Nrep = nullptr);
222222

223223
// void InitFromBinaryFile (const std::string& file, int extradata);
224-
225224
// void InitFromBinaryMetaFile
226-
// void InitRandom (Long icount, ULong iseed,
227-
// const ParticleInitData& mass,
228-
// bool serialize = false, RealBox bx = RealBox());
229225

230-
.def("Increment", &ParticleContainerType::Increment) // TODO pure SoA
231-
//.def("IncrementWithTotal", &ParticleContainerType::IncrementWithTotal, py::arg("mf"), py::arg("level"), py::arg("local")=false) // TODO pure SoA
226+
// TODO for pure SoA
227+
// depends on https://github.com/AMReX-Codes/amrex/pull/3280
228+
.def("InitRandom", py::overload_cast<Long, ULong, const ParticleInitData&, bool, RealBox>(&ParticleContainerType::InitRandom)) // TODO pure SoA
229+
.def("InitRandomPerBox", py::overload_cast<Long, ULong, const ParticleInitData&>(&ParticleContainerType::InitRandomPerBox)) // TODO pure SoA
230+
.def("InitOnePerCell", &ParticleContainerType::InitOnePerCell) // TODO pure SoA
231+
232+
.def("Increment", &ParticleContainerType::Increment)
233+
.def("IncrementWithTotal", &ParticleContainerType::IncrementWithTotal, py::arg("mf"), py::arg("level"), py::arg("local")=false)
232234
.def("Redistribute", &ParticleContainerType::Redistribute, py::arg("lev_min")=0, py::arg("lev_max")=-1,
233235
py::arg("nGrow")=0, py::arg("local")=0, py::arg("remove_negative")=true)
234236
.def("SortParticlesByCell", &ParticleContainerType::SortParticlesByCell)
@@ -361,15 +363,6 @@ void make_ParticleContainer_and_Iterators (py::module &m, std::string allocstr)
361363
// }
362364
;
363365

364-
// TODO for pure SoA
365-
// depends on https://github.com/AMReX-Codes/amrex/pull/3280
366-
if constexpr (!T_ParticleType::is_soa_particle) {
367-
py_pc
368-
.def("InitRandom", py::overload_cast<Long, ULong, const ParticleInitData&, bool, RealBox>(&ParticleContainerType::InitRandom)) // TODO pure SoA
369-
.def("InitRandomPerBox", py::overload_cast<Long, ULong, const ParticleInitData&>(&ParticleContainerType::InitRandomPerBox)) // TODO pure SoA
370-
.def("InitOnePerCell", &ParticleContainerType::InitOnePerCell);
371-
}
372-
373366
using iterator = amrex::ParIter_impl<ParticleType, T_NArrayReal, T_NArrayInt, Allocator>;
374367
make_Iterators< false, iterator, Allocator >(m, allocstr);
375368
using const_iterator = amrex::ParConstIter_impl<ParticleType, T_NArrayReal, T_NArrayInt, Allocator>;
@@ -383,8 +376,7 @@ void make_ParticleContainer_and_Iterators (py::module &m)
383376
{
384377
// TODO for pure SoA
385378
// depends on https://github.com/AMReX-Codes/amrex/pull/3280
386-
if constexpr (!T_ParticleType::is_soa_particle)
387-
make_ParticleInitData<T_ParticleType, T_NArrayReal, T_NArrayInt>(m);
379+
make_ParticleInitData<T_ParticleType, T_NArrayReal, T_NArrayInt>(m);
388380

389381
// see Src/Base/AMReX_GpuContainers.H
390382
// !AMREX_USE_GPU: DefaultAllocator = std::allocator

0 commit comments

Comments
 (0)