Skip to content

Commit b57b216

Browse files
committed
More iMultiFab Methods
Enhanced in AMReX this year via AMReX-Codes/amrex#4410
1 parent 72ac3ea commit b57b216

File tree

1 file changed

+51
-78
lines changed

1 file changed

+51
-78
lines changed

src/Base/MultiFab.H

Lines changed: 51 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -477,23 +477,14 @@ factory :
477477
"Add src to self including nghost ghost cells.\n"
478478
"The two MultiFabs MUST have the same underlying BoxArray."
479479
)
480-
;
481-
482-
// TODO: Missing in iMultiFab https://github.com/AMReX-Codes/amrex/issues/4317
483-
if constexpr (std::is_same_v<T, MultiFab>) {
484-
py_MultiFab
485-
.def("add",
486-
[](T &self, T const &src, int srccomp, int comp, int numcomp, IntVect const &nghost) {
487-
T::Add(self, src, srccomp, comp, numcomp, nghost);
488-
},
489-
py::arg("src"), py::arg("srccomp"), py::arg("comp"), py::arg("numcomp"), py::arg("nghost"),
490-
"Add src to self including nghost ghost cells.\n"
491-
"The two MultiFabs MUST have the same underlying BoxArray."
492-
)
493-
;
494-
}
495-
496-
py_MultiFab
480+
.def("add",
481+
[](T &self, T const &src, int srccomp, int comp, int numcomp, IntVect const &nghost) {
482+
T::Add(self, src, srccomp, comp, numcomp, nghost);
483+
},
484+
py::arg("src"), py::arg("srccomp"), py::arg("comp"), py::arg("numcomp"), py::arg("nghost"),
485+
"Add src to self including nghost ghost cells.\n"
486+
"The two MultiFabs MUST have the same underlying BoxArray."
487+
)
497488
.def("copymf",
498489
[](T &self, T const &src, int srccomp, int dstcomp, int numcomp, int nghost) {
499490
T::Copy(self, src, srccomp, dstcomp, numcomp, nghost);
@@ -527,23 +518,14 @@ factory :
527518
"Subtract src from self including nghost ghost cells.\n"
528519
"The two MultiFabs MUST have the same underlying BoxArray."
529520
)
530-
;
531-
532-
// TODO: Missing in iMultiFab https://github.com/AMReX-Codes/amrex/issues/4317
533-
if constexpr (std::is_same_v<T, MultiFab>) {
534-
py_MultiFab
535-
.def("subtract",
536-
[](T & self, T const & src, int srccomp, int comp, int numcomp, IntVect const & nghost) {
537-
T::Subtract(self, src, srccomp, comp, numcomp, nghost);
538-
},
539-
py::arg("src"), py::arg("srccomp"), py::arg("comp"), py::arg("numcomp"), py::arg("nghost"),
540-
"Subtract src from self including nghost ghost cells.\n"
541-
"The two MultiFabs MUST have the same underlying BoxArray."
542-
)
543-
;
544-
}
545-
546-
py_MultiFab
521+
.def("subtract",
522+
[](T & self, T const & src, int srccomp, int comp, int numcomp, IntVect const & nghost) {
523+
T::Subtract(self, src, srccomp, comp, numcomp, nghost);
524+
},
525+
py::arg("src"), py::arg("srccomp"), py::arg("comp"), py::arg("numcomp"), py::arg("nghost"),
526+
"Subtract src from self including nghost ghost cells.\n"
527+
"The two MultiFabs MUST have the same underlying BoxArray."
528+
)
547529
.def("multiply",
548530
[](T & self, T const & src, int srccomp, int comp, int numcomp, int nghost) {
549531
T::Multiply(self, src, srccomp, comp, numcomp, nghost);
@@ -552,22 +534,14 @@ factory :
552534
"Multiply self by src including nghost ghost cells.\n"
553535
"The two MultiFabs MUST have the same underlying BoxArray."
554536
)
555-
;
556-
557-
// TODO: Missing in iMultiFab
558-
if constexpr (std::is_same_v<T, MultiFab>) {
559-
py_MultiFab
560-
.def("multiply",
561-
[](T &self, T const &src, int srccomp, int comp, int numcomp, IntVect const &nghost) {
562-
T::Multiply(self, src, srccomp, comp, numcomp, nghost);
563-
},
564-
py::arg("src"), py::arg("srccomp"), py::arg("comp"), py::arg("numcomp"), py::arg("nghost"),
565-
"Multiply self by src including nghost ghost cells.\n"
566-
"The two MultiFabs MUST have the same underlying BoxArray."
567-
);
568-
}
569-
570-
py_MultiFab
537+
.def("multiply",
538+
[](T &self, T const &src, int srccomp, int comp, int numcomp, IntVect const &nghost) {
539+
T::Multiply(self, src, srccomp, comp, numcomp, nghost);
540+
},
541+
py::arg("src"), py::arg("srccomp"), py::arg("comp"), py::arg("numcomp"), py::arg("nghost"),
542+
"Multiply self by src including nghost ghost cells.\n"
543+
"The two MultiFabs MUST have the same underlying BoxArray."
544+
)
571545
.def("divide",
572546
[](T & self, T const & src, int srccomp, int comp, int numcomp, int nghost) {
573547
T::Divide(self, src, srccomp, comp, numcomp, nghost);
@@ -576,38 +550,37 @@ factory :
576550
"Divide self by src including nghost ghost cells.\n"
577551
"The two MultiFabs MUST have the same underlying BoxArray."
578552
)
553+
.def("divide", /* TODO: Missing in iMultiFab https://github.com/AMReX-Codes/amrex/issues/4317 */
554+
[](T &self, T const &src, int srccomp, int comp, int numcomp, IntVect const &nghost) {
555+
T::Divide(self, src, srccomp, comp, numcomp, nghost);
556+
},
557+
py::arg("src"), py::arg("srccomp"), py::arg("comp"), py::arg("numcomp"), py::arg("nghost"),
558+
"Divide self by src including nghost ghost cells.\n"
559+
"The two MultiFabs MUST have the same underlying BoxArray."
560+
)
561+
562+
.def("swap", /* TODO: Missing in iMultiFab https://github.com/AMReX-Codes/amrex/issues/4317 */
563+
[](T &self, T &src, int srccomp, int comp, int numcomp, int nghost) {
564+
T::Swap(self, src, srccomp, comp, numcomp, nghost);
565+
},
566+
py::arg("src"), py::arg("srccomp"), py::arg("comp"), py::arg("numcomp"), py::arg("nghost"),
567+
"Swap from src to self including nghost ghost cells.\n"
568+
"The two MultiFabs MUST have the same underlying BoxArray.\n"
569+
"The swap is local."
570+
)
571+
.def("swap", /* TODO: Missing in iMultiFab https://github.com/AMReX-Codes/amrex/issues/4317 */
572+
[](T &self, T &src, int srccomp, int comp, int numcomp, IntVect const &nghost) {
573+
T::Swap(self, src, srccomp, comp, numcomp, nghost);
574+
},
575+
py::arg("src"), py::arg("srccomp"), py::arg("comp"), py::arg("numcomp"), py::arg("nghost"),
576+
"Swap from src to self including nghost ghost cells.\n"
577+
"The two MultiFabs MUST have the same underlying BoxArray.\n"
578+
"The swap is local."
579+
)
579580
;
580581

581582
if constexpr (std::is_same_v<T, MultiFab>) {
582583
py_MultiFab
583-
.def("divide", /* TODO: Missing in iMultiFab https://github.com/AMReX-Codes/amrex/issues/4317 */
584-
[](T &self, T const &src, int srccomp, int comp, int numcomp, IntVect const &nghost) {
585-
T::Divide(self, src, srccomp, comp, numcomp, nghost);
586-
},
587-
py::arg("src"), py::arg("srccomp"), py::arg("comp"), py::arg("numcomp"), py::arg("nghost"),
588-
"Divide self by src including nghost ghost cells.\n"
589-
"The two MultiFabs MUST have the same underlying BoxArray."
590-
)
591-
592-
.def("swap", /* TODO: Missing in iMultiFab https://github.com/AMReX-Codes/amrex/issues/4317 */
593-
[](T &self, T &src, int srccomp, int comp, int numcomp, int nghost) {
594-
T::Swap(self, src, srccomp, comp, numcomp, nghost);
595-
},
596-
py::arg("src"), py::arg("srccomp"), py::arg("comp"), py::arg("numcomp"), py::arg("nghost"),
597-
"Swap from src to self including nghost ghost cells.\n"
598-
"The two MultiFabs MUST have the same underlying BoxArray.\n"
599-
"The swap is local."
600-
)
601-
.def("swap", /* TODO: Missing in iMultiFab https://github.com/AMReX-Codes/amrex/issues/4317 */
602-
[](T &self, T &src, int srccomp, int comp, int numcomp, IntVect const &nghost) {
603-
T::Swap(self, src, srccomp, comp, numcomp, nghost);
604-
},
605-
py::arg("src"), py::arg("srccomp"), py::arg("comp"), py::arg("numcomp"), py::arg("nghost"),
606-
"Swap from src to self including nghost ghost cells.\n"
607-
"The two MultiFabs MUST have the same underlying BoxArray.\n"
608-
"The swap is local."
609-
)
610-
611584
.def("saxpy",
612585
[](T & self, value_type a, T const & src, int srccomp, int comp, int numcomp, int nghost) {
613586
T::Saxpy(self, a, src, srccomp, comp, numcomp, nghost);

0 commit comments

Comments
 (0)