@@ -215,23 +215,69 @@ void init_MultiFab(py::module &m)
215215 py::arg (" comp" ), py::arg (" ncomp" ), py::arg (" nghost" )
216216 )
217217
218- .def_static (" saxpy" ,
219- py::overload_cast< FabArray<FArrayBox> &, Real, FabArray<FArrayBox> const &, int , int , int , IntVect const & >(&FabArray<FArrayBox>::template Saxpy<FArrayBox>),
220- py::arg (" y" ), py::arg (" a" ), py::arg (" x" ), py::arg (" xcomp" ), py::arg (" ycomp" ), py::arg (" ncomp" ), py::arg (" nghost" ),
221- " y += a*x"
222- )
223- .def_static (" xpay" ,
224- py::overload_cast< FabArray<FArrayBox> &, Real, FabArray<FArrayBox> const &, int , int , int , IntVect const & >(&FabArray<FArrayBox>::template Xpay<FArrayBox>),
225- py::arg (" y" ), py::arg (" a" ), py::arg (" x" ), py::arg (" xcomp" ), py::arg (" ycomp" ), py::arg (" ncomp" ), py::arg (" nghost" ),
226- " y = x + a*y"
227- )
228- .def_static (" lin_comb" ,
229- py::overload_cast< FabArray<FArrayBox> &, Real, FabArray<FArrayBox> const &, int , Real, FabArray<FArrayBox> const &, int , int , int , IntVect const & >(&FabArray<FArrayBox>::template LinComb<FArrayBox>),
230- py::arg (" dst" ),
218+ .def (" saxpy" ,
219+ [](FabArray<FArrayBox> & dst, Real a, FabArray<FArrayBox> const & x, int x_comp, int self_comp, int ncomp, IntVect const & nghost)
220+ {
221+ FabArray<FArrayBox>::Saxpy (dst, a, x, x_comp, self_comp, ncomp, nghost);
222+ },
223+ py::arg (" a" ), py::arg (" x" ), py::arg (" x_comp" ), py::arg (" self_comp" ), py::arg (" ncomp" ), py::arg (" nghost" ),
224+ " self += a*x\n\n "
225+ " Parameters\n "
226+ " ----------\n "
227+ " a : scalar a\n "
228+ " x : FabArray x\n "
229+ " x_comp : starting component of x\n "
230+ " self_comp : starting component of y\n "
231+ " ncomp : number of components\n "
232+ " nghost : number of ghost cells"
233+ )
234+ .def (" xpay" ,
235+ [](FabArray<FArrayBox> & dst, Real a, FabArray<FArrayBox> const & x, int x_comp, int self_comp, int ncomp, IntVect const & nghost)
236+ {
237+ FabArray<FArrayBox>::Xpay (dst, a, x, x_comp, self_comp, ncomp, nghost);
238+ },
239+ py::arg (" a" ), py::arg (" x" ), py::arg (" xcomp" ), py::arg (" self_comp" ), py::arg (" ncomp" ), py::arg (" nghost" ),
240+ " self = x + a*self\n\n "
241+ " Parameters\n "
242+ " ----------\n "
243+ " a : scalar a\n "
244+ " x : FabArray x\n "
245+ " x_comp : starting component of x\n "
246+ " self_comp : starting component of y\n "
247+ " ncomp : number of components\n "
248+ " nghost : number of ghost cells"
249+ )
250+ .def (" lin_comb" ,
251+ [](
252+ FabArray<FArrayBox> & dst,
253+ Real a, FabArray<FArrayBox> const & x, int x_comp,
254+ Real b, FabArray<FArrayBox> const & y, int y_comp,
255+ int self_comp, int ncomp, IntVect const & nghost)
256+ {
257+ FabArray<FArrayBox>::LinComb (dst, a, x, x_comp, b, y, y_comp, self_comp, ncomp, nghost);
258+ },
231259 py::arg (" a" ), py::arg (" x" ), py::arg (" xcomp" ),
232260 py::arg (" b" ), py::arg (" y" ), py::arg (" ycomp" ),
233- py::arg (" dstcomp" ), py::arg (" numcomp" ), py::arg (" nghost" ),
234- " dst = a*x + b*y"
261+ py::arg (" self_comp" ), py::arg (" numcomp" ), py::arg (" nghost" ),
262+ " self = a*x + b*y\n\n "
263+ " Parameters\n "
264+ " ----------\n "
265+ " a : float\n "
266+ " scalar a\n "
267+ " x : FabArray\n "
268+ " xcomp : int\n "
269+ " starting component of x\n "
270+ " b : float\n "
271+ " scalar b\n "
272+ " y : FabArray\n "
273+ " ycomp : int\n "
274+ " starting component of y\n "
275+ " self_comp : int\n "
276+ " starting component of destination\n "
277+ " numcomp : int\n "
278+ " number of components\n "
279+ " nghost : int\n "
280+ " number of ghost cells"
235281 )
236282
237283 .def (" sum" ,
@@ -745,108 +791,136 @@ void init_MultiFab(py::module &m)
745791 )
746792 // .def_static("dot", py::overload_cast< iMultiFab const&, const MultiFab&, int, MultiFab const&, int, int, int, bool >(&MultiFab::Dot))
747793
748- .def_static (" add" ,
749- py::overload_cast< MultiFab &, MultiFab const &, int , int , int , int >(&MultiFab::Add),
750- py::arg (" dst" ), py::arg (" src" ), py::arg (" srccomp" ), py::arg (" dstcomp" ), py::arg (" numcomp" ), py::arg (" nghost" ),
751- " Add src to dst including nghost ghost cells.\n "
794+ .def (" add" ,
795+ [](MultiFab & self, MultiFab const & src, int srccomp, int self_comp, int numcomp, int nghost) {
796+ MultiFab::Add (self, src, srccomp, self_comp, numcomp, nghost);
797+ },
798+ py::arg (" src" ), py::arg (" srccomp" ), py::arg (" self_comp" ), py::arg (" numcomp" ), py::arg (" nghost" ),
799+ " Add src to self including nghost ghost cells.\n "
752800 " The two MultiFabs MUST have the same underlying BoxArray."
753801 )
754- .def_static (" add" ,
755- py::overload_cast< MultiFab &, MultiFab const &, int , int , int , IntVect const & >(&MultiFab::Add),
756- py::arg (" dst" ), py::arg (" src" ), py::arg (" srccomp" ), py::arg (" dstcomp" ), py::arg (" numcomp" ), py::arg (" nghost" ),
757- " Add src to dst including nghost ghost cells.\n "
802+ .def (" add" ,
803+ [](MultiFab & self, MultiFab const & src, int srccomp, int self_comp, int numcomp, IntVect const & nghost) {
804+ MultiFab::Add (self, src, srccomp, self_comp, numcomp, nghost);
805+ },
806+ py::arg (" src" ), py::arg (" srccomp" ), py::arg (" self_comp" ), py::arg (" numcomp" ), py::arg (" nghost" ),
807+ " Add src to self including nghost ghost cells.\n "
758808 " The two MultiFabs MUST have the same underlying BoxArray."
759809 )
760810
761- .def_static (" subtract" ,
762- py::overload_cast< MultiFab &, MultiFab const &, int , int , int , int >(&MultiFab::Subtract),
763- py::arg (" dst" ), py::arg (" src" ), py::arg (" srccomp" ), py::arg (" dstcomp" ), py::arg (" numcomp" ), py::arg (" nghost" ),
764- " Subtract src from dst including nghost ghost cells.\n "
811+ .def (" subtract" ,
812+ [](MultiFab & self, MultiFab const & src, int srccomp, int self_comp, int numcomp, int nghost) {
813+ MultiFab::Subtract (self, src, srccomp, self_comp, numcomp, nghost);
814+ },
815+ py::arg (" src" ), py::arg (" srccomp" ), py::arg (" self_comp" ), py::arg (" numcomp" ), py::arg (" nghost" ),
816+ " Subtract src from self including nghost ghost cells.\n "
765817 " The two MultiFabs MUST have the same underlying BoxArray."
766818 )
767- .def_static (" subtract" ,
768- py::overload_cast< MultiFab &, MultiFab const &, int , int , int , IntVect const & >(&MultiFab::Subtract),
769- py::arg (" dst" ), py::arg (" src" ), py::arg (" srccomp" ), py::arg (" dstcomp" ), py::arg (" numcomp" ), py::arg (" nghost" ),
770- " Subtract src from dst including nghost ghost cells.\n "
819+ .def (" subtract" ,
820+ [](MultiFab & self, MultiFab const & src, int srccomp, int self_comp, int numcomp, IntVect const & nghost) {
821+ MultiFab::Subtract (self, src, srccomp, self_comp, numcomp, nghost);
822+ },
823+ py::arg (" src" ), py::arg (" srccomp" ), py::arg (" self_comp" ), py::arg (" numcomp" ), py::arg (" nghost" ),
824+ " Subtract src from self including nghost ghost cells.\n "
771825 " The two MultiFabs MUST have the same underlying BoxArray."
772826 )
773827
774- .def_static (" multiply" ,
775- py::overload_cast< MultiFab &, MultiFab const &, int , int , int , int >(&MultiFab::Multiply),
776- py::arg (" dst" ), py::arg (" src" ), py::arg (" srccomp" ), py::arg (" dstcomp" ), py::arg (" numcomp" ), py::arg (" nghost" ),
777- " Multiply dst by src including nghost ghost cells.\n "
828+ .def (" multiply" ,
829+ [](MultiFab & self, MultiFab const & src, int srccomp, int self_comp, int numcomp, int nghost) {
830+ MultiFab::Multiply (self, src, srccomp, self_comp, numcomp, nghost);
831+ },
832+ py::arg (" src" ), py::arg (" srccomp" ), py::arg (" self_comp" ), py::arg (" numcomp" ), py::arg (" nghost" ),
833+ " Multiply self by src including nghost ghost cells.\n "
778834 " The two MultiFabs MUST have the same underlying BoxArray."
779835 )
780- .def_static (" multiply" ,
781- py::overload_cast< MultiFab &, MultiFab const &, int , int , int , IntVect const & >(&MultiFab::Multiply),
782- py::arg (" dst" ), py::arg (" src" ), py::arg (" srccomp" ), py::arg (" dstcomp" ), py::arg (" numcomp" ), py::arg (" nghost" ),
783- " Multiply dst by src including nghost ghost cells.\n "
836+ .def (" multiply" ,
837+ [](MultiFab & self, MultiFab const & src, int srccomp, int self_comp, int numcomp, IntVect const & nghost) {
838+ MultiFab::Multiply (self, src, srccomp, self_comp, numcomp, nghost);
839+ },
840+ py::arg (" src" ), py::arg (" srccomp" ), py::arg (" self_comp" ), py::arg (" numcomp" ), py::arg (" nghost" ),
841+ " Multiply self by src including nghost ghost cells.\n "
784842 " The two MultiFabs MUST have the same underlying BoxArray."
785843 )
786844
787- .def_static (" divide" ,
788- py::overload_cast< MultiFab &, MultiFab const &, int , int , int , int >(&MultiFab::Divide),
789- py::arg (" dst" ), py::arg (" src" ), py::arg (" srccomp" ), py::arg (" dstcomp" ), py::arg (" numcomp" ), py::arg (" nghost" ),
790- " Divide dst by src including nghost ghost cells.\n "
845+ .def (" divide" ,
846+ [](MultiFab & self, MultiFab const & src, int srccomp, int self_comp, int numcomp, int nghost) {
847+ MultiFab::Divide (self, src, srccomp, self_comp, numcomp, nghost);
848+ },
849+ py::arg (" src" ), py::arg (" srccomp" ), py::arg (" self_comp" ), py::arg (" numcomp" ), py::arg (" nghost" ),
850+ " Divide self by src including nghost ghost cells.\n "
791851 " The two MultiFabs MUST have the same underlying BoxArray."
792852 )
793- .def_static (" divide" ,
794- py::overload_cast< MultiFab &, MultiFab const &, int , int , int , IntVect const & >(&MultiFab::Divide),
795- py::arg (" dst" ), py::arg (" src" ), py::arg (" srccomp" ), py::arg (" dstcomp" ), py::arg (" numcomp" ), py::arg (" nghost" ),
796- " Divide dst by src including nghost ghost cells.\n "
853+ .def (" divide" ,
854+ [](MultiFab & self, MultiFab const & src, int srccomp, int self_comp, int numcomp, IntVect const & nghost) {
855+ MultiFab::Divide (self, src, srccomp, self_comp, numcomp, nghost);
856+ },
857+ py::arg (" src" ), py::arg (" srccomp" ), py::arg (" self_comp" ), py::arg (" numcomp" ), py::arg (" nghost" ),
858+ " Divide self by src including nghost ghost cells.\n "
797859 " The two MultiFabs MUST have the same underlying BoxArray."
798860 )
799861
800- .def_static (" swap" ,
801- py::overload_cast< MultiFab &, MultiFab &, int , int , int , int >(&MultiFab::Swap),
802- py::arg (" dst" ), py::arg (" src" ), py::arg (" srccomp" ), py::arg (" dstcomp" ), py::arg (" numcomp" ), py::arg (" nghost" ),
803- " Swap from src to dst including nghost ghost cells.\n "
862+ .def (" swap" ,
863+ [](MultiFab & self, MultiFab & src, int srccomp, int self_comp, int numcomp, int nghost) {
864+ MultiFab::Swap (self, src, srccomp, self_comp, numcomp, nghost);
865+ },
866+ py::arg (" src" ), py::arg (" srccomp" ), py::arg (" self_comp" ), py::arg (" numcomp" ), py::arg (" nghost" ),
867+ " Swap from src to self including nghost ghost cells.\n "
804868 " The two MultiFabs MUST have the same underlying BoxArray.\n "
805869 " The swap is local."
806870 )
807- .def_static (" swap" ,
808- py::overload_cast< MultiFab &, MultiFab &, int , int , int , IntVect const & >(&MultiFab::Swap),
809- py::arg (" dst" ), py::arg (" src" ), py::arg (" srccomp" ), py::arg (" dstcomp" ), py::arg (" numcomp" ), py::arg (" nghost" ),
810- " Swap from src to dst including nghost ghost cells.\n "
871+ .def (" swap" ,
872+ [](MultiFab & self, MultiFab & src, int srccomp, int self_comp, int numcomp, IntVect const & nghost) {
873+ MultiFab::Swap (self, src, srccomp, self_comp, numcomp, nghost);
874+ },
875+ py::arg (" src" ), py::arg (" srccomp" ), py::arg (" self_comp" ), py::arg (" numcomp" ), py::arg (" nghost" ),
876+ " Swap from src to self including nghost ghost cells.\n "
811877 " The two MultiFabs MUST have the same underlying BoxArray.\n "
812878 " The swap is local."
813879 )
814880
815- .def_static (" saxpy" ,
816- // py::overload_cast< MultiFab &, Real, MultiFab const &, int, int, int, int >(&MultiFab::Saxpy)
817- static_cast <void (*)(MultiFab &, Real, MultiFab const &, int , int , int , int )>(&MultiFab::Saxpy),
818- py::arg (" dst" ), py::arg (" a" ), py::arg (" src" ), py::arg (" srccomp" ), py::arg (" dstcomp" ), py::arg (" numcomp" ), py::arg (" nghost" ),
819- " dst += a*src"
881+ .def (" saxpy" ,
882+ [](MultiFab & self, Real a, MultiFab const & src, int srccomp, int self_comp, int numcomp, int nghost) {
883+ MultiFab::Saxpy (self, a, src, srccomp, self_comp, numcomp, nghost);
884+ },
885+ py::arg (" a" ), py::arg (" src" ), py::arg (" srccomp" ), py::arg (" self_comp" ), py::arg (" numcomp" ), py::arg (" nghost" ),
886+ " self += a * src"
820887 )
821888
822- .def_static (" xpay" ,
823- // py::overload_cast< MultiFab &, Real, MultiFab const &, int, int, int, int >(&MultiFab::Xpay)
824- static_cast <void (*)(MultiFab &, Real, MultiFab const &, int , int , int , int )>(&MultiFab::Xpay),
825- py::arg (" dst" ), py::arg (" a" ), py::arg (" src" ), py::arg (" srccomp" ), py::arg (" dstcomp" ), py::arg (" numcomp" ), py::arg (" nghost" ),
826- " dst = src + a*dst"
889+ .def (" xpay" ,
890+ [](MultiFab & self, Real a, MultiFab const & src, int srccomp, int self_comp, int numcomp, int nghost) {
891+ MultiFab::Xpay (self, a, src, srccomp, self_comp, numcomp, nghost);
892+ },
893+ py::arg (" a" ), py::arg (" src" ), py::arg (" srccomp" ), py::arg (" self_comp" ), py::arg (" numcomp" ), py::arg (" nghost" ),
894+ " self = src + a * self"
827895 )
828896
829- .def_static (" lin_comb" ,
830- // py::overload_cast< MultiFab &, Real, MultiFab const &, int, Real, MultiFab const &, int, int, int, int >(&MultiFab::LinComb)
831- static_cast < void (*)(MultiFab &, Real, MultiFab const &, int , Real, MultiFab const &, int , int , int , int )>(&MultiFab::LinComb),
832- py::arg ( " dst " ) ,
897+ .def (" lin_comb" ,
898+ []( MultiFab & self , Real a , MultiFab const & x , int x_comp , Real b , MultiFab const & y , int y_comp , int self_comp , int numcomp , int nghost) {
899+ MultiFab::LinComb (self, a, x, x_comp, b, y, y_comp, self_comp, numcomp, nghost);
900+ } ,
833901 py::arg (" a" ), py::arg (" x" ), py::arg (" x_comp" ),
834902 py::arg (" b" ), py::arg (" y" ), py::arg (" y_comp" ),
835- py::arg (" dstcomp " ), py::arg (" numcomp" ), py::arg (" nghost" ),
836- " dst = a* x + b* y"
903+ py::arg (" self_comp " ), py::arg (" numcomp" ), py::arg (" nghost" ),
904+ " self = a * x + b * y"
837905 )
838906
839- .def_static (" add_product" ,
840- py::overload_cast< MultiFab &, MultiFab const &, int , MultiFab const &, int , int , int , int >(&MultiFab::AddProduct),
841- py::arg (" dst" ),
907+ .def (" add_product" ,
908+ [](MultiFab & self, MultiFab const & src1, int comp1, MultiFab const & src2, int comp2, int self_comp, int numcomp, int nghost) {
909+ MultiFab::AddProduct (self, src1, comp1, src2, comp2, self_comp, numcomp, nghost);
910+ },
842911 py::arg (" src1" ), py::arg (" comp1" ),
843912 py::arg (" src2" ), py::arg (" comp2" ),
844- py::arg (" dstcomp " ), py::arg (" numcomp" ), py::arg (" nghost" ),
845- " dst += src1* src2"
913+ py::arg (" self_comp " ), py::arg (" numcomp" ), py::arg (" nghost" ),
914+ " self += src1 * src2"
846915 )
847- .def_static (" add_product" ,
848- py::overload_cast< MultiFab &, MultiFab const &, int , MultiFab const &, int , int , int , IntVect const & >(&MultiFab::AddProduct),
849- " dst += src1*src2"
916+ .def (" add_product" ,
917+ [](MultiFab & self, MultiFab const & src1, int comp1, MultiFab const & src2, int comp2, int self_comp, int numcomp, IntVect const & nghost) {
918+ MultiFab::AddProduct (self, src1, comp1, src2, comp2, self_comp, numcomp, nghost);
919+ },
920+ py::arg (" src1" ), py::arg (" comp1" ),
921+ py::arg (" src2" ), py::arg (" comp2" ),
922+ py::arg (" self_comp" ), py::arg (" numcomp" ), py::arg (" nghost" ),
923+ " self += src1 * src2"
850924 )
851925
852926 /* simple data validity checks */
0 commit comments