70 INTEGER,
PARAMETER :: MTEST = 5000, &
73 INTEGER :: MOCTR,NNODE
75 INTEGER,
DIMENSION(:),
ALLOCATABLE :: ICHK,NLINK
76 INTEGER,
DIMENSION(:,:),
ALLOCATABLE :: NOCTR
78 REAL(RFREAL) :: DISMIN
79 REAL(RFREAL),
DIMENSION(2) :: XFAR,YFAR,ZFAR
80 REAL(RFREAL),
DIMENSION(:),
ALLOCATABLE :: X,Y,Z
96 INTEGER,
INTENT(IN) :: npoints
102 'RFLU_ModOctree.F90')
107 ALLOCATE(ichk(nnode),stat=errorflag)
108 global%error = errorflag
109 IF ( global%error /= err_none )
THEN
110 CALL
errorstop(global,err_allocate,__line__,
'ICHK')
113 ALLOCATE(nlink(nnode),stat=errorflag)
114 global%error = errorflag
115 IF ( global%error /= err_none )
THEN
116 CALL
errorstop(global,err_allocate,__line__,
'NLINK')
119 ALLOCATE(noctr(2,moctr),stat=errorflag)
120 global%error = errorflag
121 IF ( global%error /= err_none )
THEN
122 CALL
errorstop(global,err_allocate,__line__,
'NOCTR')
125 ALLOCATE(x(nnode),stat=errorflag)
126 global%error = errorflag
127 IF ( global%error /= err_none )
THEN
128 CALL
errorstop(global,err_allocate,__line__,
'X')
131 ALLOCATE(y(nnode),stat=errorflag)
132 global%error = errorflag
133 IF ( global%error /= err_none )
THEN
134 CALL
errorstop(global,err_allocate,__line__,
'Y')
137 ALLOCATE(z(nnode),stat=errorflag)
138 global%error = errorflag
139 IF ( global%error /= err_none )
THEN
140 CALL
errorstop(global,err_allocate,__line__,
'Z')
172 REAL(RFREAL),
INTENT(IN) :: xlow,xupp,ylow,yupp,zlow,zupp
173 REAL(RFREAL),
INTENT(IN) :: xi(nnode),yi(nnode),zi(nnode)
234 INTEGER ::
i,ioctr,iroot,
j,
k,l,ltest,
n,
next,ntest,nxsgn,nysgn,nzsgn
235 INTEGER :: jj(8),nstore(8)
236 REAL(RFREAL) :: tol, &
237 xhalf,xhigh,xlow,xshift,xsize,xsgn, &
238 yhalf,yhigh,ylow,yshift,ysize,ysgn, &
239 zhalf,zhigh,zlow,zshift,zsize,zsgn
240 REAL(RFREAL) :: xroot(2),yroot(2),zroot(2)
244 tol = 1.000001_rfreal
258 IF (noctr(1,
i).LT.0) go to 80
263 IF (
next.NE.0) go to 6
278 20 ntest = nlink(
next)
279 IF (ntest.EQ.0) go to 25
290 IF (ioctr.GT.moctr) go to 210
292 35 noctr(1,ioctr) = 0
303 xshift = x(
j) -.5_rfreal*(xlow +xhigh)
304 xsize =
max(1.e-9_rfreal,abs(xshift))
305 nxsgn = (int(tol*xshift/xsize) +1)/2*2
306 yshift = y(
j) -.5_rfreal*(ylow +yhigh)
307 ysize =
max(1.e-9_rfreal,abs(yshift))
308 nysgn = (int(tol*yshift/ysize) +1)/2*2
309 zshift = z(
j) -.5_rfreal*(zlow +zhigh)
310 zsize =
max(1.e-9_rfreal,abs(zshift))
311 nzsgn = (int(tol*zshift/zsize) +1)/2*2
312 l = 1 +nxsgn/2 +nysgn +2*nzsgn
315 IF (jj(l).GT.1) go to 41
316 noctr(1,ioctr-8+l) =
j
318 41
next = noctr(1,ioctr-8+l)
319 42 ntest = nlink(
next)
320 IF (ntest.EQ.0) go to 43
328 noctr(1,
i) = 7 -ioctr
331 IF (jj(l).EQ.8) ltest = l
333 IF (ltest.EQ.0) go to 70
335 xhalf = .5_rfreal*(xlow +xhigh)
337 xlow = xsgn*xlow +(1._rfreal -xsgn)*xhalf
338 xhigh = xsgn*xhalf +(1._rfreal -xsgn)*xhigh
339 yhalf = .5_rfreal*(ylow +yhigh)
340 ysgn = isign(1,2*mod(ltest-1,4)-3)
341 ylow = .5_rfreal*((1._rfreal-ysgn)*ylow +(1._rfreal+ysgn)*yhalf)
342 yhigh = .5_rfreal*((1._rfreal-ysgn)*yhalf+(1._rfreal+ysgn)*yhigh)
343 zhalf = .5_rfreal*(zlow +zhigh)
344 zsgn = isign(1,2*ltest-9)
345 zlow = .5_rfreal*((1._rfreal-zsgn)*zlow +(1._rfreal+zsgn)*zhalf)
346 zhigh = .5_rfreal*((1._rfreal-zsgn)*zhalf+(1._rfreal+zsgn)*zhigh)
358 80 xhalf = .5_rfreal*(xlow +xhigh)
359 yhalf = .5_rfreal*(ylow +yhigh)
360 zhalf = .5_rfreal*(zlow +zhigh)
362 xsize =
max(1.e-9_rfreal,abs(xshift))
363 nxsgn = (int(tol*xshift/xsize) +1)/2*2
365 ysize =
max(1.e-9_rfreal,abs(yshift))
366 nysgn = (int(tol*yshift/ysize) +1)/2*2
368 zsize =
max(1.e-9_rfreal,abs(zshift))
369 nzsgn = (int(tol*zshift/zsize) +1)/2*2
370 l = 1 +nxsgn/2 +nysgn +2*nzsgn
371 i = -noctr(1,
i) +l -1
373 xlow = xsgn*xlow +(1._rfreal -xsgn)*xhalf
374 xhigh = xsgn*xhalf +(1._rfreal -xsgn)*xhigh
375 ysgn = isign(1,2*mod(l-1,4)-3)
376 ylow = .5_rfreal*((1._rfreal-ysgn)*ylow +(1._rfreal+ysgn)*yhalf)
377 yhigh = .5_rfreal*((1._rfreal-ysgn)*yhalf+(1._rfreal+ysgn)*yhigh)
378 zsgn = isign(1,2*l-9)
379 zlow = .5_rfreal*((1._rfreal-zsgn)*zlow +(1._rfreal+zsgn)*zhalf)
380 zhigh = .5_rfreal*((1._rfreal-zsgn)*zhalf+(1._rfreal+zsgn)*zhigh)
381 IF (noctr(1,
i).LT.0) go to 80
383 IF (noctr(1,
i).EQ.0) go to 10
387 IF (
next.NE.0) go to 85
395 610
FORMAT(5x,
'DIMENSION OF NOCTR ARRAY EXCEEDED IN ROUTINE OCTREE.'/ &
396 5x,
'INCREASE SIZE OF MOCTR')
425 INTEGER,
INTENT(IN) :: nump
426 INTEGER,
INTENT(INOUT) :: neighp(nump)
427 REAL(RFREAL),
INTENT(IN) :: xpt,ypt,zpt
431 INTEGER ::
i,
ic,iflag,ii,itry,istart,
j,jj,
k,
kc,l,lflag,
m, &
433 INTEGER :: nsrch(mtest),ksrch(mtest)
434 REAL(RFREAL) ::
dist,dmin,tol,tolpt, &
435 xhalf,xhigh,xhigh0,xl,xlow,xlow0,xshift,xsgn,xsize,xu, &
436 yhalf,yhigh,yhigh0,yl,ylow,ylow0,yshift,ysgn,ysize,yu, &
437 zhalf,zhigh,zhigh0,zl,zlow,zlow0,zshift,zsgn,zsize,zu
438 REAL(RFREAL) :: xoctr(2,mtest),yoctr(2,mtest),zoctr(2,mtest), &
439 xhold(2,mtest),yhold(2,mtest),zhold(2,mtest), &
440 xkeep(2),ykeep(2),zkeep(2)
445 tol = 1.000001_rfreal
446 IF (xpt.LT.xfar(1)-tolpt.OR.xpt.GT.xfar(2)+tolpt) go to 200
447 IF (ypt.LT.yfar(1)-tolpt.OR.ypt.GT.yfar(2)+tolpt) go to 200
448 IF (zpt.LT.zfar(1)-tolpt.OR.zpt.GT.zfar(2)+tolpt) go to 200
467 IF (noctr(1,
i).GT.0) go to 50
471 20 xhalf = .5_rfreal*(xlow +xhigh)
472 yhalf = .5_rfreal*(ylow +yhigh)
473 zhalf = .5_rfreal*(zlow +zhigh)
475 xsize =
max(1.e-9_rfreal,abs(xshift))
476 nxsgn = (int(tol*xshift/xsize) +1)/2*2
478 ysize =
max(1.e-9_rfreal,abs(yshift))
479 nysgn = (int(tol*yshift/ysize) +1)/2*2
481 zsize =
max(1.e-9_rfreal,abs(zshift))
482 nzsgn = (int(tol*zshift/zsize) +1)/2*2
483 l = 1 +nxsgn/2 +nysgn +2*nzsgn
484 i = -noctr(1,
i) +l -1
486 xlow = xsgn*xlow +(1. -xsgn)*xhalf
487 xhigh = xsgn*xhalf +(1. -xsgn)*xhigh
488 ysgn = isign(1,2*mod(l-1,4)-3)
489 ylow = .5_rfreal*((1._rfreal-ysgn)*ylow +(1._rfreal+ysgn)*yhalf)
490 yhigh = .5_rfreal*((1._rfreal-ysgn)*yhalf+(1._rfreal+ysgn)*yhigh)
491 zsgn = isign(1,2*l-9)
492 zlow = .5_rfreal*((1._rfreal-zsgn)*zlow +(1._rfreal+zsgn)*zhalf)
493 zhigh = .5_rfreal*((1._rfreal-zsgn)*zhalf+(1._rfreal+zsgn)*zhigh)
494 IF (noctr(1,
i).LT.0) go to 20
507 dismin = (xfar(2) -xfar(1))**2 +(yfar(2) -yfar(1))**2 &
508 +(zfar(2) -zfar(1))**2
516 IF (noctr(1,
i).EQ.0) go to 65
518 60
dist = (xpt -x(
j))**2 +(ypt -y(
j))**2 &
520 IF (
dist.LT.dismin.AND.ichk(
j).EQ.0)
THEN
526 65 dmin =
sqrt(dismin)
533 70
IF (xl.GT.xlow.AND.xu.LT.xhigh.AND. &
534 yl.GT.ylow.AND.yu.LT.yhigh.AND. &
535 zl.GT.zlow.AND.zu.LT.zhigh)
THEN
559 lflag = iflag +noctr(1,
i) +1
561 xoctr(1,1) = (2._rfreal -xsgn)*xlow -(1._rfreal -xsgn)*xhigh
562 xoctr(2,1) = (1._rfreal +xsgn)*xhigh -xsgn*xlow
563 ysgn = isign(1,2*mod(lflag-1,4)-3)
564 yoctr(1,1) = .5_rfreal*((3._rfreal+ysgn)*ylow -(1._rfreal+ysgn)*yhigh)
565 yoctr(2,1) = .5_rfreal*((3._rfreal-ysgn)*yhigh -(1._rfreal-ysgn)*ylow)
566 zsgn = isign(1,2*lflag-9)
567 zoctr(1,1) = .5_rfreal*((3._rfreal+zsgn)*zlow -(1._rfreal+zsgn)*zhigh)
568 zoctr(2,1) = .5_rfreal*((3._rfreal-zsgn)*zhigh -(1._rfreal-zsgn)*zlow)
569 xkeep(1) = xoctr(1,1)
570 xkeep(2) = xoctr(2,1)
571 ykeep(1) = yoctr(1,1)
572 ykeep(2) = yoctr(2,1)
573 zkeep(1) = zoctr(1,1)
574 zkeep(2) = zoctr(2,1)
584 itry = -noctr(1,ii) +
k -1
585 IF (itry.EQ.iflag) go to 90
586 xhalf = .5_rfreal*(xoctr(1,
j) +xoctr(2,
j))
588 xlow = xsgn*xoctr(1,
j) +(1._rfreal -xsgn)*xhalf
589 xhigh = xsgn*xhalf +(1._rfreal -xsgn)*xoctr(2,
j)
590 yhalf = .5_rfreal*(yoctr(1,
j) +yoctr(2,
j))
591 ysgn = isign(1,2*mod(
k-1,4)-3)
592 ylow = .5_rfreal*((1._rfreal-ysgn)*yoctr(1,
j) +(1._rfreal+ysgn)*yhalf)
593 yhigh = .5_rfreal*((1._rfreal-ysgn)*yhalf +(1._rfreal+ysgn)*yoctr(2,
j))
594 zhalf = .5_rfreal*(zoctr(1,
j) +zoctr(2,
j))
595 zsgn = isign(1,2*
k-9)
596 zlow = .5_rfreal*((1._rfreal-zsgn)*zoctr(1,
j)+(1._rfreal+zsgn)*zhalf)
597 zhigh = .5_rfreal*((1._rfreal-zsgn)*zhalf +(1._rfreal+zsgn)*zoctr(2,
j))
598 IF (xl.GT.xhigh.OR.xu.LT.xlow.OR. &
599 yl.GT.yhigh.OR.yu.LT.ylow.OR. &
600 zl.GT.zhigh.OR.zu.LT.zlow) go to 90
601 IF (noctr(1,itry).GE.0) go to 80
603 IF (
ic.GT.mtest) go to 210
612 80
IF (noctr(1,itry).EQ.0) go to 90
614 85
dist = (xpt -x(jj))**2 +(ypt -y(jj))**2 &
616 IF (
dist.LT.dismin.AND.ichk(jj).EQ.0)
THEN
621 IF (jj.NE.0) go to 85
642 xoctr(1,
j) = xhold(1,
j)
643 xoctr(2,
j) = xhold(2,
j)
644 yoctr(1,
j) = yhold(1,
j)
645 yoctr(2,
j) = yhold(2,
j)
646 zoctr(1,
j) = zhold(1,
j)
647 zoctr(2,
j) = zhold(2,
j)
650 200
WRITE (6,600) xpt,ypt,zpt
655 600
FORMAT(5x,
'POINT XPT = ',f12.4,
' YPT = ',f12.4,
' ZPT = ',f12.4/ &
656 5x,
'LIES OUTSIDE CONVEX HULL'/ &
657 5x,
'PROGRAM STOPPED IN ROUTINE OCT_SEARCH')
658 610
FORMAT(5x,
'DIMENSION OF NSRCH AND KSRCH ARRAYS EXCEEDED'/ &
659 5x,
'IN ROUTINE OCT_SEARCH. INCREASE SIZE OF MTEST')
677 'RFLU_ModOctree.F90')
679 DEALLOCATE(ichk,stat=errorflag)
680 global%error = errorflag
681 IF ( global%error /= err_none )
THEN
682 CALL
errorstop(global,err_deallocate,__line__,
'ICHK')
685 DEALLOCATE(nlink,stat=errorflag)
686 global%error = errorflag
687 IF ( global%error /= err_none )
THEN
688 CALL
errorstop(global,err_deallocate,__line__,
'NLINK')
691 DEALLOCATE(noctr,stat=errorflag)
692 global%error = errorflag
693 IF ( global%error /= err_none )
THEN
694 CALL
errorstop(global,err_deallocate,__line__,
'NOCTR')
697 DEALLOCATE(x,stat=errorflag)
698 global%error = errorflag
699 IF ( global%error /= err_none )
THEN
700 CALL
errorstop(global,err_deallocate,__line__,
'X')
703 DEALLOCATE(y,stat=errorflag)
704 global%error = errorflag
705 IF ( global%error /= err_none )
THEN
706 CALL
errorstop(global,err_deallocate,__line__,
'Y')
709 DEALLOCATE(z,stat=errorflag)
710 global%error = errorflag
711 IF ( global%error /= err_none )
THEN
712 CALL
errorstop(global,err_deallocate,__line__,
'Z')
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE kc
subroutine, public rflu_queryoctree(XPT, YPT, ZPT, NUMP, NEIGHP)
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
subroutine registerfunction(global, funName, fileName)
**********************************************************************Rocstar Simulation Suite Illinois Rocstar LLC All rights reserved ****Illinois Rocstar LLC IL **www illinoisrocstar com **sales illinoisrocstar com WITHOUT WARRANTY OF ANY **EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES **OF FITNESS FOR A PARTICULAR PURPOSE AND **NONINFRINGEMENT IN NO EVENT SHALL THE CONTRIBUTORS OR **COPYRIGHT HOLDERS BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN AN ACTION OF TORT OR **Arising OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE **USE OR OTHER DEALINGS WITH THE SOFTWARE **********************************************************************INTERFACE SUBROUTINE ic
subroutine, public rflu_buildoctree(XI, YI, ZI, XLOW, XUPP, YLOW, YUPP, ZLOW, ZUPP)
subroutine, public rflu_destroyoctree(global)
subroutine errorstop(global, errorCode, errorLine, addMessage)
void next()
Go to the next element within the connectivity tables of a pane.
long double dist(long double *coord1, long double *coord2, int size)
subroutine deregisterfunction(global)
subroutine, public rflu_createoctree(global, nPoints)