Skip to content

Commit

Permalink
Particle Runtime Args: New Bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
ax3l committed Feb 16, 2024
1 parent 5aa700d commit 0800ff6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Base/PODVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ void make_PODVector(py::module &m, std::string typestr, std::string allocstr)
.def(py::init<>())
.def(py::init<std::size_t>(), py::arg("size"))
.def(py::init<PODVector_type&>(), py::arg("other"))
.def("assign", [](PODVector_type & pv, T const & value){
pv.assign(pv.size(), value);
}, py::arg("value"), "assign the same value to every element")
.def("push_back", py::overload_cast<const T&>(&PODVector_type::push_back))
.def("pop_back", &PODVector_type::pop_back)
.def("clear", &PODVector_type::clear)
Expand Down
14 changes: 14 additions & 0 deletions src/Particle/ParticleContainer.H
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,23 @@ void make_ParticleContainer_and_Iterators (py::module &m, std::string allocstr)
.def_property_readonly("num_runtime_int_comps", &ParticleContainerType::NumRuntimeIntComps,
"The number of runtime Int components in SoA")


.def_property_readonly("num_position_components", [](const py::object&){ return AMREX_SPACEDIM; })
.def_property_readonly("byte_spread", &ParticleContainerType::ByteSpread)

// runtime components
.def("add_real_comp", &ParticleContainerType::template AddRealComp<bool>,
py::arg("communicate")=true, "add a new runtime component with type Real")
.def("add_int_comp", &ParticleContainerType::template AddIntComp<bool>,
py::arg("communicate")=true, "add a new runtime component with type Int")

.def("resize_runtime_real_comp", &ParticleContainerType::ResizeRuntimeRealComp,
py::arg("new_size"), py::arg("communicate"),
"Resize the Real runtime components (SoA)")
.def("resize_runtime_int_comp", &ParticleContainerType::ResizeRuntimeIntComp,
py::arg("new_size"), py::arg("communicate"),
"Resize the Int runtime components (SoA)")

.def_property_readonly("finest_level", &ParticleContainerBase::finestLevel)

// ParticleContainer ( const ParticleContainer &) = delete;
Expand Down

0 comments on commit 0800ff6

Please sign in to comment.