18 integer(kind=intType) :: i, jj, k, iElem, maxLevels, nNeighbours, nOtherElem, iOther, otherElem
19 integer(kind=intType) :: nInterpol, elemID, intInfo(3), factor, jelem, otherElems(4)
20 real(kind=realtype) :: uvw(5), xx(4), dist, q1(3, 4), q2(3, 4), delta, radius1, radius2
23 integer(kind=intType),
dimension(:),
pointer :: frontLeaves
24 integer(kind=intType),
dimension(:),
pointer :: frontLeavesNew
26 real(kind=realtype),
dimension(3, 2) :: dummy
27 integer(kind=intType),
dimension(:),
allocatable :: tmpCellArr
28 integer(kind=intType),
dimension(:),
allocatable :: tmpNodeElem
29 integer(kind=intType),
dimension(:),
allocatable :: mask
34 if (asurf%nCells == 0 .or. bsurf%nCells == 0)
then
47 if (bsurf%cluster < asurf%cluster)
then
54 allocate (bb(10), frontleaves(25), frontleavesnew(25),
stack(100))
66 allocate (tmpcellarr(3 * 3), mask(asurf%nCells), tmpnodeelem(bsurf%nNodes))
69 adtree => asurf%ADT%ADTree
71 do i = 1, bsurf%nNodes
73 xx(1:3) = bsurf%x(:, i)
92 dummy, ninterpol, bb, frontleaves, frontleavesnew)
94 tmpnodeelem(i) = elemid
99 cellloop:
do i = 1, bsurf%nCells
106 otherelem = tmpnodeelem(bsurf%conn(jj, i))
107 if (otherelem /= 0)
then
108 notherelem = notherelem + 1
109 otherelems(notherelem) = otherelem
115 q1(:, jj) = bsurf%x(:, bsurf%conn(jj, i))
118 do iother = 1, notherelem
120 elemid = otherelems(iother)
124 q2(:, jj) = asurf%x(:, asurf%conn(jj, elemid))
132 bsurf%iBlank(bsurf%cellPtr(i)) = -2
144 factor = int(radius1 / radius2) + 2
146 if (factor > maxlevels)
then
147 deallocate (tmpcellarr)
149 allocate (tmpcellarr((1 + 2 * maxlevels)**2))
162 do ielem = 1, nneighbours
163 elemid = tmpcellarr(ielem)
170 q2(:, jj) = asurf%x(:, asurf%conn(jj, elemid))
177 bsurf%iBlank(bsurf%cellPtr(i)) = -2
183 do jelem = ielem + 1, nneighbours
184 mask(tmpcellarr(jelem)) = 0
194 deallocate (bb, frontleaves, frontleavesnew,
stack, tmpcellarr, mask)
210 integer(kind=intType),
intent(inout),
dimension(:) :: mask, elemlist
211 integer(kind=intType),
intent(in) :: baseelemid, layers
212 integer(kind=intType),
intent(inout) :: nelemfound
215 integer(kind=intType) :: i, inode, icell, curelem
218 if (layers == 0)
then
224 inode = asurf%conn(i, baseelemid)
229 curelem = asurf%nte(icell, inode)
230 if (curelem /= 0)
then
233 if (mask(curelem) /= baseelemid .and. mask(curelem) == 0)
then
237 nelemfound = nelemfound + 1
238 elemlist(nelemfound) = curelem
259 real(kind=realtype),
dimension(3, 4),
intent(in) :: q1, q2
260 logical,
intent(out) :: overlapped
263 integer(kind=intType) :: ii, jj
264 real(kind=realtype),
dimension(2, 4) :: qq1, qq2
265 real(kind=realtype),
dimension(3) :: axis1, axis2, n1, n2, normal, v1, v2, c1, c2
266 real(kind=realtype) :: e1, e2
271 c1 = c1 +
fourth * q1(:, ii)
272 c2 = c2 +
fourth * q2(:, ii)
279 e1 = max(e1,
mynorm2(c1 - q1(:, ii)))
280 e2 = max(e2,
mynorm2(c2 - q2(:, ii)))
284 if (
mynorm2(c1 - c2) .ge. (e1 + e2))
then
292 v1 = q1(:, 3) - q1(:, 1)
293 v2 = q1(:, 4) - q1(:, 2)
298 v1 = q2(:, 3) - q2(:, 1)
299 v2 = q2(:, 4) - q2(:, 2)
305 if (dot_product(n1, n2) <
zero)
then
313 axis1 = q1(:, 2) - q1(:, 1)
316 axis1 = q2(:, 2) - q2(:, 1)
320 axis1 = axis1 - dot_product(axis1, normal) * normal
328 qq1(1, jj) = dot_product(axis1, q1(:, jj))
329 qq1(2, jj) = dot_product(axis2, q1(:, jj))
331 qq2(1, jj) = dot_product(axis1, q2(:, jj))
332 qq2(2, jj) = dot_product(axis2, q2(:, jj))
351 real(kind=realtype),
dimension(2, 4),
intent(in) :: q1, q2
352 logical,
intent(out) :: overlapped
355 real(kind=realtype),
dimension(4) :: tmp1, tmp2
356 integer(kind=intType) :: ii, jj, kk, jjp1
357 real(kind=realtype),
dimension(2) :: axis, p0
358 real(kind=realtype) :: min1, max1, min2, max2
362 quadloop:
do ii = 1, 2
363 edgeloop:
do jj = 1, 4
364 jjp1 = mod(jj, 4) + 1
367 axis = q1(:, jjp1) - q1(:, jj)
370 axis = q2(:, jjp1) - q2(:, jj)
375 axis = (/axis(2), -axis(1)/)
379 tmp1(kk) = dot_product(axis, q1(:, kk) - p0)
380 tmp2(kk) = dot_product(axis, q2(:, kk) - p0)
389 if (max1 < min2 .or. max2 < min1)
then
405 real(kind=realtype),
dimension(3, 4) :: q
409 real(kind=realtype) :: c(3)
410 integer(kind=intType) :: ii
subroutine mindistancetreesearchsinglepoint(ADT, coor, intInfo, uvw, arrDonor, nInterpol, BB, frontLeaves, frontLeavesNew)
integer(kind=inttype), dimension(:), pointer stack
real(kind=realtype), parameter zero
real(kind=realtype), parameter fourth
real(kind=realtype), parameter large
real(kind=realtype), dimension(:), allocatable clusterareas
subroutine cross_prod(a, b, c)
real(kind=realtype) function mynorm2(x)
subroutine wallsearch(aSurf, bSurf)
recursive subroutine getneighbourcells(aSurf, mask, baseElemID, layers, elemList, nElemFound)
subroutine quadoverlap(q1, q2, overlapped)
subroutine quadoverlap2d(q1, q2, overlapped)
real(kind=realtype) function getcellradius(q)