23 integer(kind=intType) :: nx, ny, nz, &
25 integer(kind=intType) :: blockid
34 integer(kind=intType) :: ncell, nface
79 integer(kind=intType) :: nsubface, n1to1, nbocos
81 integer(kind=intType),
dimension(:),
pointer :: bctype
82 integer(kind=intType),
dimension(:),
pointer :: bcfaceid
83 integer(kind=intType),
dimension(:),
pointer :: cgnssubface
85 integer(kind=intType),
dimension(:),
pointer :: inbeg, inend
86 integer(kind=intType),
dimension(:),
pointer :: jnbeg, jnend
87 integer(kind=intType),
dimension(:),
pointer :: knbeg, knend
89 integer(kind=intType),
dimension(:),
pointer :: dinbeg, dinend
90 integer(kind=intType),
dimension(:),
pointer :: djnbeg, djnend
91 integer(kind=intType),
dimension(:),
pointer :: dknbeg, dknend
93 integer(kind=intType),
dimension(:),
pointer :: neighblock
94 integer(kind=intType),
dimension(:),
pointer :: l1, l2, l3
95 integer(kind=intType),
dimension(:),
pointer :: groupnum
109 integer(kind=intType) :: cgnsblockid
110 integer(kind=intType) :: ibegor, iendor, jbegor, jendor
111 integer(kind=intType) :: kbegor, kendor
132 integer(kind=intType) :: nsubblocks
133 integer(kind=intType),
dimension(:, :, :),
pointer :: ranges
156 integer :: cgnsblockid
159 integer :: ibegor, iendor, jbegor, jendor, kbegor, kendor
168 interface operator(<=)
170 end interface operator(<=)
172 interface operator(<)
174 end interface operator(<)
186 integer :: ibeg, jbeg, kbeg, iend, jend, kend
196 interface operator(<=)
198 end interface operator(<=)
200 interface operator(<)
202 end interface operator(<)
223 interface operator(<=)
225 end interface operator(<=)
227 interface operator(<)
229 end interface operator(<)
234 integer(kind=intType) :: n1, n2, n3, n4
235 real(kind=realtype) :: dist
243 interface operator(<=)
245 end interface operator(<=)
247 interface operator(<)
249 end interface operator(<)
251 interface operator(/=)
253 end interface operator(/=)
265 integer(kind=intType),
dimension(:),
allocatable ::
part
280 character(len=maxStringLen),
dimension(:),
allocatable ::
gridfiles
303 if (g1%cgnsBlockID < g2%cgnsBlockID)
then
306 else if (g1%cgnsBlockID > g2%cgnsBlockID)
then
313 if (g1%procID < g2%procID)
then
316 else if (g1%procID > g2%procID)
then
323 if (g1%blockID < g2%blockID)
then
326 else if (g1%blockID > g2%blockID)
then
356 if (g1%cgnsBlockID < g2%cgnsBlockID)
then
359 else if (g1%cgnsBlockID > g2%cgnsBlockID)
then
366 if (g1%procID < g2%procID)
then
369 else if (g1%procID > g2%procID)
then
376 if (g1%blockID < g2%blockID)
then
379 else if (g1%blockID > g2%blockID)
then
410 if (g1%iBeg < g2%iBeg)
then
413 else if (g1%iBeg > g2%iBeg)
then
420 if (g1%iEnd < g2%iEnd)
then
423 else if (g1%iEnd > g2%iEnd)
then
430 if (g1%jBeg < g2%jBeg)
then
433 else if (g1%jBeg > g2%jBeg)
then
440 if (g1%jEnd < g2%jEnd)
then
443 else if (g1%jEnd > g2%jEnd)
then
450 if (g1%kBeg < g2%kBeg)
then
453 else if (g1%kBeg > g2%kBeg)
then
460 if (g1%kEnd < g2%kEnd)
then
463 else if (g1%kEnd > g2%kEnd)
then
470 if (g1%connID < g2%connID)
then
473 else if (g1%connID > g2%connID)
then
502 if (g1%iBeg < g2%iBeg)
then
505 else if (g1%iBeg > g2%iBeg)
then
512 if (g1%iEnd < g2%iEnd)
then
515 else if (g1%iEnd > g2%iEnd)
then
522 if (g1%jBeg < g2%jBeg)
then
525 else if (g1%jBeg > g2%jBeg)
then
532 if (g1%jEnd < g2%jEnd)
then
535 else if (g1%jEnd > g2%jEnd)
then
542 if (g1%kBeg < g2%kBeg)
then
545 else if (g1%kBeg > g2%kBeg)
then
552 if (g1%kEnd < g2%kEnd)
then
555 else if (g1%kEnd > g2%kEnd)
then
562 if (g1%connID < g2%connID)
then
565 else if (g1%connID > g2%connID)
then
588 integer(kind=intType),
intent(in) :: nn
594 integer(kind=intType),
parameter :: m = 7
596 integer(kind=intType) :: nStack
597 integer(kind=intType) :: i, j, k, r, l, jStack, ii
603 integer(kind=intType),
allocatable,
dimension(:) :: stack
604 integer(kind=intType),
allocatable,
dimension(:) :: tmpStack
609 allocate (stack(nstack), stat=ierr)
611 call terminate(
"qsortSubblocksOfCGNSType", &
612 "Memory allocation failure for stack")
626 if ((r - l) < m)
then
632 do i = (j - 1), l, -1
633 if (arr(i) <= a)
exit
642 if (jstack == 0)
exit
647 l = stack(jstack - 1)
662 if (arr(r) < arr(l))
then
668 if (arr(r) < arr(l + 1))
then
674 if (arr(l + 1) < arr(l))
then
693 if (a <= arr(i))
exit
699 if (arr(j) <= a)
exit
723 if (jstack > nstack)
then
727 allocate (tmpstack(nstack), stat=ierr)
729 call terminate(
"qsortSubblocksOfCGNSType", &
730 "Memory allocation error for tmpStack")
736 deallocate (stack, stat=ierr)
738 call terminate(
"qsortSubblocksOfCGNSType", &
739 "Deallocation error for stack")
741 nstack = nstack + 100
746 allocate (stack(nstack), stat=ierr)
748 call terminate(
"qsortSubblocksOfCGNSType", &
749 "Memory reallocation error for stack")
750 stack(1:ii) = tmpstack(1:ii)
754 deallocate (tmpstack, stat=ierr)
756 call terminate(
"qsortSubblocksOfCGNSType", &
757 "Deallocation error for tmpStack")
760 if ((r - i + 1) >= (j - l))
then
763 stack(jstack - 1) = j
765 stack(jstack) = j - 1
766 stack(jstack - 1) = l
775 deallocate (stack, stat=ierr)
777 call terminate(
"qsortSubblocksOfCGNSType", &
778 "Deallocation error for stack")
784 if (arr(i + 1) < arr(i)) &
785 call terminate(
"qsortSubblocksOfCGNSType", &
786 "Array is not sorted correctly")
804 integer(kind=intType),
intent(in) :: nn
810 integer(kind=intType),
parameter :: m = 7
812 integer(kind=intType) :: nStack
813 integer(kind=intType) :: i, j, k, r, l, jStack, ii
819 integer(kind=intType),
allocatable,
dimension(:) :: stack
820 integer(kind=intType),
allocatable,
dimension(:) :: tmpStack
825 allocate (stack(nstack), stat=ierr)
827 call terminate(
"qsortSubfaceNonMatchType", &
828 "Memory allocation failure for stack")
842 if ((r - l) < m)
then
848 do i = (j - 1), l, -1
849 if (arr(i) <= a)
exit
858 if (jstack == 0)
exit
863 l = stack(jstack - 1)
878 if (arr(r) < arr(l))
then
884 if (arr(r) < arr(l + 1))
then
890 if (arr(l + 1) < arr(l))
then
909 if (a <= arr(i))
exit
915 if (arr(j) <= a)
exit
939 if (jstack > nstack)
then
943 allocate (tmpstack(nstack), stat=ierr)
945 call terminate(
"qsortSubfaceNonMatchType", &
946 "Memory allocation error for tmpStack")
952 deallocate (stack, stat=ierr)
954 call terminate(
"qsortSubfaceNonMatchType", &
955 "Deallocation error for stack")
957 nstack = nstack + 100
962 allocate (stack(nstack), stat=ierr)
964 call terminate(
"qsortSubfaceNonMatchType", &
965 "Memory reallocation error for stack")
966 stack(1:ii) = tmpstack(1:ii)
970 deallocate (tmpstack, stat=ierr)
972 call terminate(
"qsortSubfaceNonMatchType", &
973 "Deallocation error for tmpStack")
976 if ((r - i + 1) >= (j - l))
then
979 stack(jstack - 1) = j
981 stack(jstack) = j - 1
982 stack(jstack - 1) = l
991 deallocate (stack, stat=ierr)
993 call terminate(
"qsortSubfaceNonMatchType", &
994 "Deallocation error for stack")
1000 if (arr(i + 1) < arr(i)) &
1001 call terminate(
"qsortSubfaceNonMatchType", &
1002 "Array is not sorted correctly")
1026 if (g1%kMin < g2%kMin)
then
1029 else if (g1%kMin > g2%kMin)
then
1036 if (g1%jMin < g2%jMin)
then
1039 else if (g1%jMin > g2%jMin)
then
1046 if (g1%iMin < g2%iMin)
then
1049 else if (g1%iMin > g2%iMin)
then
1080 if (g1%kMin < g2%kMin)
then
1083 else if (g1%kMin > g2%kMin)
then
1090 if (g1%jMin < g2%jMin)
then
1093 else if (g1%jMin > g2%jMin)
then
1100 if (g1%iMin < g2%iMin)
then
1103 else if (g1%iMin > g2%iMin)
then
1131 integer(kind=intType) :: i, nSubBlocks
1137 nsubblocks = splitinfo%nSubBlocks
1139 do i = 1, nsubblocks
1140 subranges(i)%iMin = splitinfo%ranges(i, 1, 1)
1141 subranges(i)%jMin = splitinfo%ranges(i, 2, 1)
1142 subranges(i)%kMin = splitinfo%ranges(i, 3, 1)
1144 subranges(i)%iMax = splitinfo%ranges(i, 1, 2)
1145 subranges(i)%jMax = splitinfo%ranges(i, 2, 2)
1146 subranges(i)%kMax = splitinfo%ranges(i, 3, 2)
1155 do i = 1, nsubblocks
1156 splitinfo%ranges(i, 1, 1) = subranges(i)%iMin
1157 splitinfo%ranges(i, 2, 1) = subranges(i)%jMin
1158 splitinfo%ranges(i, 3, 1) = subranges(i)%kMin
1160 splitinfo%ranges(i, 1, 2) = subranges(i)%iMax
1161 splitinfo%ranges(i, 2, 2) = subranges(i)%jMax
1162 splitinfo%ranges(i, 3, 2) = subranges(i)%kMax
1180 integer(kind=intType),
intent(in) :: nn
1186 integer(kind=intType),
parameter :: m = 7
1188 integer(kind=intType) :: nStack
1189 integer(kind=intType) :: i, j, k, r, l, jStack, ii
1195 integer(kind=intType),
allocatable,
dimension(:) :: stack
1196 integer(kind=intType),
allocatable,
dimension(:) :: tmpStack
1201 allocate (stack(nstack), stat=ierr)
1203 call terminate(
"qsortSortSubRangeType", &
1204 "Memory allocation failure for stack")
1218 if ((r - l) < m)
then
1224 do i = (j - 1), l, -1
1225 if (arr(i) <= a)
exit
1234 if (jstack == 0)
exit
1239 l = stack(jstack - 1)
1254 if (arr(r) < arr(l))
then
1260 if (arr(r) < arr(l + 1))
then
1266 if (arr(l + 1) < arr(l))
then
1285 if (a <= arr(i))
exit
1291 if (arr(j) <= a)
exit
1315 if (jstack > nstack)
then
1319 allocate (tmpstack(nstack), stat=ierr)
1321 call terminate(
"qsortSortSubRangeType", &
1322 "Memory allocation error for tmpStack")
1328 deallocate (stack, stat=ierr)
1330 call terminate(
"qsortSortSubRangeType", &
1331 "Deallocation error for stack")
1333 nstack = nstack + 100
1338 allocate (stack(nstack), stat=ierr)
1340 call terminate(
"qsortSortSubRangeType", &
1341 "Memory reallocation error for stack")
1342 stack(1:ii) = tmpstack(1:ii)
1346 deallocate (tmpstack, stat=ierr)
1348 call terminate(
"qsortSortSubRangeType", &
1349 "Deallocation error for tmpStack")
1352 if ((r - i + 1) >= (j - l))
then
1355 stack(jstack - 1) = j
1357 stack(jstack) = j - 1
1358 stack(jstack - 1) = l
1367 deallocate (stack, stat=ierr)
1369 call terminate(
"qsortSortSubRangeType", &
1370 "Deallocation error for stack")
1376 if (arr(i + 1) < arr(i)) &
1377 call terminate(
"qsortSortSubRangeType", &
1378 "Array is not sorted correctly")
1397 if (g1%n1 < g2%n1)
then
1400 else if (g1%n1 > g2%n1)
then
1407 if (g1%n2 < g2%n2)
then
1410 else if (g1%n2 > g2%n2)
then
1417 if (g1%n3 < g2%n3)
then
1420 else if (g1%n3 > g2%n3)
then
1427 if (g1%n4 < g2%n4)
then
1430 else if (g1%n4 > g2%n4)
then
1449 if (g1%n1 < g2%n1)
then
1452 else if (g1%n1 > g2%n1)
then
1459 if (g1%n2 < g2%n2)
then
1462 else if (g1%n2 > g2%n2)
then
1469 if (g1%n3 < g2%n3)
then
1472 else if (g1%n3 > g2%n3)
then
1479 if (g1%n4 < g2%n4)
then
1482 else if (g1%n4 > g2%n4)
then
1500 if (g1%n1 == g2%n1 .and. g1%n2 == g2%n2 .and. &
1501 g1%n3 == g2%n3 .and. g1%n4 == g2%n4) &
1518 integer(kind=intType),
intent(inout) :: nEntities
1519 integer(kind=intType),
dimension(4, *),
intent(inout) :: entities
1520 real(kind=realtype),
dimension(*),
intent(inout) :: dist
1522 logical,
intent(in) :: sortDist
1526 integer(kind=intType) :: nn, mm
1532 if (nentities == 0)
return
1537 do nn = 1, nentities
1538 tmp(nn)%n1 = entities(1, nn)
1539 tmp(nn)%n2 = entities(2, nn)
1540 tmp(nn)%n3 = entities(3, nn)
1541 tmp(nn)%n4 = entities(4, nn)
1543 tmp(nn)%dist = dist(nn)
1560 do nn = 2, nentities
1561 if (tmp(nn) /= tmp(mm))
then
1565 tmp(mm)%dist = max(tmp(mm)%dist, tmp(nn)%dist)
1574 do nn = 1, nentities
1575 entities(1, nn) = tmp(nn)%n1
1576 entities(2, nn) = tmp(nn)%n2
1577 entities(3, nn) = tmp(nn)%n3
1578 entities(4, nn) = tmp(nn)%n4
1579 if (sortdist) dist(nn) = tmp(nn)%dist
1598 integer(kind=intType),
intent(in) :: nn
1604 integer(kind=intType),
parameter :: m = 7
1606 integer(kind=intType) :: nStack
1607 integer(kind=intType) :: i, j, k, r, l, jStack, ii
1613 integer(kind=intType),
allocatable,
dimension(:) :: stack
1614 integer(kind=intType),
allocatable,
dimension(:) :: tmpStack
1619 allocate (stack(nstack), stat=ierr)
1621 call terminate(
"qsortFourIntPlusRealType", &
1622 "Memory allocation failure for stack")
1636 if ((r - l) < m)
then
1642 do i = (j - 1), l, -1
1643 if (arr(i) <= a)
exit
1652 if (jstack == 0)
exit
1657 l = stack(jstack - 1)
1672 if (arr(r) < arr(l))
then
1678 if (arr(r) < arr(l + 1))
then
1684 if (arr(l + 1) < arr(l))
then
1703 if (a <= arr(i))
exit
1709 if (arr(j) <= a)
exit
1733 if (jstack > nstack)
then
1737 allocate (tmpstack(nstack), stat=ierr)
1739 call terminate(
"qsortFourIntPlusRealType", &
1740 "Memory allocation error for tmpStack")
1746 deallocate (stack, stat=ierr)
1748 call terminate(
"qsortFourIntPlusRealType", &
1749 "Deallocation error for stack")
1751 nstack = nstack + 100
1756 allocate (stack(nstack), stat=ierr)
1758 call terminate(
"qsortFourIntPlusRealType", &
1759 "Memory reallocation error for stack")
1760 stack(1:ii) = tmpstack(1:ii)
1764 deallocate (tmpstack, stat=ierr)
1766 call terminate(
"qsortFourIntPlusRealType", &
1767 "Deallocation error for tmpStack")
1770 if ((r - i + 1) >= (j - l))
then
1773 stack(jstack - 1) = j
1775 stack(jstack) = j - 1
1776 stack(jstack - 1) = l
1785 deallocate (stack, stat=ierr)
1787 call terminate(
"qsortFourIntPlusRealType", &
1788 "Deallocation error for stack")
1794 if (arr(i + 1) < arr(i)) &
1795 call terminate(
"qsortFourIntPlusRealType", &
1796 "Array is not sorted correctly")
real(kind=realtype), parameter zero
integer(kind=inttype), parameter imax
integer(kind=inttype), parameter kmin
integer(kind=inttype), parameter jmax
integer(kind=inttype), parameter imin
integer(kind=inttype), parameter kmax
integer(kind=inttype), parameter jmin
integer(kind=inttype) ngridsread
logical function lessequalsubfacenonmatchtype(g1, g2)
subroutine qsortfourintplusrealtype(arr, nn)
subroutine sortrangessplitinfo(splitInfo)
logical function lessfourintplusrealtype(g1, g2)
logical function lessequalsubblocksofcgnstype(g1, g2)
logical function lesssubfacenonmatchtype(g1, g2)
subroutine qsortsubfacenonmatchtype(arr, nn)
character(len=maxstringlen), dimension(:), allocatable gridfiles
logical function notequalfourintplusrealtype(g1, g2)
logical function lessequalsortsubrangetype(g1, g2)
subroutine qsortsubblocksofcgnstype(arr, nn)
logical function lesssortsubrangetype(g1, g2)
integer(kind=inttype), dimension(:), allocatable part
integer, dimension(:), allocatable fileids
logical function lessequalfourintplusrealtype(g1, g2)
logical function lesssubblocksofcgnstype(g1, g2)
integer(kind=inttype) nblocks
subroutine qsortsortsubrangetype(arr, nn)
subroutine sortbadentities(nEntities, entities, dist, sortDist)
type(distributionblocktype), dimension(:), allocatable blocks
subroutine terminate(routineName, errorMessage)