xref: /petsc/src/binding/petsc4py/demo/legacy/poisson3d/del2lib.f90 (revision 5a48edb989d3ea10d6aff6c0e26d581c18691deb)
1! file: del2lib.f90
2
3! to build a Python module, use this:
4! $$ f2py -m del2lib -c del2lib.f90
5
6subroutine del2apply (n, F, x, y)
7
8  !f2py intent(hide) :: n=shape(F,0)-2
9  integer      , intent(in)    :: n
10  real(kind=8) , intent(inout) :: F(0:n+1,0:n+1,0:n+1)
11  real(kind=8) , intent(in)    :: x(n,n,n)
12  real(kind=8) , intent(inout) :: y(n,n,n)
13
14  F(1:n,1:n,1:n) = x
15
16  y(:,:,:) = 6.0 * F(1:n,1:n,1:n) &
17           - F(0:n-1,1:n,1:n)     &
18           - F(2:n+1,1:n,1:n)     &
19           - F(1:n,0:n-1,1:n)     &
20           - F(1:n,2:n+1,1:n)     &
21           - F(1:n,1:n,0:n-1)     &
22           - F(1:n,1:n,2:n+1)
23
24end subroutine del2apply
25