@@ -9,35 +9,21 @@ module mod_io
99 public :: read_binary_file
1010
1111 interface read_binary_file
12- module procedure :: read_binary_file_1d, read_binary_file_2d
13- end interface read_binary_file
1412
15- contains
16-
17- subroutine read_binary_file_1d (filename , dtype , nrec , array )
18- character (len=* ), intent (in ) :: filename
19- integer (ik), intent (in ) :: dtype, nrec
20- real (rk), allocatable , intent (in out ) :: array(:)
21- integer (ik) :: fileunit
22- allocate (array(nrec))
23- open (newunit= fileunit, file= filename, access= ' direct' ,&
24- action= ' read' , recl= dtype * nrec, status= ' old' )
25- read (fileunit, rec= 1 ) array
26- close (fileunit)
27- end subroutine read_binary_file_1d
28-
29- subroutine read_binary_file_2d (filename , dtype , dsize , nrec , array )
30- character (len=* ), intent (in ) :: filename
31- integer (ik), intent (in ) :: dtype, dsize, nrec
32- real (rk), allocatable , intent (in out ) :: array(:,:)
33- integer (ik) :: fileunit, i
34- allocate (array(dsize, nrec))
35- open (newunit= fileunit, file= filename, access= ' direct' ,&
36- action= ' read' , recl= dtype * dsize, status= ' old' )
37- do i = 1 , nrec
38- read (fileunit, rec= i) array(:,i)
39- end do
40- close (fileunit)
41- end subroutine read_binary_file_2d
13+ module subroutine read_binary_file_1d (filename , dtype , nrec , array )
14+ implicit none
15+ character (len=* ), intent (in ) :: filename
16+ integer (ik), intent (in ) :: dtype, nrec
17+ real (rk), allocatable , intent (in out ) :: array(:)
18+ end subroutine read_binary_file_1d
19+
20+ module subroutine read_binary_file_2d (filename , dtype , dsize , nrec , array )
21+ implicit none
22+ character (len=* ), intent (in ) :: filename
23+ integer (ik), intent (in ) :: dtype, dsize, nrec
24+ real (rk), allocatable , intent (in out ) :: array(:,:)
25+ end subroutine read_binary_file_2d
26+
27+ end interface read_binary_file
4228
4329end module mod_io
0 commit comments