MODFLOW 6  version 6.7.0.dev0
USGS Modular Hydrologic Model
TimeSeriesFileList.f90
Go to the documentation of this file.
2 
3  use kindmodule, only: dp, i4b
4  use constantsmodule, only: linelength
5  use listmodule, only: listtype
10 
11  implicit none
12 
13  private
14  public :: timeseriesfilelisttype
15 
17  ! -- Public members
18  integer(I4B), public :: numtsfiles = 0
19  type(listtype), public :: tsfilelist
20 
21  contains
22 
23  ! -- Public procedures
24  procedure, public :: add
25  procedure, public :: counttsfiles
26  procedure, public :: counttimeseries
27  procedure, public :: gettsfile
28  procedure, public :: clear
29  procedure, public :: da => tsfl_da
30  procedure, public :: add_time_series_tsfile
31  end type timeseriesfilelisttype
32 
33 contains
34 
35  ! -- Public procedures
36 
37  subroutine add(this, filename, iout, tsfile)
38  implicit none
39  ! -- dummy
40  class(timeseriesfilelisttype), intent(inout) :: this
41  character(len=*), intent(in) :: filename
42  integer(I4B), intent(in) :: iout
43  class(timeseriesfiletype), pointer, intent(inout) :: tsfile
44  ! -- local
45  type(timeseriesfiletype), pointer :: tsf
46  !
47  ! -- Construct and initialize a new time-series tsfile
48  call constructtimeseriesfile(tsf)
49  tsfile => tsf
50  call tsfile%Initializetsfile(filename, iout, .true.)
51  !
52  ! -- Add the time-series tsfile to the list
53  call this%add_time_series_tsfile(tsfile)
54  end subroutine add
55 
56  subroutine clear(this)
57  implicit none
58  ! -- dummy
59  class(timeseriesfilelisttype), intent(inout) :: this
60  !
61  call this%tsfileList%Clear()
62  end subroutine clear
63 
64  function counttsfiles(this)
65  implicit none
66  ! -- return
67  integer(I4B) :: counttsfiles
68  ! -- dummy
69  class(timeseriesfilelisttype) :: this
70  !
71  counttsfiles = this%tsfileList%Count()
72  !
73  end function counttsfiles
74 
75  function counttimeseries(this)
76  implicit none
77  ! -- return
78  integer(I4B) :: counttimeseries
79  ! -- dummy
80  class(timeseriesfilelisttype) :: this
81  ! -- local
82  integer(I4B) :: i, numtsfiles
83  type(timeseriesfiletype), pointer :: tsfile
84  !
85  numtsfiles = this%Counttsfiles()
86  counttimeseries = 0
87  do i = 1, numtsfiles
88  tsfile => this%Gettsfile(i)
89  if (associated(tsfile)) then
90  counttimeseries = counttimeseries + tsfile%Count()
91  end if
92  end do
93  end function counttimeseries
94 
95  function gettsfile(this, indx) result(res)
96  implicit none
97  ! -- dummy
98  class(timeseriesfilelisttype) :: this
99  integer(I4B), intent(in) :: indx
100  ! -- return
101  type(timeseriesfiletype), pointer :: res
102  !
103  res => gettimeseriesfilefromlist(this%tsfileList, indx)
104  end function gettsfile
105 
106  ! -- Private procedures
107 
108  subroutine add_time_series_tsfile(this, tsfile)
109  implicit none
110  ! -- dummy
111  class(timeseriesfilelisttype), intent(inout) :: this
112  class(timeseriesfiletype), pointer, intent(inout) :: tsfile
113  !
114  call addtimeseriesfiletolist(this%tsfileList, tsfile)
115  this%numtsfiles = this%numtsfiles + 1
116  end subroutine add_time_series_tsfile
117 
118  subroutine tsfl_da(this)
119  ! -- dummy
120  class(timeseriesfilelisttype), intent(inout) :: this
121  ! -- local
122  integer(I4B) :: i, n
123  type(timeseriesfiletype), pointer :: tsf => null()
124  !
125  n = this%Counttsfiles()
126  do i = 1, n
127  tsf => this%Gettsfile(i)
128  call tsf%da()
129  end do
130  !
131  call this%tsfileList%Clear(.true.)
132  !
133  end subroutine tsfl_da
134 
135 end module timeseriesfilelistmodule
This module contains simulation constants.
Definition: Constants.f90:9
integer(i4b), parameter linelength
maximum length of a standard line
Definition: Constants.f90:45
This module defines variable data types.
Definition: kind.f90:8
type(timeseriesfiletype) function, pointer gettsfile(this, indx)
integer(i4b) function counttsfiles(this)
integer(i4b) function counttimeseries(this)
subroutine add_time_series_tsfile(this, tsfile)
subroutine add(this, filename, iout, tsfile)
type(timeseriesfiletype) function, pointer, public gettimeseriesfilefromlist(list, idx)
Get time series from list.
Definition: TimeSeries.f90:153
subroutine, public constructtimeseriesfile(newTimeSeriesFile)
Construct time series file.
Definition: TimeSeries.f90:96
subroutine, public addtimeseriesfiletolist(list, tsfile)
Add time series file to list.
Definition: TimeSeries.f90:140
A generic heterogeneous doubly-linked list.
Definition: List.f90:14