13 integer(I4B) :: inunit
14 character(len=16) :: text
18 integer(I4B) :: kstpnext
19 integer(I4B) :: kpernext
24 real(dp),
dimension(:),
allocatable :: head
41 integer(I4B),
intent(in) :: iu
42 integer(I4B),
intent(in) :: iout
44 integer(I4B) :: kstp_last, kper_last
47 this%endoffile = .false.
51 call this%read_record(success)
59 'Reading binary file to determine number of records per time step.'
61 call this%read_record(success, iout)
62 if (.not. success)
exit
63 if (kstp_last /= this%kstp .or. kper_last /= this%kper)
exit
64 this%nlay = this%nlay + 1
68 write (iout,
'(a, i0, a)')
'Detected ', this%nlay, &
69 ' unique records in binary file.'
79 logical,
intent(out) :: success
80 integer(I4B),
intent(in),
optional :: iout_opt
82 integer(I4B) :: iostat, iout
83 integer(I4B) :: ncol, nrow, ilay
85 if (
present(iout_opt))
then
96 read (this%inunit, iostat=iostat) this%kstp, this%kper, this%pertim, &
97 this%totim, this%text, ncol, nrow, ilay
100 if (iostat < 0) this%endoffile = .true.
105 if (.not.
allocated(this%head))
then
106 allocate (this%head(ncol * nrow))
108 if (
size(this%head) /= ncol * nrow)
then
109 deallocate (this%head)
110 allocate (this%head(ncol * nrow))
115 read (this%inunit) this%head
118 if (.not. this%endoffile)
then
119 read (this%inunit, iostat=iostat) this%kstpnext, this%kpernext
120 if (iostat == 0)
then
122 else if (iostat < 0)
then
123 this%endoffile = .true.
133 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.