[Fortran] syntaxhighlighter_viewsource syntaxhighlighter_copycode
module rksuite_90_prec
  implicit none
  integer, parameter :: wp=selected_real_kind(P=15)
end module rksuite_90_prec
module rksuite_90
  implicit none
contains
  recursive subroutine range_integrate_r1(comm,f,t_want,t_got,y_got,yderiv_got,flag)
    implicit none
    real :: comm, t_want, t_got, y_got, yderiv_got, flag
    interface
       function f(t,y)
          use rksuite_90_prec, only:wp
          implicit none
          real(kind=wp), intent(in) :: t
          real(kind=wp), dimension(:), intent(in) :: y
          real(kind=wp), dimension(size(y,1)) :: f
       end function f
    end interface
    !...
  end subroutine range_integrate_r1
end module rksuite_90
program ode
  use rksuite_90
  implicit none
  real :: comm, t_want, t_got, y_got, yderiv_got, flag
  interface
     function f(t,y)
       use rksuite_90_prec, only:wp
       implicit none
       real(kind=wp), intent(in) :: t
       real(kind=wp), dimension(:), intent(in) :: y
       real(kind=wp), dimension(size(y,1)) :: f
     end function f
  end interface
  call range_integrate_r1(comm,f,t_want,t_got,y_got,yderiv_got,flag)
end program ode
function f(t,y)
  use rksuite_90_prec, only:wp
  implicit none
  real(kind=wp), intent(in) :: t
  real(kind=wp), dimension(:), intent(in) :: y
  real(kind=wp), dimension(size(y,1)) :: f
  f(1) = y(2)
  f(2) =-y(1)
end function f