– Module to manage unit numbers. Allows for multiple unit numbers – assigned to a single package type, as shown below. – row(i) cunit(i) iunit(i)nval iunit(i)iunit iunit(i)ipos – 1 BCF6 1 (1000) (1) – 2 WEL 3 (1001,1003,1005) (2,5,7) – 3 GHB 1 (1002) (4) – 4 EVT 2 (1004,1006) (6,10) – 5 RIV 0 () () – ...
|
subroutine | init (this, niunit, cunit) |
| Allocate the cunit and iunit entries of this object, and copy cunit into the object. More...
|
|
subroutine | addfile (this, ftyp, iunit, ipos, namefilename) |
| Add an ftyp and unit number. More...
|
|
subroutine | getunitnumber (this, ftyp, iunit, iremove) |
| Get the last unit number for type ftyp or return 0 for iunit. More...
|
|
◆ addfile()
subroutine iunitmodule::addfile |
( |
class(iunittype), intent(inout) |
this, |
|
|
character(len=*), intent(in) |
ftyp, |
|
|
integer(i4b), intent(in) |
iunit, |
|
|
integer(i4b), intent(in) |
ipos, |
|
|
character(len=*), intent(in) |
namefilename |
|
) |
| |
|
private |
Find the row for the ftyp and store another iunit value.
Definition at line 66 of file Iunit.f90.
68 class(IunitType),
intent(inout) :: this
69 character(len=*),
intent(in) :: ftyp
70 integer(I4B),
intent(in) :: iunit
71 integer(I4B),
intent(in) :: ipos
72 character(len=*),
intent(in) :: namefilename
74 character(len=LINELENGTH) :: errmsg
75 integer(I4B),
allocatable,
dimension(:) :: itemp
76 integer(I4B) :: i, irow
81 if (this%cunit(i) == ftyp)
then
87 write (errmsg,
'(a,a)')
'Package type not supported: ', ftyp
88 call store_error(errmsg)
89 call store_error_filename(namefilename, terminate=.true.)
93 if (this%iunit(irow)%nval == 0)
then
94 allocate (this%iunit(irow)%iunit(1))
95 allocate (this%iunit(irow)%ipos(1))
96 this%iunit(irow)%nval = 1
100 allocate (itemp(this%iunit(irow)%nval))
101 itemp(:) = this%iunit(irow)%iunit(:)
102 deallocate (this%iunit(irow)%iunit)
103 this%iunit(irow)%nval = this%iunit(irow)%nval + 1
104 allocate (this%iunit(irow)%iunit(this%iunit(irow)%nval))
105 this%iunit(irow)%iunit(1:this%iunit(irow)%nval - 1) = itemp(:)
108 itemp(:) = this%iunit(irow)%ipos(:)
109 deallocate (this%iunit(irow)%ipos)
110 allocate (this%iunit(irow)%ipos(this%iunit(irow)%nval))
111 this%iunit(irow)%ipos(1:this%iunit(irow)%nval - 1) = itemp(:)
116 this%iunit(irow)%iunit(this%iunit(irow)%nval) = iunit
117 this%iunit(irow)%ipos(this%iunit(irow)%nval) = ipos
◆ getunitnumber()
subroutine iunitmodule::getunitnumber |
( |
class(iunittype), intent(inout) |
this, |
|
|
character(len=*), intent(in) |
ftyp, |
|
|
integer(i4b), intent(inout) |
iunit, |
|
|
integer(i4b), intent(in) |
iremove |
|
) |
| |
|
private |
If iremove is 1, then remove this unit number. Similar to a list.pop().
Definition at line 127 of file Iunit.f90.
129 class(IunitType),
intent(inout) :: this
130 character(len=*),
intent(in) :: ftyp
131 integer(I4B),
intent(inout) :: iunit
132 integer(I4B),
intent(in) :: iremove
134 integer(I4B) :: i, irow, nval
138 do i = 1, this%niunit
139 if (this%cunit(i) == ftyp)
then
148 nval = this%iunit(irow)%nval
150 iunit = this%iunit(irow)%iunit(nval)
151 if (iremove > 0)
then
152 this%iunit(irow)%iunit(nval) = 0
153 this%iunit(irow)%nval = nval - 1
◆ init()
subroutine iunitmodule::init |
( |
class(iunittype), intent(inout) |
this, |
|
|
integer(i4b), intent(in) |
niunit, |
|
|
character(len=*), dimension(niunit), intent(in) |
cunit |
|
) |
| |
|
private |
Definition at line 43 of file Iunit.f90.
45 class(IunitType),
intent(inout) :: this
46 integer(I4B),
intent(in) :: niunit
47 character(len=*),
dimension(niunit),
intent(in) :: cunit
51 allocate (this%cunit(niunit))
52 allocate (this%iunit(niunit))
55 this%cunit(i) = cunit(i)