Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/update_stub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ set -eu -o pipefail
# we are in the source directory, .github/
this_dir=$(cd $(dirname $0) && pwd)

pybind11-stubgen --exit-code -o ${this_dir}/../src/ amrex.space1d
pybind11-stubgen --exit-code -o ${this_dir}/../src/ amrex.space2d
pybind11-stubgen --exit-code -o ${this_dir}/../src/ amrex.space3d
pybind11-stubgen --exit-code --enum-class-locations="GrowthStrategy:amrex.space1d" -o ${this_dir}/../src/ amrex.space1d
pybind11-stubgen --exit-code --enum-class-locations="GrowthStrategy:amrex.space2d" -o ${this_dir}/../src/ amrex.space2d
pybind11-stubgen --exit-code --enum-class-locations="GrowthStrategy:amrex.space3d" -o ${this_dir}/../src/ amrex.space3d
2 changes: 1 addition & 1 deletion dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"version_pyamrex": "25.11",
"version_amrex": "25.11",
"version_pybind11": "v3.0.1",
"commit_amrex": "25.11",
"commit_amrex": "4dad1664d7467ae00c133c1425c1a300003fa885",
"commit_pybind11": "v3.0.1"
}
30 changes: 26 additions & 4 deletions src/Base/PODVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,22 @@ void make_PODVector(py::module &m, std::string typestr, std::string allocstr)
// .def("max_size", &PODVector_type::max_size)
.def("capacity", &PODVector_type::capacity)
.def("empty", &PODVector_type::empty)
.def("resize", py::overload_cast<std::size_t>(&PODVector_type::resize))
.def("resize", py::overload_cast<std::size_t, const T&>(&PODVector_type::resize))
.def("reserve", &PODVector_type::reserve)
.def("resize",
py::overload_cast<std::size_t, GrowthStrategy>(&PODVector_type::resize),
py::arg("new_size"),
py::arg("strategy") = GrowthStrategy::Poisson
)
.def("resize",
py::overload_cast<std::size_t, const T&, GrowthStrategy>(&PODVector_type::resize),
py::arg("new_size"),
py::arg("value"),
py::arg("strategy") = GrowthStrategy::Poisson
)
.def("reserve",
&PODVector_type::reserve,
py::arg("capacity"),
py::arg("strategy") = GrowthStrategy::Poisson
)
.def("shrink_to_fit", &PODVector_type::shrink_to_fit)
.def("to_host", [](PODVector_type const & pv) {
PODVector<T, amrex::PinnedArenaAllocator<T>> h_data(pv.size());
Expand Down Expand Up @@ -137,7 +150,16 @@ void make_PODVector(py::module &m, std::string typestr)
#endif
}

void init_PODVector(py::module& m) {
void init_PODVector(py::module& m)
{
py::native_enum<GrowthStrategy>(m, "GrowthStrategy", "enum.Enum")
.value("Poisson", GrowthStrategy::Poisson)
.value("Exact", GrowthStrategy::Exact)
.value("Geometric", GrowthStrategy::Geometric)
.export_values()
.finalize()
;

make_PODVector<ParticleReal> (m, "real");
make_PODVector<int> (m, "int");
make_PODVector<uint64_t> (m, "uint64");
Expand Down
19 changes: 9 additions & 10 deletions src/Base/ParmParse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,15 @@ void init_ParmParse(py::module &m)

.def_static("addfile", &ParmParse::addfile)

.def("add", py::overload_cast<std::string_view, bool const>(&ParmParse::add))
.def("add", py::overload_cast<std::string_view, int const>(&ParmParse::add))
.def("add", py::overload_cast<std::string_view, long const>(&ParmParse::add))
.def("add", py::overload_cast<std::string_view, long long const>(&ParmParse::add))
.def("add", py::overload_cast<std::string_view, float const>(&ParmParse::add))
.def("add", py::overload_cast<std::string_view, double const>(&ParmParse::add))
.def("add", py::overload_cast<std::string_view, std::string const &>(&ParmParse::add))
.def("add", py::overload_cast<std::string_view, amrex::IntVect const &>(&ParmParse::add))
.def("add", py::overload_cast<std::string_view, amrex::Box const &>(&ParmParse::add))

.def("add", [](ParmParse &pp, std::string_view name, bool val) { pp.add(name, val); })
.def("add", [](ParmParse &pp, std::string_view name, int val) { pp.add(name, val); })
.def("add", [](ParmParse &pp, std::string_view name, long val) { pp.add(name, val); })
.def("add", [](ParmParse &pp, std::string_view name, long long val) { pp.add(name, val); })
.def("add", [](ParmParse &pp, std::string_view name, float val) { pp.add(name, val); })
.def("add", [](ParmParse &pp, std::string_view name, double val) { pp.add(name, val); })
.def("add", [](ParmParse &pp, std::string_view name, std::string const &val) { pp.add(name, val); })
.def("add", [](ParmParse &pp, std::string_view name, amrex::IntVect const &val) { pp.add(name, val); })
.def("add", [](ParmParse &pp, std::string_view name, amrex::Box const &val) { pp.add(name, val); })
.def("addarr", py::overload_cast<std::string_view, std::vector<int> const &>(&ParmParse::addarr))
.def("addarr", py::overload_cast<std::string_view, std::vector<long> const &>(&ParmParse::addarr))
.def("addarr", py::overload_cast<std::string_view, std::vector<long long> const &>(&ParmParse::addarr))
Expand Down
6 changes: 5 additions & 1 deletion src/Particle/ParticleTile.H
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,11 @@ void make_ParticleTile(py::module &m, std::string allocstr)

.def("set_num_neighbors", &ParticleTileType::setNumNeighbors)
.def("get_num_neighbors", &ParticleTileType::getNumNeighbors)
.def("resize", &ParticleTileType::resize)
.def("resize",
&ParticleTileType::resize,
py::arg("count"),
py::arg("strategy") = GrowthStrategy::Poisson
)
;

if constexpr (!T_ParticleType::is_soa_particle) {
Expand Down
6 changes: 5 additions & 1 deletion src/Particle/StructOfArrays.H
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ void make_StructOfArrays(py::module &m, std::string allocstr)

.def("set_num_neighbors", &SOAType::setNumNeighbors)
.def("get_num_neighbors", &SOAType::getNumNeighbors)
.def("resize", &SOAType::resize)
.def("resize",
&SOAType::resize,
py::arg("new_size"),
py::arg("strategy") = GrowthStrategy::Poisson
)
;
if (use64BitIdCpu)
py_SoA.def("get_idcpu_data", py::overload_cast<>(&SOAType::GetIdCPUData),
Expand Down
Loading