File: legacy_array_sections_07.f90

package info (click to toggle)
lfortran 0.59.0-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 56,736 kB
  • sloc: cpp: 168,052; f90: 74,272; python: 17,537; ansic: 7,705; yacc: 2,345; sh: 1,334; fortran: 895; makefile: 37; javascript: 15
file content (29 lines) | stat: -rw-r--r-- 995 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
module legacy_array_sections_07_module                                                           !! [order = polynomial degree + 1]
   interface db1ink
      module procedure :: db1ink_default
   end interface
   public :: db1ink
     contains
   pure subroutine db1ink_default(x)
      implicit none
      real(4), dimension(:), intent(in) :: x
      call check_inputs(x=x)
   end subroutine db1ink_default
   pure subroutine check_inputs(x, y)
      implicit none
      real(4), dimension(:), intent(in), optional :: x, y
   end subroutine check_inputs
end module legacy_array_sections_07_module
program legacy_array_sections_07
    use legacy_array_sections_07_module
    implicit none
    real :: x(5), y(2)
    x = [1.0, 2.0, 3.0, 4.0, 5.0]
    y = [6.0, 7.0]
    call db1ink_default(x)
    print *, x
    if (any(x - [1.0, 2.0, 3.0, 4.0, 5.0] > 1e-6)) error stop
    call check_inputs(x, y)
    print *, y
    if (any(y - [6.0, 7.0] > 1e-6)) error stop
end program legacy_array_sections_07