Skip to content

Commit 536beda

Browse files
authored
ParticleContainer: add_particle(other) & make_alike (#447)
Add bindings to copying from another particle container and to create another particle container from an existing one using the same layout & allocator.
1 parent 3802b2d commit 536beda

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Particle/ParticleContainer.H

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,9 @@ void make_ParticleContainer_and_Iterators (py::module &m, std::string allocstr)
185185
const Vector<DistributionMapping>&,
186186
const Vector<BoxArray>&,
187187
const Vector<IntVect>&>())
188+
;
189+
py_pc
190+
.def("make_alike", &ParticleContainerType::template make_alike<Allocator>)
188191

189192
.def_property_readonly_static("is_soa_particle", [](const py::object&){return ParticleType::is_soa_particle;})
190193
.def_property_readonly_static("num_struct_real", [](const py::object&){return ParticleContainerType::NStructReal; })
@@ -341,6 +344,8 @@ void make_ParticleContainer_and_Iterators (py::module &m, std::string allocstr)
341344
// template <class PCType,
342345
// std::enable_if_t<IsParticleContainer<PCType>::value, int> foo = 0>
343346
// void addParticles (const PCType& other, bool local=false);
347+
.def("add_particles", py::overload_cast<ParticleContainerType const &, bool>(&ParticleContainerType::template addParticles<ParticleContainerType, true>),
348+
py::arg("other"), py::arg("local")=false)
344349
// template <class F, class PCType,
345350
// std::enable_if_t<IsParticleContainer<PCType>::value, int> foo = 0,
346351
// std::enable_if_t<! std::is_integral<F>::value, int> bar = 0>

0 commit comments

Comments
 (0)