MODFLOW 6  version 6.6.0.dev0
USGS Modular Hydrologic Model
structvectormodule Module Reference

This module contains the StructVectorModule. More...

Data Types

type  tsstringloctype
 derived type which describes time series string field More...
 
type  structvectortype
 derived type for generic vector More...
 

Functions/Subroutines

real(dp) function sv_read_token (this, token, structarray_col, col, row)
 
subroutine sv_add_ts_strloc (this, token, structarray_col, col, row)
 
class(tsstringloctype) function, pointer sv_get_ts_strloc (this, idx)
 
subroutine sv_clear (this)
 

Detailed Description

This module contains a generic type for storing different types of vectors.

Function/Subroutine Documentation

◆ sv_add_ts_strloc()

subroutine structvectormodule::sv_add_ts_strloc ( class(structvectortype this,
character(len=*), intent(in)  token,
integer(i4b), intent(in)  structarray_col,
integer(i4b), intent(in)  col,
integer(i4b), intent(in)  row 
)
private

Definition at line 90 of file StructVector.f90.

91  ! -- dummy variables
92  class(StructVectorType) :: this
93  character(len=*), intent(in) :: token
94  integer(I4B), intent(in) :: structarray_col
95  integer(I4B), intent(in) :: col
96  integer(I4B), intent(in) :: row
97  class(TSStringLocType), pointer :: str_field
98  ! -- local variables
99  class(*), pointer :: obj
100  !
101  ! --
102  allocate (str_field)
103  str_field%structarray_col = structarray_col
104  str_field%col = col
105  str_field%row = row
106  str_field%token = token
107  !
108  obj => str_field
109  call this%ts_strlocs%Add(obj)

◆ sv_clear()

subroutine structvectormodule::sv_clear ( class(structvectortype this)
private

Definition at line 135 of file StructVector.f90.

136  ! -- modules
137  ! -- dummy
138  class(StructVectorType) :: this
139  class(TSStringLocType), pointer :: ts_strloc
140  integer(I4B) :: n
141  !
142  do n = 1, this%ts_strlocs%Count()
143  ts_strloc => this%get_ts_strloc(n)
144  deallocate (ts_strloc)
145  nullify (ts_strloc)
146  end do
147  !
148  call this%ts_strlocs%Clear()
149  !
150  return

◆ sv_get_ts_strloc()

class(tsstringloctype) function, pointer structvectormodule::sv_get_ts_strloc ( class(structvectortype this,
integer(i4b), intent(in)  idx 
)
private
Parameters
[in]idxpackage number

Definition at line 112 of file StructVector.f90.

113  ! -- dummy variables
114  class(StructVectorType) :: this
115  integer(I4B), intent(in) :: idx !< package number
116  class(TSStringLocType), pointer :: res
117  ! -- local variables
118  class(*), pointer :: obj
119  !
120  ! -- initialize res
121  res => null()
122  !
123  ! -- get the package from the list
124  obj => this%ts_strlocs%GetItem(idx)
125  if (associated(obj)) then
126  select type (obj)
127  class is (tsstringloctype)
128  res => obj
129  end select
130  end if

◆ sv_read_token()

real(dp) function structvectormodule::sv_read_token ( class(structvectortype this,
character(len=*), intent(in)  token,
integer(i4b), intent(in)  structarray_col,
integer(i4b), intent(in)  col,
integer(i4b), intent(in)  row 
)
private

Definition at line 66 of file StructVector.f90.

67  ! -- modules
68  ! -- dummy
69  class(StructVectorType) :: this
70  character(len=*), intent(in) :: token
71  integer(I4B), intent(in) :: structarray_col
72  integer(I4B), intent(in) :: col
73  integer(I4B), intent(in) :: row
74  real(DP) :: val
75  ! -- local
76  integer(I4B) :: istat
77  real(DP) :: r
78  !
79  ! -- initialize
80  val = dnodata
81  !
82  read (token, *, iostat=istat) r
83  if (istat == 0) then
84  val = r
85  else
86  call this%add_ts_strloc(token, structarray_col, col, row)
87  end if