MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
ObsOutputList.f90
Go to the documentation of this file.
1!> @brief This module defines the derived type ObsOutputListType
2!!
3!! This module contains a list of ObsOutputType objects and
4!! methods needed for coordinating between an ObsType object and its
5!! ObsOutputType objects. Like ObsOutputType, ObsOutputListType is
6!! needed only for processing continuous observations.
7!!
8!<
10
11 use kindmodule, only: dp, i4b
13 use listmodule, only: listtype
16
17 implicit none
18
19 private
20 public :: obsoutputlisttype
21
23 ! -- Private members
24 type(listtype), private :: obsoutputs
25 contains
26 ! -- Public procedures
27 procedure, public :: add
28 procedure, public :: resetallobsemptylines
29 procedure, public :: containsfile
30 procedure, public :: count
31 procedure, public :: get
32 procedure, public :: writeallobslinereturns
33 procedure, public :: clear
34 procedure, public :: deallocobsoutputlist
35 end type obsoutputlisttype
36
37contains
38
39 !> @brief Reset empty line logical for all observations
40 !!
41 !! Subroutine to reset the empty line logical for all ObsOutputType
42 !! objects in the list.
43 !!
44 !<
45 subroutine resetallobsemptylines(this)
46 ! -- dummy
47 class(obsoutputlisttype), intent(inout) :: this
48 ! -- local
49 integer(I4B) :: i, num
50 type(obsoutputtype), pointer :: obsOutput => null()
51 !
52 num = this%Count()
53 do i = 1, num
54 obsoutput => this%Get(i)
55 call obsoutput%ResetObsEmptyLine()
56 end do
57 end subroutine resetallobsemptylines
58
59 !> @brief Count the number of ObsOutputType objects
60 !!
61 !! Subroutine to return the number of ObsOutputType objects in the list.
62 !!
63 !<
64 function count(this)
65 ! -- return
66 integer(I4B) :: count !< number of ObsOutputType objects
67 ! -- dummy
68 class(obsoutputlisttype), intent(inout) :: this
69 !
70 count = this%ObsOutputs%Count()
71 end function count
72
73 !> @brief Determine if a file name is in the list of ObsOutputType objects
74 !!
75 !! Function to determine if a file name is in the list of
76 !! ObsOutptType objects.
77 !!
78 !<
79 logical function containsfile(this, fname)
80 ! -- dummy
81 class(obsoutputlisttype), intent(inout) :: this
82 character(len=*), intent(in) :: fname !< observation output file name
83 ! -- local
84 type(obsoutputtype), pointer :: obsoutput => null()
85 integer(I4B) :: i, n
86 !
87 containsfile = .false.
88 n = this%Count()
89 loop1: do i = 1, n
90 obsoutput => this%Get(i)
91 if (same_word(obsoutput%filename, fname)) then
92 containsfile = .true.
93 exit loop1
94 end if
95 end do loop1
96 end function containsfile
97
98 !> @brief Add a ObsOutputType object to the list
99 !!
100 !! Subroutine to add a new ObsOutputType object to the ObsOutputList and
101 !! assign ObsOutputType members.
102 !!
103 !<
104 subroutine add(this, fname, nunit)
105 ! -- dummy
106 class(obsoutputlisttype), intent(inout) :: this
107 character(len=*), intent(in) :: fname !< observation output file name
108 integer(I4B), intent(in) :: nunit !< observation output unit number
109 ! -- local
110 type(obsoutputtype), pointer :: obsOutput => null()
111 !
112 call constructobsoutput(obsoutput, fname, nunit)
113 call addobsoutputtolist(this%ObsOutputs, obsoutput)
114 end subroutine add
115
116 !> @brief Write line returns for all ObsOutputListType
117 !!
118 !! Subroutine to write line returns for a time step for all observation
119 !! output files in a ObsOutputListType.
120 !!
121 !<
122 subroutine writeallobslinereturns(this)
123 ! -- dummy
124 class(obsoutputlisttype), intent(inout) :: this
125 ! -- local
126 type(obsoutputtype), pointer :: obsOutput => null()
127 integer(I4B) :: i, num
128 !
129 num = this%Count()
130 do i = 1, num
131 obsoutput => this%Get(i)
132 if (obsoutput%FormattedOutput) then
133 call obsoutput%WriteObsLineReturn()
134 end if
135 end do
136 end subroutine writeallobslinereturns
137
138 !> @brief Get an item from a ObsOutputListType
139 !!
140 !! Function to get a ObsOutputType from a ObsOutputListType list.
141 !!
142 !<
143 function get(this, indx) result(obsOutput)
144 ! -- dummy
145 class(obsoutputlisttype), intent(inout) :: this
146 integer(I4B), intent(in) :: indx !< index for ObsOutputType object
147 ! result
148 type(obsoutputtype), pointer :: obsoutput
149 !
150 obsoutput => getobsoutputfromlist(this%ObsOutputs, indx)
151 end function get
152
153 !> @brief Clear a ObsOutputListType
154 !!
155 !! Subroutine to clear a ObsOutputListType list.
156 !!
157 !<
158 subroutine clear(this)
159 ! -- dummy
160 class(obsoutputlisttype), intent(inout) :: this
161 !
162 call this%ObsOutputs%Clear()
163 end subroutine clear
164
165 !> @brief Deallocate a ObsOutputListType
166 !!
167 !! Subroutine to deallocate a ObsOutputListType list.
168 !!
169 !<
170 subroutine deallocobsoutputlist(this)
171 ! -- dummy
172 class(obsoutputlisttype), intent(inout) :: this
173 ! -- local
174 integer :: i, n
175 type(obsoutputtype), pointer :: obsoutput => null()
176 !
177 n = this%Count()
178 do i = 1, n
179 obsoutput => getobsoutputfromlist(this%ObsOutputs, i)
180 !call obsoutput%DeallocObsOutput()
181 end do
182 !
183 call this%ObsOutputs%Clear(.true.)
184 end subroutine deallocobsoutputlist
185
186end module obsoutputlistmodule
logical function, public same_word(word1, word2)
Perform a case-insensitive comparison of two words.
This module defines variable data types.
Definition kind.f90:8
integer(i4b) function count(this)
Return number of nodes in list.
Definition List.f90:129
subroutine add(this, objptr)
Append the given item to the list.
Definition List.f90:69
subroutine clear(this, destroy)
Deallocate all items in list.
Definition List.f90:89
This module defines the derived type ObsOutputListType.
logical function containsfile(this, fname)
Determine if a file name is in the list of ObsOutputType objects.
subroutine deallocobsoutputlist(this)
Deallocate a ObsOutputListType.
subroutine resetallobsemptylines(this)
Reset empty line logical for all observations.
type(obsoutputtype) function, pointer get(this, indx)
Get an item from a ObsOutputListType.
subroutine writeallobslinereturns(this)
Write line returns for all ObsOutputListType.
This module defines the derived type ObsOutputType.
Definition ObsOutput.f90:10
subroutine, public addobsoutputtolist(list, obsoutput)
Add observation output to a list.
subroutine, public constructobsoutput(newobsoutput, fname, nunit)
Construct and assign ObsOutputType object.
Definition ObsOutput.f90:97
type(obsoutputtype) function, pointer, public getobsoutputfromlist(list, idx)
Get observation output from a list.
A generic heterogeneous doubly-linked list.
Definition List.f90:14