Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
numpy
GitHub Repository: numpy/numpy
Path: blob/main/numpy/f2py/tests/src/abstract_interface/foo.f90
1725 views
1
module ops_module
2
3
abstract interface
4
subroutine op(x, y, z)
5
integer, intent(in) :: x, y
6
integer, intent(out) :: z
7
end subroutine
8
end interface
9
10
contains
11
12
subroutine foo(x, y, r1, r2)
13
integer, intent(in) :: x, y
14
integer, intent(out) :: r1, r2
15
procedure (op) add1, add2
16
procedure (op), pointer::p
17
p=>add1
18
call p(x, y, r1)
19
p=>add2
20
call p(x, y, r2)
21
end subroutine
22
end module
23
24
subroutine add1(x, y, z)
25
integer, intent(in) :: x, y
26
integer, intent(out) :: z
27
z = x + y
28
end subroutine
29
30
subroutine add2(x, y, z)
31
integer, intent(in) :: x, y
32
integer, intent(out) :: z
33
z = x + 2 * y
34
end subroutine
35
36