Debian Codegraph @

gcc/testsuite/gfortran.dg/import9.f90

raw
1 ! { dg-do compile }
2 !
3 ! PR fortran/48821
4 !
5 ! Contributed by Daniel Carrera
6 !
7
8 contains
9 pure subroutine rk4_vec(t, Y, dY, h)
10 real, intent(inout) :: t, Y(:)
11 real, intent(in) :: h
12 real, dimension(size(Y)) :: k1, k2, k3, k4
13
14 interface
15 pure function dY(t0, y0)
16 import :: Y
17 real, intent(in) :: t0, y0(size(Y))
18 real :: dY(size(y0))
19 end function
20 end interface
21
22 k1 = dY(t, Y)
23 k2 = dY(t + h/2, Y + k1*h/2)
24 k3 = dY(t + h/2, Y + k2*h/2)
25 k4 = dY(t + h , Y + k3*h)
26
27 Y = Y + (k1 + 2*k2 + 2*k3 + k4) * h/6
28 t = t + h
29 end subroutine
30 end