MODFLOW 6  version 6.6.0.dev0
USGS Modular Hydrologic Model
TimeSeriesRecord.f90
Go to the documentation of this file.
2 
3  use kindmodule, only: dp, i4b
4  use listmodule, only: listtype
5 
6  private
9 
11  ! -- Public members
12  real(dp), public :: tsrtime
13  real(dp), public :: tsrvalue
14  end type timeseriesrecordtype
15 
16 contains
17 
18  !> @brief Allocate and assign members of a new TimeSeriesRecordType object
19  !<
20  subroutine constructtimeseriesrecord(newTsRecord, time, value)
21  implicit none
22  ! -- dummy
23  type(timeseriesrecordtype), pointer, intent(out) :: newtsrecord
24  real(dp), intent(in) :: time, value
25  !
26  allocate (newtsrecord)
27  newtsrecord%tsrTime = time
28  newtsrecord%tsrValue = value
29  end subroutine constructtimeseriesrecord
30 
31  !> @brief Cast an unlimited polymorphic object as TimeSeriesRecordType
32  !<
33  function castastimeseriesrecordtype(obj) result(res)
34  implicit none
35  ! -- dummy
36  class(*), pointer, intent(inout) :: obj
37  ! -- return
38  type(timeseriesrecordtype), pointer :: res
39  !
40  res => null()
41  if (.not. associated(obj)) return
42  !
43  select type (obj)
44  type is (timeseriesrecordtype)
45  res => obj
46  end select
47  end function castastimeseriesrecordtype
48 
49  !> @brief Add time series record to list
50  !<
51  subroutine addtimeseriesrecordtolist(list, tsrecord)
52  implicit none
53  ! -- dummy
54  type(listtype), intent(inout) :: list
55  type(timeseriesrecordtype), pointer, intent(inout) :: tsrecord
56  ! -- local
57  class(*), pointer :: obj => null()
58  !
59  obj => tsrecord
60  call list%Add(obj)
61  end subroutine addtimeseriesrecordtolist
62 
63 end module timeseriesrecordmodule
This module defines variable data types.
Definition: kind.f90:8
subroutine, public addtimeseriesrecordtolist(list, tsrecord)
Add time series record to list.
subroutine, public constructtimeseriesrecord(newTsRecord, time, value)
Allocate and assign members of a new TimeSeriesRecordType object.
type(timeseriesrecordtype) function, pointer, public castastimeseriesrecordtype(obj)
Cast an unlimited polymorphic object as TimeSeriesRecordType.
A generic heterogeneous doubly-linked list.
Definition: List.f90:14