read_surf Subroutine

subroutine read_surf(nom_fic, tab_s, nx, ny)

Subroutine that opens a surface file .dat

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: nom_fic

file name

real(kind=R8), intent(out), dimension(:,:), allocatable :: tab_s

height array

integer(kind=I4), intent(in) :: nx

number of pixels along x

integer(kind=I4), intent(in) :: ny

number of pixels along y


Calls

proc~~read_surf~~CallsGraph proc~read_surf read_surf proc~get_unit~2 get_unit proc~read_surf->proc~get_unit~2

Called by

proc~~read_surf~~CalledByGraph proc~read_surf read_surf program~test_fftw3 test_fftw3 program~test_fftw3->proc~read_surf

Source Code

   subroutine read_surf(nom_fic, tab_s, nx, ny)
   !! Subroutine that opens a surface file ```.dat```
   implicit none
   character(len=*), intent(in )                               :: nom_fic  !! *file name*
   integer(kind=I4), intent(in )                               :: nx       !! *number of pixels along x*
   integer(kind=I4), intent(in )                               :: ny       !! *number of pixels along y*
   real   (kind=R8), intent(out), dimension(:,:), allocatable  :: tab_s    !! *height array*

      integer(kind=I4) :: i, j, k
      real(kind=R8)    :: x, y

      allocate( tab_s(1:nx, 1:ny) )

      call get_unit(k)

      open( unit = k, file = trim(nom_fic), status = 'old')

         do i = 1, nx
            do j = 1, ny
               read(k, *) x, y, tab_s(i, j)
            enddo
         enddo

      close(k)

   return
   endsubroutine read_surf