| 12 | #include <AMReX_IntVect.H> |
| 13 | |
| 14 | void init_MultiFabRegister (py::module & m) |
| 15 | { |
| 16 | using namespace ablastr::fields; |
| 17 | |
| 18 | py::class_<ablastr::fields::Direction> pyDirection(m, "Direction"); |
| 19 | pyDirection |
| 20 | .def(py::init<int>()) |
| 21 | .def(py::init<std::string>()) |
| 22 | #if defined(WARPX_DIM_RZ) || defined(WARPX_DIM_RCYLINDER) || defined(WARPX_DIM_RSPHERE) |
| 23 | .def_property_readonly_static("r", [](py::object /* self */) { |
| 24 | return ablastr::fields::Direction::r; |
| 25 | }) |
| 26 | #endif |
| 27 | #if defined(WARPX_DIM_RZ) || defined(WARPX_DIM_RCYLINDER) || defined(WARPX_DIM_RSPHERE) |
| 28 | .def_property_readonly_static("theta", [](py::object /* self */) { |
| 29 | return ablastr::fields::Direction::theta; |
| 30 | }) |
| 31 | #endif |
| 32 | |
| 33 | #if defined(WARPX_DIM_RSPHERE) |
| 34 | .def_property_readonly_static("phi", [](py::object /* self */) { |
| 35 | return ablastr::fields::Direction::phi; |
| 36 | }) |
| 37 | #endif |
| 38 | #if defined(WARPX_DIM_3D) || defined(WARPX_DIM_XZ) || defined(WARPX_DIM_1D_Z) |
| 39 | .def_property_readonly_static("x", [](py::object /* self */) { |
| 40 | return ablastr::fields::Direction::x; |
| 41 | }) |
| 42 | #endif |
| 43 | #if defined(WARPX_DIM_3D) || defined(WARPX_DIM_XZ) || defined(WARPX_DIM_1D_Z) |
| 44 | .def_property_readonly_static("y", [](py::object /* self */) { |
| 45 | return ablastr::fields::Direction::y; |
| 46 | }) |
| 47 | #endif |
| 48 | #if !defined(WARPX_DIM_RSPHERE) |
| 49 | .def_property_readonly_static("z", [](py::object /* self */) { |
| 50 | return ablastr::fields::Direction::z; |
| 51 | }) |
| 52 | #endif |
| 53 | ; |
| 54 | py::implicitly_convertible<std::string, ablastr::fields::Direction>(); |
| 55 | |
| 56 | py::class_<ablastr::fields::MultiFabRegister>(m, "MultiFabRegister") |
| 57 | |
| 58 | .def("alloc_init", |
| 59 | py::overload_cast< |
| 60 | std::string, |
| 61 | int, |
| 62 | amrex::BoxArray const &, |
| 63 | amrex::DistributionMapping const &, |
| 64 | int, |
| 65 | amrex::IntVect const &, |
| 66 | std::optional<const amrex::Real>, |
| 67 | bool, |
| 68 | bool |
| 69 | >(&MultiFabRegister::alloc_init<std::string>), |
| 70 | py::return_value_policy::reference_internal, |
| 71 | py::arg("name"), |