31 class(CellWithNbrsType) :: this
33 class(VirtualModelType),
pointer :: v_model
35 integer(I4B) :: nbrCnt, currentSize, i
36 type(CellWithNbrsType),
dimension(:),
pointer,
contiguous :: newNeighbors
37 type(CellWithNbrsType),
dimension(:),
pointer,
contiguous :: oldNeighbors
39 if (.not.
associated(this%neighbors))
then
40 allocate (this%neighbors(defaultcapacity))
44 nbrcnt = this%nrOfNbrs
45 currentsize =
size(this%neighbors)
46 if (nbrcnt + 1 > currentsize)
then
49 oldneighbors => this%neighbors
50 allocate (newneighbors(currentsize + defaultcapacity))
52 newneighbors(i) = oldneighbors(i)
54 this%neighbors => newneighbors
57 deallocate (oldneighbors)
58 nullify (oldneighbors)
61 this%neighbors(nbrcnt + 1)%cell%index = index
62 this%neighbors(nbrcnt + 1)%cell%v_model => v_model
64 this%nrOfNbrs = nbrcnt + 1