MODFLOW 6  version 6.7.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 84 of file StructVector.f90.

85  class(StructVectorType) :: this
86  character(len=*), intent(in) :: token
87  integer(I4B), intent(in) :: structarray_col
88  integer(I4B), intent(in) :: col
89  integer(I4B), intent(in) :: row
90  class(TSStringLocType), pointer :: str_field
91  class(*), pointer :: obj
92  allocate (str_field)
93  str_field%structarray_col = structarray_col
94  str_field%col = col
95  str_field%row = row
96  str_field%token = token
97  obj => str_field
98  call this%ts_strlocs%Add(obj)

◆ sv_clear()

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

Definition at line 120 of file StructVector.f90.

121  class(StructVectorType) :: this
122  class(TSStringLocType), pointer :: ts_strloc
123  integer(I4B) :: n
124  do n = 1, this%ts_strlocs%Count()
125  ts_strloc => this%get_ts_strloc(n)
126  deallocate (ts_strloc)
127  nullify (ts_strloc)
128  end do
129  call this%ts_strlocs%Clear()

◆ 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 101 of file StructVector.f90.

102  class(StructVectorType) :: this
103  integer(I4B), intent(in) :: idx !< package number
104  class(TSStringLocType), pointer :: res
105  class(*), pointer :: obj
106  ! initialize res
107  res => null()
108  ! get the package from the list
109  obj => this%ts_strlocs%GetItem(idx)
110  if (associated(obj)) then
111  select type (obj)
112  class is (tsstringloctype)
113  res => obj
114  end select
115  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 65 of file StructVector.f90.

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