
![]() | Callbacks are expensive |
![]() | Even vectorized callback functions degrades performace a bit |
![]() | Alternative: implement ``callback'' in F77 |
![]() | Flexibility from the Python side: use a string to switch between the ``callback'' (F77) functions
a = ext_gridloop.gridloop2_str(self.xcoor, self.ycoor, 'myfunc')F77 wrapper:
subroutine gridloop2_str(xcoor, ycoor, func_str)
character*(*) func_str
...
if (func_str .eq. 'myfunc') then
call gridloop2(a, xcoor, ycoor, nx, ny, myfunc)
else if (func_str .eq. 'f2') then
call gridloop2(a, xcoor, ycoor, nx, ny, f2)
...
|