MODFLOW 6  version 6.5.0.dev2
MODFLOW 6 Code Documentation
arrayhandlersmodule::expandarray2d Interface Reference
Collaboration diagram for arrayhandlersmodule::expandarray2d:
Collaboration graph

Private Member Functions

subroutine expand_integer_2d (array, increment1, increment2)
 
subroutine expand_double_2d (array, increment1, increment2)
 

Detailed Description

Definition at line 26 of file ArrayHandlers.f90.

Member Function/Subroutine Documentation

◆ expand_double_2d()

subroutine arrayhandlersmodule::expandarray2d::expand_double_2d ( real(dp), dimension(:, :), intent(inout), allocatable  array,
integer(i4b), intent(in), optional  increment1,
integer(i4b), intent(in), optional  increment2 
)
private

Definition at line 302 of file ArrayHandlers.f90.

303  ! -- dummy
304  real(DP), allocatable, intent(inout) :: array(:, :)
305  integer(I4B), optional, intent(in) :: increment1
306  integer(I4B), optional, intent(in) :: increment2
307  ! -- local
308  integer(I4B) :: inc1, inc2, lb1, lb2, n1, n2
309  real(DP), allocatable, dimension(:, :) :: temp
310 
311  ! -- default to expanding both dimensions by 1
312  if (present(increment1)) then
313  inc1 = increment1
314  else
315  inc1 = 1
316  end if
317  if (present(increment2)) then
318  inc2 = increment2
319  else
320  inc2 = 1
321  end if
322  if (inc1 == 0 .and. inc2 == 0) return
323  if (inc1 < 0 .or. inc2 < 0) &
324  call pstop(1, "increments must be nonnegative")
325 
326  ! -- expand array to the requested size, keeping
327  ! existing items and the existing lower bound,
328  ! or allocate the array if still unallocated
329  if (allocated(array)) then
330  lb1 = lbound(array, 1)
331  lb2 = lbound(array, 2)
332  n1 = size(array, 1)
333  n2 = size(array, 2)
334  allocate (temp( &
335  lb1:(lb1 + n1 + inc1 - 1), &
336  lb2:(lb2 + n2 + inc2 - 1)))
337  temp( &
338  lb1:(lb1 + n1 - 1), &
339  lb2:(lb2 + n2 - 1)) = array
340  deallocate (array)
341  call move_alloc(temp, array)
342  else
343  allocate (array(inc1, inc2))
344  end if
345 
Here is the call graph for this function:

◆ expand_integer_2d()

subroutine arrayhandlersmodule::expandarray2d::expand_integer_2d ( integer(i4b), dimension(:, :), intent(inout), allocatable  array,
integer(i4b), intent(in), optional  increment1,
integer(i4b), intent(in), optional  increment2 
)
private

Definition at line 256 of file ArrayHandlers.f90.

257  ! -- dummy
258  integer(I4B), allocatable, intent(inout) :: array(:, :)
259  integer(I4B), optional, intent(in) :: increment1
260  integer(I4B), optional, intent(in) :: increment2
261  ! -- local
262  integer(I4B) :: inc1, inc2, lb1, lb2, n1, n2
263  integer(I4B), allocatable, dimension(:, :) :: temp
264 
265  ! -- default to expanding both dimensions by 1
266  if (present(increment1)) then
267  inc1 = increment1
268  else
269  inc1 = 1
270  end if
271  if (present(increment2)) then
272  inc2 = increment2
273  else
274  inc2 = 1
275  end if
276  if (inc1 == 0 .and. inc2 == 0) return
277  if (inc1 < 0 .or. inc2 < 0) &
278  call pstop(1, "increments must be nonnegative")
279 
280  ! -- expand array to the requested size, keeping
281  ! existing items and the existing lower bound,
282  ! or allocate the array if still unallocated
283  if (allocated(array)) then
284  lb1 = lbound(array, 1)
285  lb2 = lbound(array, 2)
286  n1 = size(array, 1)
287  n2 = size(array, 2)
288  allocate (temp( &
289  lb1:(lb1 + n1 + inc1 - 1), &
290  lb2:(lb2 + n2 + inc2 - 1)))
291  temp( &
292  lb1:(lb1 + n1 - 1), &
293  lb2:(lb2 + n2 - 1)) = array
294  deallocate (array)
295  call move_alloc(temp, array)
296  else
297  allocate (array(inc1, inc2))
298  end if
299 
Here is the call graph for this function:

The documentation for this interface was generated from the following file: