diff --git a/src/Base/BoxArray.cpp b/src/Base/BoxArray.cpp index 72b64781..41da166c 100644 --- a/src/Base/BoxArray.cpp +++ b/src/Base/BoxArray.cpp @@ -120,14 +120,14 @@ void init_BoxArray(py::module &m) { //! \brief Grow each Box in the BoxArray on the high end //! by n_cell cells in the idir direction. BoxArray& growHi (int idir, int n_cell); - //! \brief Apply surroundingNodes(Box) to each Box in BoxArray. - //! See the documentation of Box for details. - BoxArray& surroundingNodes (); - //! +*/ + //! \brief Apply surroundingNodes(Box,int) to each Box in //! BoxArray. See the documentation of Box for details. - BoxArray& surroundingNodes (int dir); -*/ + .def("surroundingNodes", + py::overload_cast<>(&BoxArray::surroundingNodes)) + .def("surroundingNodes", + py::overload_cast(&BoxArray::surroundingNodes)) //! Apply Box::enclosedCells() to each Box in the BoxArray. .def("enclosed_cells", @@ -135,15 +135,12 @@ void init_BoxArray(py::module &m) { .def("enclosed_cells", py::overload_cast(&BoxArray::enclosedCells)) + //! Convert nodality of each box in the BoxArray + .def("convert", + py::overload_cast< IndexType >(&BoxArray::convert)) + .def("convert", + py::overload_cast< IntVect const &>(&BoxArray::convert)) /* - //! Apply Box::convert(IndexType) to each Box in the BoxArray. - BoxArray& convert (IndexType typ); - - BoxArray& convert (const IntVect& typ); - - //! Apply function (*fp)(Box) to each Box in the BoxArray. - BoxArray& convert (Box (*fp)(const Box&)); - //! Apply Box::shift(int,int) to each Box in the BoxArray. BoxArray& shift (int dir, int nzones); diff --git a/src/Base/MultiFab.H b/src/Base/MultiFab.H index a772df34..d8adfce0 100644 --- a/src/Base/MultiFab.H +++ b/src/Base/MultiFab.H @@ -493,6 +493,31 @@ factory : ; } + py_MultiFab + .def("copymf", + [](T &self, T const &src, int srccomp, int dstcomp, int numcomp, int nghost) { + T::Copy(self, src, srccomp, dstcomp, numcomp, nghost); + }, + py::arg("src"), py::arg("srccomp"), py::arg("dstcomp"), py::arg("numcomp"), py::arg("nghost"), + "Copy from src to self including nghost ghost cells.\n" + "The two MultiFabs MUST have the same underlying BoxArray. The copy is local" + ) + ; + + // TODO: Missing in iMultiFab https://github.com/AMReX-Codes/amrex/issues/4317 + if constexpr (std::is_same_v) { + py_MultiFab + .def("copymf", + [](T &self, T const &src, int srccomp, int dstcomp, int numcomp, IntVect const &nghost) { + T::Copy(self, src, srccomp, dstcomp, numcomp, nghost); + }, + py::arg("src"), py::arg("srccomp"), py::arg("dstcomp"), py::arg("numcomp"), py::arg("nghost"), + "Copy from src to self including nghost ghost cells.\n" + "The two MultiFabs MUST have the same underlying BoxArray. The copy is local" + ) + ; + } + py_MultiFab .def("subtract", [](T & self, T const & src, int srccomp, int comp, int numcomp, int nghost) { diff --git a/src/Base/MultiFab.cpp b/src/Base/MultiFab.cpp index e95f081b..090de3fc 100644 --- a/src/Base/MultiFab.cpp +++ b/src/Base/MultiFab.cpp @@ -105,4 +105,5 @@ void init_MultiFab(py::module &m, py::class_< amrex::MFIter > & py_MFIter) m.def("copy_mfab", py::overload_cast< MultiFab &, MultiFab const &, int, int, int, int >(&MultiFab::Copy), py::arg("dst"), py::arg("src"), py::arg("srccomp"), py::arg("dstcomp"), py::arg("numcomp"), py::arg("nghost")) .def("copy_mfab", py::overload_cast< MultiFab &, MultiFab const &, int, int, int, IntVect const & >(&MultiFab::Copy), py::arg("dst"), py::arg("src"), py::arg("srccomp"), py::arg("dstcomp"), py::arg("numcomp"), py::arg("nghost")); + }