MODFLOW 6  version 6.7.0.dev0
USGS Modular Hydrologic Model
LayeredArrayReader.f90
Go to the documentation of this file.
2 
3  use kindmodule, only: dp, i4b, lgp
9 
10  implicit none
11  public :: read_dbl1d_layered
12  public :: read_dbl2d_layered
13  public :: read_dbl3d_layered
14  public :: read_int1d_layered
15  public :: read_int2d_layered
16  public :: read_int3d_layered
17 
18 contains
19 
20  subroutine read_dbl1d_layered(parser, dbl1d, aname, nlay, layer_shape)
21  ! -- dummy
22  type(blockparsertype), intent(in), target :: parser
23  real(dp), dimension(:), contiguous, target :: dbl1d
24  character(len=*), intent(in) :: aname
25  integer(I4B), intent(in) :: nlay
26  integer(I4B), dimension(:), intent(in) :: layer_shape
27  ! -- local
28  integer(I4B) :: k
29  integer(I4B) :: ncpl, nrow, ncol
30  integer(I4B) :: index_start, index_stop
31  real(dp), dimension(:, :), contiguous, pointer :: dbl2d_ptr => null()
32 
33  ncpl = product(layer_shape)
34  index_start = 1
35  do k = 1, nlay
36  index_stop = index_start + ncpl - 1
37  if (size(layer_shape) == 2) then
38  ncol = layer_shape(1)
39  nrow = layer_shape(2)
40  dbl2d_ptr(1:ncol, 1:nrow) => dbl1d(index_start:index_stop)
41  call read_dbl2d(parser, dbl2d_ptr, aname)
42  else
43  call read_dbl1d(parser, dbl1d(index_start:index_stop), aname)
44  end if
45  index_start = index_stop + 1
46  end do
47  nullify (dbl2d_ptr)
48 
49  end subroutine read_dbl1d_layered
50 
51  subroutine read_dbl2d_layered(parser, dbl2d, aname, nlay, layer_shape)
52  ! -- dummy
53  type(blockparsertype), intent(in), target :: parser
54  real(dp), dimension(:, :), contiguous, target :: dbl2d
55  character(len=*), intent(in) :: aname
56  integer(I4B), intent(in) :: nlay
57  integer(I4B), dimension(:), intent(in) :: layer_shape
58  ! -- local
59  integer(I4B) :: k
60  integer(I4B) :: ncpl
61  real(dp), dimension(:), contiguous, pointer :: dbl1d_ptr => null()
62 
63  ncpl = layer_shape(1)
64  do k = 1, nlay
65  dbl1d_ptr(1:ncpl) => dbl2d(1:ncpl, k)
66  call read_dbl1d(parser, dbl1d_ptr, aname)
67  end do
68  nullify (dbl1d_ptr)
69 
70  end subroutine read_dbl2d_layered
71 
72  subroutine read_dbl3d_layered(parser, dbl3d, aname, nlay, layer_shape)
73  ! -- dummy
74  type(blockparsertype), intent(in), target :: parser
75  real(dp), dimension(:, :, :), contiguous, target :: dbl3d
76  character(len=*), intent(in) :: aname
77  integer(I4B), intent(in) :: nlay
78  integer(I4B), dimension(:), intent(in) :: layer_shape
79  ! -- local
80  integer(I4B) :: k
81  integer(I4B) :: ncol, nrow
82  real(dp), dimension(:, :), contiguous, pointer :: dbl2d_ptr => null()
83 
84  ncol = layer_shape(1)
85  nrow = layer_shape(2)
86  do k = 1, nlay
87  dbl2d_ptr(1:ncol, 1:nrow) => dbl3d(:, :, k:k)
88  call read_dbl2d(parser, dbl2d_ptr, aname)
89  end do
90  nullify (dbl2d_ptr)
91 
92  end subroutine read_dbl3d_layered
93 
94  subroutine read_int1d_layered(parser, int1d, aname, nlay, layer_shape)
95  ! -- dummy
96  type(blockparsertype), intent(in), target :: parser
97  integer(I4B), dimension(:), contiguous, target :: int1d
98  character(len=*), intent(in) :: aname
99  integer(I4B), intent(in) :: nlay
100  integer(I4B), dimension(:), intent(in) :: layer_shape
101  ! -- local
102  integer(I4B) :: k
103  integer(I4B) :: ncpl, nrow, ncol
104  integer(I4B) :: index_start, index_stop
105  integer(I4B), dimension(:, :), contiguous, pointer :: int2d_ptr => null()
106 
107  ncpl = product(layer_shape)
108  index_start = 1
109  do k = 1, nlay
110  index_stop = index_start + ncpl - 1
111  if (size(layer_shape) == 2) then
112  ncol = layer_shape(1)
113  nrow = layer_shape(2)
114  int2d_ptr(1:ncol, 1:nrow) => int1d(index_start:index_stop)
115  call read_int2d(parser, int2d_ptr, aname)
116  else
117  call read_int1d(parser, int1d(index_start:index_stop), aname)
118  end if
119  index_start = index_stop + 1
120  end do
121  nullify (int2d_ptr)
122 
123  end subroutine read_int1d_layered
124 
125  subroutine read_int2d_layered(parser, int2d, aname, nlay, layer_shape)
126  ! -- dummy
127  type(blockparsertype), intent(in), target :: parser
128  integer(I4B), dimension(:, :), contiguous, target :: int2d
129  character(len=*), intent(in) :: aname
130  integer(I4B), intent(in) :: nlay
131  integer(I4B), dimension(:), intent(in) :: layer_shape
132  ! -- local
133  integer(I4B) :: k
134  integer(I4B) :: ncpl
135  integer(I4B), dimension(:), contiguous, pointer :: int1d_ptr => null()
136 
137  ncpl = layer_shape(1)
138  do k = 1, nlay
139  int1d_ptr(1:ncpl) => int2d(1:ncpl, k)
140  call read_int1d(parser, int1d_ptr, aname)
141  end do
142  nullify (int1d_ptr)
143 
144  end subroutine read_int2d_layered
145 
146  subroutine read_int3d_layered(parser, int3d, aname, nlay, layer_shape)
147  ! -- dummy
148  type(blockparsertype), intent(in), target :: parser
149  integer(I4B), dimension(:, :, :), contiguous, target :: int3d
150  character(len=*), intent(in) :: aname
151  integer(I4B), intent(in) :: nlay
152  integer(I4B), dimension(:), intent(in) :: layer_shape
153  ! -- local
154  integer(I4B) :: k
155  integer(I4B) :: ncol, nrow
156  integer(I4B), dimension(:, :), contiguous, pointer :: int2d_ptr => null()
157 
158  ncol = layer_shape(1)
159  nrow = layer_shape(2)
160  do k = 1, nlay
161  int2d_ptr(1:ncol, 1:nrow) => int3d(:, :, k:k)
162  call read_int2d(parser, int2d_ptr, aname)
163  end do
164  nullify (int2d_ptr)
165 
166  end subroutine read_int3d_layered
167 
168 end module layeredarrayreadermodule
This module contains block parser methods.
Definition: BlockParser.f90:7
subroutine, public read_dbl1d(parser, dbl1d, aname)
subroutine, public read_dbl2d(parser, dbl2d, aname)
subroutine, public read_int1d(parser, int1d, aname)
subroutine, public read_int2d(parser, int2d, aname)
This module defines variable data types.
Definition: kind.f90:8
subroutine, public read_int1d_layered(parser, int1d, aname, nlay, layer_shape)
subroutine, public read_dbl1d_layered(parser, dbl1d, aname, nlay, layer_shape)
subroutine, public read_dbl2d_layered(parser, dbl2d, aname, nlay, layer_shape)
subroutine, public read_int3d_layered(parser, int3d, aname, nlay, layer_shape)
subroutine, public read_dbl3d_layered(parser, dbl3d, aname, nlay, layer_shape)
subroutine, public read_int2d_layered(parser, int2d, aname, nlay, layer_shape)