Subroutine that opens a surface file .dat
Type | Intent | Optional | 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 |
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