MODFLOW 6  version 6.5.0.dev2
MODFLOW 6 Code Documentation
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  !
55  ! -- Return
56  return
57  end subroutine add
58 
59  subroutine clear(this)
60  implicit none
61  ! -- dummy
62  class(timeseriesfilelisttype), intent(inout) :: this
63  !
64  call this%tsfileList%Clear()
65  !
66  ! -- Return
67  return
68  end subroutine clear
69 
70  function counttsfiles(this)
71  implicit none
72  ! -- return
73  integer(I4B) :: counttsfiles
74  ! -- dummy
75  class(timeseriesfilelisttype) :: this
76  !
77  counttsfiles = this%tsfileList%Count()
78  !
79  !
80  ! -- Return
81  return
82  end function counttsfiles
83 
84  function counttimeseries(this)
85  implicit none
86  ! -- return
87  integer(I4B) :: counttimeseries
88  ! -- dummy
89  class(timeseriesfilelisttype) :: this
90  ! -- local
91  integer(I4B) :: i, numtsfiles
92  type(timeseriesfiletype), pointer :: tsfile
93  !
94  numtsfiles = this%Counttsfiles()
95  counttimeseries = 0
96  do i = 1, numtsfiles
97  tsfile => this%Gettsfile(i)
98  if (associated(tsfile)) then
99  counttimeseries = counttimeseries + tsfile%Count()
100  end if
101  end do
102  !
103  ! -- Return
104  return
105  end function counttimeseries
106 
107  function gettsfile(this, indx) result(res)
108  implicit none
109  ! -- dummy
110  class(timeseriesfilelisttype) :: this
111  integer(I4B), intent(in) :: indx
112  ! -- return
113  type(timeseriesfiletype), pointer :: res
114  !
115  res => gettimeseriesfilefromlist(this%tsfileList, indx)
116  !
117  ! -- Return
118  return
119  end function gettsfile
120 
121  ! -- Private procedures
122 
123  subroutine add_time_series_tsfile(this, tsfile)
124  implicit none
125  ! -- dummy
126  class(timeseriesfilelisttype), intent(inout) :: this
127  class(timeseriesfiletype), pointer, intent(inout) :: tsfile
128  !
129  call addtimeseriesfiletolist(this%tsfileList, tsfile)
130  this%numtsfiles = this%numtsfiles + 1
131  !
132  ! -- Return
133  return
134  end subroutine add_time_series_tsfile
135 
136  subroutine tsfl_da(this)
137  ! -- dummy
138  class(timeseriesfilelisttype), intent(inout) :: this
139  ! -- local
140  integer(I4B) :: i, n
141  type(timeseriesfiletype), pointer :: tsf => null()
142  !
143  n = this%Counttsfiles()
144  do i = 1, n
145  tsf => this%Gettsfile(i)
146  call tsf%da()
147  end do
148  !
149  call this%tsfileList%Clear(.true.)
150  !
151  !
152  ! -- Return
153  return
154  end subroutine tsfl_da
155 
156 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:44
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:164
subroutine, public constructtimeseriesfile(newTimeSeriesFile)
Construct time series file.
Definition: TimeSeries.f90:95
subroutine, public addtimeseriesfiletolist(list, tsfile)
Add time series file to list.
Definition: TimeSeries.f90:148
A generic heterogeneous doubly-linked list.
Definition: List.f90:10