MODFLOW 6  version 6.7.0.dev0
USGS Modular Hydrologic Model
cellwithnbrsmodule Module Reference

Data Types

type  globalcelltype
 Data structure to hold a global cell identifier, using a pointer to the model and its local cell. More...
 
type  cellwithnbrstype
 

Functions/Subroutines

subroutine addnbrcell (this, index, v_model)
 

Variables

integer(i4b), parameter defaultcapacity = 6
 index More...
 

Function/Subroutine Documentation

◆ addnbrcell()

subroutine cellwithnbrsmodule::addnbrcell ( class(cellwithnbrstype this,
integer(i4b)  index,
class(virtualmodeltype), pointer  v_model 
)

Definition at line 30 of file CellWithNbrs.f90.

31  class(CellWithNbrsType) :: this
32  integer(I4B) :: index
33  class(VirtualModelType), pointer :: v_model
34  ! local
35  integer(I4B) :: nbrCnt, currentSize, i
36  type(CellWithNbrsType), dimension(:), pointer, contiguous :: newNeighbors
37  type(CellWithNbrsType), dimension(:), pointer, contiguous :: oldNeighbors
38 
39  if (.not. associated(this%neighbors)) then
40  allocate (this%neighbors(defaultcapacity))
41  this%nrOfNbrs = 0
42  end if
43 
44  nbrcnt = this%nrOfNbrs
45  currentsize = size(this%neighbors)
46  if (nbrcnt + 1 > currentsize) then
47 
48  ! inflate
49  oldneighbors => this%neighbors
50  allocate (newneighbors(currentsize + defaultcapacity))
51  do i = 1, currentsize
52  newneighbors(i) = oldneighbors(i)
53  end do
54  this%neighbors => newneighbors
55 
56  ! clean up
57  deallocate (oldneighbors)
58  nullify (oldneighbors)
59  end if
60 
61  this%neighbors(nbrcnt + 1)%cell%index = index
62  this%neighbors(nbrcnt + 1)%cell%v_model => v_model
63 
64  this%nrOfNbrs = nbrcnt + 1
65 

Variable Documentation

◆ defaultcapacity

integer(i4b), parameter cellwithnbrsmodule::defaultcapacity = 6
private

Definition at line 8 of file CellWithNbrs.f90.

8  integer(I4B), parameter :: defaultCapacity = 6