Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] MultiFab: Static to Member Math Methods #301

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
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
74 changes: 60 additions & 14 deletions src/Base/MultiFab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,23 +215,69 @@ void init_MultiFab(py::module &m)
py::arg("comp"), py::arg("ncomp"), py::arg("nghost")
)

.def_static("saxpy",
py::overload_cast< FabArray<FArrayBox> &, Real, FabArray<FArrayBox> const &, int, int, int, IntVect const & >(&FabArray<FArrayBox>::template Saxpy<FArrayBox>),
py::arg("y"), py::arg("a"), py::arg("x"), py::arg("xcomp"), py::arg("ycomp"), py::arg("ncomp"), py::arg("nghost"),
"y += a*x"
)
.def_static("xpay",
py::overload_cast< FabArray<FArrayBox> &, Real, FabArray<FArrayBox> const &, int, int, int, IntVect const & >(&FabArray<FArrayBox>::template Xpay<FArrayBox>),
py::arg("y"), py::arg("a"), py::arg("x"), py::arg("xcomp"), py::arg("ycomp"), py::arg("ncomp"), py::arg("nghost"),
"y = x + a*y"
)
.def_static("lin_comb",
py::overload_cast< FabArray<FArrayBox> &, Real, FabArray<FArrayBox> const &, int, Real, FabArray<FArrayBox> const &, int, int, int, IntVect const & >(&FabArray<FArrayBox>::template LinComb<FArrayBox>),
py::arg("dst"),
.def("saxpy",
[](FabArray<FArrayBox> & dst, Real a, FabArray<FArrayBox> const & x, int x_comp, int dst_comp, int ncomp, IntVect const & nghost)
{
FabArray<FArrayBox>::Saxpy(dst, a, x, x_comp, dst_comp, ncomp, nghost);
},
py::arg("a"), py::arg("x"), py::arg("x_comp"), py::arg("dst_comp"), py::arg("ncomp"), py::arg("nghost"),
"self += a*x\n\n"
"Parameters\n"
"----------\n"
"a : scalar a\n"
"x : FabArray x\n"
"x_comp : starting component of x\n"
"dst_comp : starting component of y\n"
"ncomp : number of components\n"
"nghost : number of ghost cells"
)
.def("xpay",
[](FabArray<FArrayBox> & dst, Real a, FabArray<FArrayBox> const & x, int x_comp, int dst_comp, int ncomp, IntVect const & nghost)
{
FabArray<FArrayBox>::Xpay(dst, a, x, x_comp, dst_comp, ncomp, nghost);
},
py::arg("a"), py::arg("x"), py::arg("xcomp"), py::arg("dst_comp"), py::arg("ncomp"), py::arg("nghost"),
"self = x + a*self\n\n"
"Parameters\n"
"----------\n"
"a : scalar a\n"
"x : FabArray x\n"
"x_comp : starting component of x\n"
"dst_comp : starting component of y\n"
"ncomp : number of components\n"
"nghost : number of ghost cells"
)
.def("lin_comb",
[](
FabArray<FArrayBox> & dst,
Real a, FabArray<FArrayBox> const & x, int x_comp,
Real b, FabArray<FArrayBox> const & y, int y_comp,
int dst_comp, int ncomp, IntVect const & nghost)
{
FabArray<FArrayBox>::LinComb(dst, a, x, x_comp, b, y, y_comp, dst_comp, ncomp, nghost);
},
py::arg("a"), py::arg("x"), py::arg("xcomp"),
py::arg("b"), py::arg("y"), py::arg("ycomp"),
py::arg("dstcomp"), py::arg("numcomp"), py::arg("nghost"),
"dst = a*x + b*y"
"self = a*x + b*y\n\n"
"Parameters\n"
"----------\n"
"a : float\n"
" scalar a\n"
"x : FabArray\n"
"xcomp : int\n"
" starting component of x\n"
"b : float\n"
" scalar b\n"
"y : FabArray\n"
"ycomp : int\n"
" starting component of y\n"
"dstcomp : int\n"
" starting component of destination\n"
"numcomp : int\n"
" number of components\n"
"nghost : int\n"
" number of ghost cells"
)

.def("sum",
Expand Down
Loading