13 integer(I4B) :: inunit
14 character(len=16) :: text
18 integer(I4B) :: kstpnext
19 integer(I4B) :: kpernext
24 real(dp),
dimension(:),
allocatable :: head
45 integer(I4B),
intent(in) :: iu
46 integer(I4B),
intent(in) :: iout
48 integer(I4B) :: kstp_last, kper_last
52 this%endoffile = .false.
56 call this%read_record(success)
64 'Reading binary file to determine number of records per time step.'
66 call this%read_record(success, iout)
67 if (.not. success)
exit
68 if (kstp_last /= this%kstp .or. kper_last /= this%kper)
exit
69 this%nlay = this%nlay + 1
73 write (iout,
'(a, i0, a)')
'Detected ', this%nlay, &
74 ' unique records in binary file.'
91 logical,
intent(out) :: success
92 integer(I4B),
intent(in),
optional :: iout_opt
94 integer(I4B) :: iostat, iout
95 integer(I4B) :: ncol, nrow, ilay
98 if (
present(iout_opt))
then
109 read (this%inunit, iostat=iostat) this%kstp, this%kper, this%pertim, &
110 this%totim, this%text, ncol, nrow, ilay
111 if (iostat /= 0)
then
113 if (iostat < 0) this%endoffile = .true.
118 if (.not.
allocated(this%head))
then
119 allocate (this%head(ncol * nrow))
121 if (
size(this%head) /= ncol * nrow)
then
122 deallocate (this%head)
123 allocate (this%head(ncol * nrow))
128 read (this%inunit) this%head
131 if (.not. this%endoffile)
then
132 read (this%inunit, iostat=iostat) this%kstpnext, this%kpernext
133 if (iostat == 0)
then
135 else if (iostat < 0)
then
136 this%endoffile = .true.
154 if (
allocated(this%head))
deallocate (this%head)
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
subroutine finalize(this)
subroutine read_record(this, success, iout_opt)
subroutine initialize(this, iu, iout)
This module defines variable data types.