58 character(len=LENMEMPATH) :: memorypath
59 integer(I4B) :: internalstencildepth
60 integer(I4B) :: exchangestencildepth
65 integer(I4B),
pointer :: nrofboundarycells => null()
70 integer(I4B),
pointer :: nrofcells => null()
72 integer(I4B),
dimension(:),
pointer,
contiguous :: idxtoglobalidx => null()
75 integer(I4B),
dimension(:),
pointer :: region_to_iface_map => null()
76 integer(I4B),
dimension(:),
pointer :: regionalmodeloffset => null()
77 integer(I4B),
pointer :: indexcount => null()
80 integer(I4B),
dimension(:),
pointer :: connectionmask => null()
128 subroutine construct(this, model, nrOfPrimaries, connectionName)
131 integer(I4B) :: nrOfPrimaries
132 character(len=*) :: connectionName
139 call this%allocateScalars()
141 allocate (this%boundaryCells(nrofprimaries))
142 allocate (this%connectedCells(nrofprimaries))
143 allocate (this%idxToGlobal(2 * nrofprimaries))
146 call this%addToRegionalModels(v_model)
148 this%nrOfBoundaryCells = 0
150 this%internalStencilDepth = 1
151 this%exchangeStencilDepth = 1
152 this%haloExchanges => null()
162 integer(I4B) :: iconn
165 this%primaryExchange => primex
168 do iconn = 1, primex%nexg
169 call this%connectCell(primex%nodem1(iconn), primex%v_model1, &
170 primex%nodem2(iconn), primex%v_model2)
188 this%nrOfBoundaryCells = this%nrOfBoundaryCells + 1
189 if (this%nrOfBoundaryCells >
size(this%boundaryCells))
then
190 write (*, *)
'Error: nr of cell connections exceeds '// &
191 'capacity in grid connection, terminating...'
195 bnd_cell => this%boundaryCells(this%nrOfBoundaryCells)%cell
196 conn_cell => this%connectedCells(this%nrOfBoundaryCells)%cell
197 if (v_model1 == this%model)
then
198 bnd_cell%index = idx1
199 bnd_cell%v_model => v_model1
200 conn_cell%index = idx2
201 conn_cell%v_model => v_model2
202 else if (v_model2 == this%model)
then
203 bnd_cell%index = idx2
204 bnd_cell%v_model => v_model2
205 conn_cell%index = idx1
206 conn_cell%v_model => v_model1
208 write (*, *)
'Error: unable to connect cells outside the model'
220 class(*),
pointer :: vm_obj
223 if (.not. this%regionalModels%ContainsObject(vm_obj))
then
224 call this%regionalModels%Add(vm_obj)
241 integer(I4B) :: remoteDepth, localDepth
242 integer(I4B) :: icell
243 integer(I4B) :: imod, regionSize, offset
248 remotedepth = this%exchangeStencilDepth
249 localdepth = 2 * this%internalStencilDepth - 1
250 if (localdepth < remotedepth)
then
251 localdepth = remotedepth
256 do icell = 1, this%nrOfBoundaryCells
257 call this%addNeighbors(this%boundaryCells(icell), localdepth, &
258 this%connectedCells(icell)%cell, .true.)
261 do icell = 1, this%nrOfBoundaryCells
262 call this%addNeighbors(this%connectedCells(icell), remotedepth, &
263 this%boundaryCells(icell)%cell, .false.)
267 allocate (this%regionalModelOffset(this%regionalModels%Count()))
270 do imod = 1, this%regionalModels%Count()
272 regionsize = regionsize + v_model%dis_nodes%get()
273 this%regionalModelOffset(imod) = offset
274 offset = offset + v_model%dis_nodes%get()
277 allocate (this%region_to_iface_map(regionsize))
278 this%region_to_iface_map = -1
280 call this%buildConnections()
289 integer(I4B) :: icell, iconn
290 integer(I4B),
dimension(:),
allocatable :: nnz
292 integer(I4B) :: ierror
298 do icell = 1, this%nrOfBoundaryCells
299 call this%registerInterfaceCells(this%boundaryCells(icell))
301 do icell = 1, this%nrOfBoundaryCells
302 call this%registerInterfaceCells(this%connectedCells(icell))
304 this%nrOfCells = this%indexCount
307 call this%compressGlobalMap()
310 call this%sortInterfaceGrid()
313 call mem_allocate(this%idxToGlobalIdx, this%nrOfCells, &
314 'IDXTOGLOBALIDX', this%memoryPath)
318 allocate (nnz(this%nrOfCells))
320 call sparse%init(this%nrOfCells, this%nrOfCells, nnz)
324 call this%makePrimaryConnections(sparse)
326 do icell = 1, this%nrOfBoundaryCells
327 call this%connectNeighborCells(this%boundaryCells(icell), sparse)
330 do icell = 1, this%nrOfBoundaryCells
331 call this%connectNeighborCells(this%connectedCells(icell), sparse)
335 allocate (this%connections)
336 conn => this%connections
337 call conn%allocate_scalars(this%memoryPath)
338 conn%nodes = this%nrOfCells
339 conn%nja = sparse%nnz
340 conn%njas = (conn%nja - conn%nodes) / 2
341 call conn%allocate_arrays()
342 do iconn = 1, conn%njas
343 conn%anglex(iconn) = -999.
347 call sparse%filliaja(conn%ia, conn%ja, ierror)
348 if (ierror /= 0)
then
349 write (*, *)
'Error filling ia/ja in GridConnection: terminating...'
352 call fillisym(conn%nodes, conn%nja, conn%ia, conn%ja, conn%isym)
353 call filljas(conn%nodes, conn%nja, conn%ia, conn%ja, conn%isym, conn%jas)
354 call sparse%destroy()
358 call this%fillConnectionDataInternal()
359 call this%fillConnectionDataFromExchanges()
362 call this%createConnectionMask()
368 recursive subroutine addneighbors(this, cellNbrs, depth, mask, interior)
372 integer(I4B),
intent(inout) :: depth
374 logical(LGP) :: interior
377 integer(I4B) :: ipos, ipos_start, ipos_end
378 integer(I4B) :: nbridx, inbr
379 integer(I4B) :: newdepth
382 cell => cellnbrs%cell
392 ipos_start = cell%v_model%con_ia%get(cell%index) + 1
393 ipos_end = cell%v_model%con_ia%get(cell%index + 1) - 1
394 do ipos = ipos_start, ipos_end
395 nbridx = cell%v_model%con_ja%get(ipos)
396 call this%addNeighborCell(cellnbrs, nbridx, cellnbrs%cell%v_model, mask)
400 call this%addRemoteNeighbors(cellnbrs, mask)
403 do inbr = 1, cellnbrs%nrOfNbrs
406 if (interior .and. cellnbrs%cell%v_model == this%model)
then
407 if (.not. cellnbrs%neighbors(inbr)%cell%v_model == this%model)
then
410 newdepth = newdepth - 1
414 call this%addNeighbors(cellnbrs%neighbors(inbr), newdepth, &
415 cellnbrs%cell, interior)
427 integer(I4B) :: ix, iexg
432 do ix = 1, this%haloExchanges%size
435 v_m1 => v_exchange%v_model1
436 v_m2 => v_exchange%v_model2
439 if (cellnbrs%cell%v_model == v_m1)
then
440 do iexg = 1, v_exchange%nexg%get()
441 if (v_exchange%nodem1%get(iexg) == cellnbrs%cell%index)
then
443 call this%addNeighborCell( &
444 cellnbrs, v_exchange%nodem2%get(iexg), v_m2, mask)
449 if (cellnbrs%cell%v_model == v_m2)
then
450 do iexg = 1, v_exchange%nexg%get()
451 if (v_exchange%nodem2%get(iexg) == cellnbrs%cell%index)
then
453 call this%addNeighborCell( &
454 cellnbrs, v_exchange%nodem1%get(iexg), v_m1, mask)
468 integer(I4B),
intent(in) :: newNbrIdx
472 if (
present(mask))
then
473 if (newnbridx == mask%index .and. mask%v_model == v_nbr_model)
then
478 call cellnbrs%addNbrCell(newnbridx, v_nbr_model)
488 integer(I4B) :: offset, inbr
489 integer(I4B) :: regionidx
490 integer(I4B) :: ifaceidx
492 offset = this%get_regional_offset(cellwithnbrs%cell%v_model)
493 regionidx = offset + cellwithnbrs%cell%index
494 ifaceidx = this%getInterfaceIndex(cellwithnbrs%cell)
495 if (ifaceidx == -1)
then
496 this%indexCount = this%indexCount + 1
497 ifaceidx = this%indexCount
498 call this%addToGlobalMap(ifaceidx, cellwithnbrs%cell)
499 this%region_to_iface_map(regionidx) = ifaceidx
503 do inbr = 1, cellwithnbrs%nrOfNbrs
504 call this%registerInterfaceCells(cellwithnbrs%neighbors(inbr))
513 integer(I4B),
intent(in) :: ifaceIdx
516 integer(I4B) :: i, currentSize, newSize
520 currentsize =
size(this%idxToGlobal)
521 if (ifaceidx > currentsize)
then
522 newsize = nint(1.5 * currentsize)
523 allocate (tempmap(newsize))
524 do i = 1, currentsize
525 tempmap(i) = this%idxToGlobal(i)
528 deallocate (this%idxToGlobal)
529 this%idxToGlobal => tempmap
532 this%idxToGlobal(ifaceidx) = cell
543 if (
size(this%idxToGlobal) > this%nrOfCells)
then
544 allocate (tempmap(this%nrOfCells))
545 tempmap(1:this%nrOfCells) = this%idxToGlobal(1:this%nrOfCells)
546 deallocate (this%idxToGlobal)
547 allocate (this%idxToGlobal(this%nrOfCells))
548 this%idxToGlobal(1:this%nrOfCells) = tempmap(1:this%nrOfCells)
560 integer(I4B),
dimension(:),
allocatable :: newToOldIdx
561 integer(I4B),
dimension(:),
allocatable :: oldToNewIdx
562 integer(I4B) :: idxOld
564 type(
globalcelltype),
dimension(:),
allocatable :: sortedGlobalMap
565 integer(I4B),
dimension(:),
allocatable :: sortedRegionMap
568 newtooldidx = (/(i, i=1,
size(this%idxToGlobal))/)
569 call quicksortgrid(newtooldidx,
size(newtooldidx), this%idxToGlobal)
572 allocate (oldtonewidx(
size(newtooldidx)))
573 do i = 1,
size(oldtonewidx)
574 oldtonewidx(newtooldidx(i)) = i
578 allocate (sortedglobalmap(
size(this%idxToGlobal)))
579 do i = 1,
size(newtooldidx)
580 sortedglobalmap(i) = this%idxToGlobal(newtooldidx(i))
582 do i = 1,
size(newtooldidx)
583 this%idxToGlobal(i) = sortedglobalmap(i)
585 deallocate (sortedglobalmap)
588 allocate (sortedregionmap(
size(this%region_to_iface_map)))
589 do i = 1,
size(sortedregionmap)
590 if (this%region_to_iface_map(i) /= -1)
then
591 idxold = this%region_to_iface_map(i)
592 sortedregionmap(i) = oldtonewidx(idxold)
594 sortedregionmap(i) = -1
597 do i = 1,
size(sortedregionmap)
598 this%region_to_iface_map(i) = sortedregionmap(i)
600 deallocate (sortedregionmap)
610 integer(I4B) :: icell
611 integer(I4B) :: ifaceIdx, ifaceIdxNbr
613 do icell = 1, this%nrOfBoundaryCells
614 ifaceidx = this%getInterfaceIndex(this%boundaryCells(icell)%cell)
615 ifaceidxnbr = this%getInterfaceIndex(this%connectedCells(icell)%cell)
618 call sparse%addconnection(ifaceidx, ifaceidx, 1)
619 call sparse%addconnection(ifaceidxnbr, ifaceidxnbr, 1)
622 call sparse%addconnection(ifaceidx, ifaceidxnbr, 1)
623 call sparse%addconnection(ifaceidxnbr, ifaceidx, 1)
636 integer(I4B) :: ifaceidx, ifaceidxnbr
639 ifaceidx = this%getInterfaceIndex(cell%cell)
640 do inbr = 1, cell%nrOfNbrs
641 ifaceidxnbr = this%getInterfaceIndex(cell%neighbors(inbr)%cell)
643 call sparse%addconnection(ifaceidxnbr, ifaceidxnbr, 1)
644 call sparse%addconnection(ifaceidx, ifaceidxnbr, 1)
645 call sparse%addconnection(ifaceidxnbr, ifaceidx, 1)
648 call this%connectNeighborCells(cell%neighbors(inbr), sparse)
660 integer(I4B) :: n, m, ipos, isym, ipos_orig, isym_orig
664 conn => this%connections
667 do ipos = conn%ia(n) + 1, conn%ia(n + 1) - 1
671 isym = conn%jas(ipos)
672 ncell => this%idxToGlobal(n)
673 mcell => this%idxToGlobal(m)
674 if (ncell%v_model == mcell%v_model)
then
680 ipos_orig =
getcsrindex(ncell%index, mcell%index, &
681 v_m%con_ia%get_array(), v_m%con_ja%get_array())
683 if (ipos_orig == 0)
then
686 if (this%isPeriodic(ncell%index, mcell%index)) cycle
689 write (*, *)
'Error: cannot find cell connection in model grid'
693 isym_orig = v_m%con_jas%get(ipos_orig)
694 conn%hwva(isym) = v_m%con_hwva%get(isym_orig)
695 conn%ihc(isym) = v_m%con_ihc%get(isym_orig)
696 if (ncell%index < mcell%index)
then
697 conn%cl1(isym) = v_m%con_cl1%get(isym_orig)
698 conn%cl2(isym) = v_m%con_cl2%get(isym_orig)
699 conn%anglex(isym) = v_m%con_anglex%get(isym_orig)
701 conn%cl1(isym) = v_m%con_cl2%get(isym_orig)
702 conn%cl2(isym) = v_m%con_cl1%get(isym_orig)
703 conn%anglex(isym) = mod(v_m%con_anglex%get(isym_orig) +
dpi,
dtwopi)
717 integer(I4B) :: inx, iexg
718 integer(I4B) :: ipos, isym
719 integer(I4B) :: nOffset, mOffset, nIfaceIdx, mIfaceIdx
724 conn => this%connections
726 do inx = 1, this%haloExchanges%size
729 v_m1 => v_exg%v_model1
730 v_m2 => v_exg%v_model2
732 if (v_exg%ianglex%get() > 0)
then
736 noffset = this%get_regional_offset(v_m1)
737 moffset = this%get_regional_offset(v_m2)
738 do iexg = 1, v_exg%nexg%get()
739 nifaceidx = this%region_to_iface_map(noffset + v_exg%nodem1%get(iexg))
740 mifaceidx = this%region_to_iface_map(moffset + v_exg%nodem2%get(iexg))
743 if (nifaceidx == -1 .or. mifaceidx == -1)
then
747 ipos = conn%getjaindex(nifaceidx, mifaceidx)
754 isym = conn%jas(ipos)
758 if (nifaceidx < mifaceidx)
then
759 conn%cl1(isym) = v_exg%cl1%get(iexg)
760 conn%cl2(isym) = v_exg%cl2%get(iexg)
761 if (v_exg%ianglex%get() > 0)
then
762 conn%anglex(isym) = &
763 v_exg%auxvar%get(v_exg%ianglex%get(), iexg) *
dpio180
766 conn%cl1(isym) = v_exg%cl2%get(iexg)
767 conn%cl2(isym) = v_exg%cl1%get(iexg)
768 if (v_exg%ianglex%get() > 0)
then
769 conn%anglex(isym) = mod(v_exg%auxvar%get(v_exg%ianglex%get(), iexg) &
770 + 180.0_dp, 360.0_dp) *
dpio180
773 conn%hwva(isym) = v_exg%hwva%get(iexg)
774 conn%ihc(isym) = v_exg%ihc%get(iexg)
790 integer(I4B) :: icell, inbr, n, ipos
791 integer(I4B) :: level, newMask
795 do ipos = 1, this%connections%nja
796 call this%connections%set_mask(ipos, 0)
802 do icell = 1, this%nrOfBoundaryCells
803 call this%setMaskOnConnection(this%boundaryCells(icell), &
804 this%connectedCells(icell), level)
808 call this%setMaskOnConnection(this%connectedCells(icell), &
809 this%boundaryCells(icell), level)
813 do icell = 1, this%nrOfBoundaryCells
814 cell => this%boundaryCells(icell)
815 do inbr = 1, cell%nrOfNbrs
816 nbrcell => this%boundaryCells(icell)%neighbors(inbr)
818 call this%maskInternalConnections(this%boundaryCells(icell), &
819 this%boundaryCells(icell)% &
820 neighbors(inbr), level)
827 do n = 1, this%connections%nodes
829 call this%connections%set_mask(this%connections%ia(n), 0)
831 do ipos = this%connections%ia(n) + 1, this%connections%ia(n + 1) - 1
833 if (this%connections%mask(ipos) > 0)
then
834 if (this%connections%mask(ipos) < this%internalStencilDepth + 1)
then
839 call this%connections%set_mask(ipos, newmask)
851 integer(I4B),
intent(in) :: level
853 integer(I4B) :: inbr, newlevel
857 if (cell%cell%v_model == this%model .and. &
858 nbrcell%cell%v_model == this%model)
then
860 call this%setMaskOnConnection(cell, nbrcell, level)
861 call this%setMaskOnConnection(nbrcell, cell, level)
866 do inbr = 1, nbrcell%nrOfNbrs
867 call this%maskInternalConnections(nbrcell, &
868 nbrcell%neighbors(inbr), &
881 integer(I4B),
intent(in) :: level
883 integer(I4B) :: ifaceIdx, ifaceIdxNbr
884 integer(I4B) :: iposdiag, ipos
885 integer(I4B) :: currentLevel
887 ifaceidx = this%getInterfaceIndex(cell%cell)
888 ifaceidxnbr = this%getInterfaceIndex(nbrcell%cell)
891 iposdiag = this%connections%getjaindex(ifaceidx, ifaceidx)
892 currentlevel = this%connections%mask(iposdiag)
893 if (currentlevel == 0 .or. level < currentlevel)
then
894 call this%connections%set_mask(iposdiag, level)
897 ipos = this%connections%getjaindex(ifaceidx, ifaceidxnbr)
898 currentlevel = this%connections%mask(ipos)
899 if (currentlevel == 0 .or. level < currentlevel)
then
900 call this%connections%set_mask(ipos, level)
910 integer(I4B) :: iface_idx
912 integer(I4B) :: offset, region_idx
914 offset = this%get_regional_offset(cell%v_model)
915 region_idx = offset + cell%index
916 iface_idx = this%region_to_iface_map(region_idx)
924 integer(I4B) :: index
926 integer(I4B) :: iface_idx
928 integer(I4B) :: offset, region_idx
930 offset = this%get_regional_offset(v_model)
931 region_idx = offset + index
932 iface_idx = this%region_to_iface_map(region_idx)
941 integer(I4B) :: offset
947 do im = 1, this%regionalModels%Count()
949 if (vm == v_model)
then
950 offset = this%regionalModelOffset(im)
963 call mem_allocate(this%nrOfBoundaryCells,
'NRBNDCELLS', this%memoryPath)
964 call mem_allocate(this%indexCount,
'IDXCOUNT', this%memoryPath)
965 call mem_allocate(this%nrOfCells,
'NRCELLS', this%memoryPath)
978 integer(I4B) :: icell, nrOfCells, idx
980 real(DP) :: xglo, yglo
983 nrofcells = this%nrOfCells
984 disu%nodes = nrofcells
985 disu%nodesuser = nrofcells
986 disu%nja = this%connections%nja
988 call disu%allocate_arrays()
990 call disu%allocate_arrays_mem()
993 do icell = 1, nrofcells
994 idx = this%idxToGlobal(icell)%index
995 disu%top(icell) = -huge(1.0_dp)
996 disu%bot(icell) = -huge(1.0_dp)
997 disu%area(icell) = -huge(1.0_dp)
1001 disu%con => this%connections
1002 disu%njas = disu%con%njas
1005 do icell = 1, nrofcells
1006 idx = this%idxToGlobal(icell)%index
1007 v_model => this%idxToGlobal(icell)%v_model
1012 v_model%dis_yc%get(idx), &
1013 v_model%dis_xorigin%get(), &
1014 v_model%dis_yorigin%get(), &
1015 v_model%dis_angrot%get(), &
1019 disu%cellxy(1, icell) = xglo
1020 disu%xc(icell) = xglo
1021 disu%cellxy(2, icell) = yglo
1022 disu%yc(icell) = yglo
1042 integer(I4B) :: i, j, iloc, jloc
1043 integer(I4B) :: im, ix, mid, n
1044 integer(I4B) :: ipos, ipos_model
1046 type(
stlvecint) :: src_idx_tmp, tgt_idx_tmp, sign_tmp
1051 integer(I4B),
dimension(:),
pointer,
contiguous :: ia_ptr, ja_ptr
1053 allocate (this%interfaceMap)
1054 imap => this%interfaceMap
1057 call model_ids%init()
1058 do i = 1, this%nrOfCells
1059 call model_ids%push_back_unique(this%idxToGlobal(i)%v_model%id)
1063 call imap%init(model_ids%size, this%haloExchanges%size)
1066 do im = 1, model_ids%size
1067 mid = model_ids%at(im)
1068 imap%model_ids(im) = mid
1070 imap%model_names(im) = vm%name
1071 call src_idx_tmp%init()
1072 call tgt_idx_tmp%init()
1075 do i = 1, this%nrOfCells
1076 if (mid == this%idxToGlobal(i)%v_model%id)
then
1077 call src_idx_tmp%push_back(this%idxToGlobal(i)%index)
1078 call tgt_idx_tmp%push_back(i)
1083 allocate (imap%node_maps(im)%src_idx(src_idx_tmp%size))
1084 allocate (imap%node_maps(im)%tgt_idx(tgt_idx_tmp%size))
1085 do i = 1, src_idx_tmp%size
1086 imap%node_maps(im)%src_idx(i) = src_idx_tmp%at(i)
1087 imap%node_maps(im)%tgt_idx(i) = tgt_idx_tmp%at(i)
1090 call src_idx_tmp%destroy()
1091 call tgt_idx_tmp%destroy()
1094 call src_idx_tmp%init()
1095 call tgt_idx_tmp%init()
1098 do i = 1, this%nrOfCells
1099 if (mid /= this%idxToGlobal(i)%v_model%id) cycle
1100 do ipos = this%connections%ia(i), this%connections%ia(i + 1) - 1
1101 j = this%connections%ja(ipos)
1102 if (mid /= this%idxToGlobal(j)%v_model%id) cycle
1105 iloc = this%idxToGlobal(i)%index
1106 jloc = this%idxToGlobal(j)%index
1107 ia_ptr => this%idxToGlobal(i)%v_model%con_ia%get_array()
1108 ja_ptr => this%idxToGlobal(i)%v_model%con_ja%get_array()
1109 ipos_model =
getcsrindex(iloc, jloc, ia_ptr, ja_ptr)
1110 call src_idx_tmp%push_back(ipos_model)
1111 call tgt_idx_tmp%push_back(ipos)
1116 allocate (imap%conn_maps(im)%src_idx(src_idx_tmp%size))
1117 allocate (imap%conn_maps(im)%tgt_idx(tgt_idx_tmp%size))
1118 do i = 1, src_idx_tmp%size
1119 imap%conn_maps(im)%src_idx(i) = src_idx_tmp%at(i)
1120 imap%conn_maps(im)%tgt_idx(i) = tgt_idx_tmp%at(i)
1123 call src_idx_tmp%destroy()
1124 call tgt_idx_tmp%destroy()
1128 call model_ids%destroy()
1131 do ix = 1, this%haloExchanges%size
1136 v_model1 => v_exg%v_model1
1137 v_model2 => v_exg%v_model2
1139 imap%exchange_ids(ix) = v_exg%id
1140 imap%exchange_names(ix) = v_exg%name
1142 call src_idx_tmp%init()
1143 call tgt_idx_tmp%init()
1144 call sign_tmp%init()
1146 do n = 1, v_exg%nexg%get()
1147 i = this%getInterfaceIndex(v_exg%nodem1%get(n), v_model1)
1148 j = this%getInterfaceIndex(v_exg%nodem2%get(n), v_model2)
1149 if (i == -1 .or. j == -1) cycle
1150 ipos = this%connections%getjaindex(i, j)
1158 call src_idx_tmp%push_back(n)
1159 call tgt_idx_tmp%push_back(ipos)
1160 call sign_tmp%push_back(1)
1163 call src_idx_tmp%push_back(n)
1164 call tgt_idx_tmp%push_back(this%connections%isym(ipos))
1165 call sign_tmp%push_back(-1)
1168 allocate (imap%exchange_maps(ix)%src_idx(src_idx_tmp%size))
1169 allocate (imap%exchange_maps(ix)%tgt_idx(tgt_idx_tmp%size))
1170 allocate (imap%exchange_maps(ix)%sign(sign_tmp%size))
1171 do i = 1, src_idx_tmp%size
1172 imap%exchange_maps(ix)%src_idx(i) = src_idx_tmp%at(i)
1173 imap%exchange_maps(ix)%tgt_idx(i) = tgt_idx_tmp%at(i)
1174 imap%exchange_maps(ix)%sign(i) = sign_tmp%at(i)
1177 call src_idx_tmp%destroy()
1178 call tgt_idx_tmp%destroy()
1179 call sign_tmp%destroy()
1185 imap%prim_exg_idx = -1
1186 do i = 1, imap%nr_exchanges
1187 if (imap%exchange_names(i) == this%primaryExchange%name)
then
1188 imap%prim_exg_idx = i
1227 deallocate (this%idxToGlobal)
1228 deallocate (this%boundaryCells)
1229 deallocate (this%connectedCells)
1239 integer(I4B),
intent(in) :: n
1240 integer(I4B),
intent(in) :: m
1243 integer(I4B) :: icell
1246 do icell = 1, this%nrOfBoundaryCells
1247 if (.not. this%boundaryCells(icell)%cell%v_model == &
1248 this%connectedCells(icell)%cell%v_model)
then
1253 if (this%boundaryCells(icell)%cell%index == n)
then
1254 if (this%connectedCells(icell)%cell%index == m)
then
1260 if (this%boundaryCells(icell)%cell%index == m)
then
1261 if (this%connectedCells(icell)%cell%index == n)
then
subroutine, public dis_transform_xy(x, y, xorigin, yorigin, angrot, xglo, yglo)
Get global (x, y) coordinates from cell-local coordinates.
class(basemodeltype) function, pointer, public getbasemodelfromlist(list, idx)
subroutine, public fillisym(neq, nja, ia, ja, isym)
Function to fill the isym array.
subroutine, public filljas(neq, nja, ia, ja, isym, jas)
Function to fill the jas array.
This module contains simulation constants.
integer(i4b), parameter lenmodelname
maximum length of the model name
real(dp), parameter dtwopi
real constant
real(dp), parameter dpi
real constant
real(dp), parameter dpio180
real constant
real(dp), parameter dzero
real constant zero
integer(i4b), parameter lenmempath
maximum length of the memory path
integer(i4b) function, public getcsrindex(i, j, ia, ja)
Return index for element i,j in CSR storage,.
Refactoring issues towards parallel:
recursive subroutine addneighbors(this, cellNbrs, depth, mask, interior)
recursive subroutine maskinternalconnections(this, cell, nbrCell, level)
Recursively mask connections, increasing the level as we go.
integer(i4b), parameter initnrneighbors
subroutine sortinterfacegrid(this)
Soft cell ids in the interface grid such that.
subroutine getdiscretization(this, disu)
Sets the discretization (DISU) after all preprocessing by this grid connection has been done,...
subroutine addtoregionalmodels(this, v_model)
Add a model to a list of all regional models.
subroutine createconnectionmask(this)
Create the connection masks.
subroutine connectcell(this, idx1, v_model1, idx2, v_model2)
Connect neighboring cells at the interface by storing them in the boundary cell and connected cell ar...
subroutine buildconnections(this)
Builds a sparse matrix holding all cell connections,.
integer(i4b) function get_regional_offset(this, v_model)
Get the offset for a regional model.
subroutine addtoglobalmap(this, ifaceIdx, cell)
Add entry to lookup table, inflating when necessary.
subroutine fillconnectiondatafromexchanges(this)
Fill connection data (ihc, cl1, ...) for.
subroutine setmaskonconnection(this, cell, nbrCell, level)
Set a mask on the connection from a cell to its neighbor, (and not the transposed!...
subroutine addneighborcell(this, cellNbrs, newNbrIdx, v_nbr_model, mask)
Add neighboring cell to tree structure.
subroutine allocatescalars(this)
Allocate scalar data.
subroutine extendconnection(this)
Extend the connection topology to deal with higher levels of connectivity (neighbors-of-neighbors,...
subroutine construct(this, model, nrOfPrimaries, connectionName)
Construct the GridConnection and allocate the data structures for the primary connections.
recursive subroutine registerinterfacecells(this, cellWithNbrs)
Recursively set interface cell indexes and.
subroutine makeprimaryconnections(this, sparse)
Add primary connections to the sparse data structure.
subroutine connectprimaryexchange(this, primEx)
Make connections for the primary exchange.
subroutine compressglobalmap(this)
Compress lookup table to get rid of unused entries.
recursive subroutine connectneighborcells(this, cell, sparse)
Recursively add higher order connections (from cells neighboring the primarily connected cells) to th...
integer(i4b) function getinterfaceindexbyindexmodel(this, index, v_model)
Get interface index from a model pointer and the local index.
subroutine addremoteneighbors(this, cellNbrs, mask)
Add cell neighbors across models using the stored exchange data structures.
logical function isperiodic(this, n, m)
Test if the connection between nodes within.
integer(i4b) function getinterfaceindexbycell(this, cell)
Get interface index from global cell.
subroutine fillconnectiondatainternal(this)
Fill connection data (ihc, cl1, ...) for.
subroutine buildinterfacemap(this)
Build interface map object for outside use.
subroutine, public quicksortgrid(array, arraySize, idxToGlobal)
This module defines variable data types.
character(len=lenmempath) function create_mem_path(component, subcomponent, context)
returns the path to the memory object
This module contains simulation methods.
subroutine, public ustop(stopmess, ioutlocal)
Stop the simulation.
class(virtualexchangetype) function, pointer, public get_virtual_exchange(exg_id)
Returns a virtual exchange with the specified id.
class(virtualmodeltype) function, pointer, public get_virtual_model_from_list(model_list, idx)
Highest level model type. All models extend this parent type.
Data structure to hold a global cell identifier, using a pointer to the model and its local cell.
Exchange based on connection between discretizations of DisBaseType. The data specifies the connectio...
Unstructured grid discretization.
This class is used to construct the connections object for the interface model's spatial discretizati...
A generic heterogeneous doubly-linked list.
The Virtual Exchange is based on two Virtual Models and is therefore not always strictly local or rem...