62 CHARACTER(CHRLEN),
PRIVATE :: &
63 RCSIdentString =
'$RCSfile: RFLU_ModGeometryTools.F90,v $ $Revision: 1.5 $'
107 distout,ipatchout,ifgout)
121 INTEGER,
INTENT(IN) :: icg
122 INTEGER,
INTENT(OUT) :: ifgout,ipatchout
123 REAL(RFREAL),
INTENT(IN) :: ex,ey,ez
124 REAL(RFREAL),
INTENT(INOUT) :: xloc,yloc,zloc
125 REAL(RFREAL),
INTENT(OUT) :: distout
126 TYPE(t_region
),
POINTER :: pregion
132 INTEGER :: c1,c2,icl,ict,ifl,iflout,ifg,ipatch,
nfaces,nxsect
133 INTEGER,
DIMENSION(:,:),
POINTER :: pc2f
134 REAL(RFREAL) ::
denom,
dist,fnx,fny,fnz,numer,toler,xcofg,ycofg,zcofg
135 REAL(RFREAL),
DIMENSION(2) :: xsd
137 TYPE(t_grid),
POINTER :: pgrid
138 TYPE(t_patch),
POINTER :: ppatch
144 global => pregion%global
147 'RFLU_ModGeometryTools.F90')
153 pgrid => pregion%grid
155 toler = -pregion%mixtInput%tolerICT
157 distout = huge(1.0_rfreal)
158 iflout = crazy_value_int
164 ict = pgrid%cellGlob2Loc(1,icg)
165 icl = pgrid%cellGlob2Loc(2,icg)
168 CASE ( cell_type_tet )
169 pc2f => pgrid%tet2f(:,:,icl)
170 CASE ( cell_type_hex )
171 pc2f => pgrid%hex2f(:,:,icl)
172 CASE ( cell_type_pri )
173 pc2f => pgrid%pri2f(:,:,icl)
174 CASE ( cell_type_pyr )
175 pc2f => pgrid%pyr2f(:,:,icl)
177 CALL
errorstop(global,err_reached_default,__line__)
194 IF ( ipatch == 0 )
THEN
203 c1 = pgrid%f2c(1,ifg)
204 c2 = pgrid%f2c(2,ifg)
206 IF ( c1 == icg )
THEN
207 fnx = pgrid%fn(xcoord,ifg)
208 fny = pgrid%fn(ycoord,ifg)
209 fnz = pgrid%fn(zcoord,ifg)
210 ELSE IF ( c2 == icg )
THEN
211 fnx = -pgrid%fn(xcoord,ifg)
212 fny = -pgrid%fn(ycoord,ifg)
213 fnz = -pgrid%fn(zcoord,ifg)
215 CALL
errorstop(global,err_reached_default,__line__)
218 denom = ex*fnx + ey*fny + ez*fnz
220 IF (
denom > 0.0_rfreal )
THEN
221 xcofg = pgrid%fc(xcoord,ifg)
222 ycofg = pgrid%fc(ycoord,ifg)
223 zcofg = pgrid%fc(zcoord,ifg)
225 numer = (xcofg-xloc)*fnx + (ycofg-yloc)*fny + (zcofg-zloc)*fnz
226 numer =
max(numer,0.0_rfreal)
230 IF (
dist < distout )
THEN
260 ELSE IF ( ipatch > 0 )
THEN
261 ppatch => pregion%patches(ipatch)
270 fnx = ppatch%fn(xcoord,ifg)
271 fny = ppatch%fn(ycoord,ifg)
272 fnz = ppatch%fn(zcoord,ifg)
274 denom = ex*fnx + ey*fny + ez*fnz
276 IF (
denom > 0.0_rfreal )
THEN
277 xcofg = ppatch%fc(xcoord,ifg)
278 ycofg = ppatch%fc(ycoord,ifg)
279 zcofg = ppatch%fc(zcoord,ifg)
281 numer = (xcofg-xloc)*fnx + (ycofg-yloc)*fny + (zcofg-zloc)*fnz
282 numer =
max(numer,0.0_rfreal)
286 IF (
dist < distout )
THEN
317 CALL
errorstop(global,err_reached_default,__line__)
325 ipatchout = pc2f(1,iflout)
326 ifgout = pc2f(2,iflout)
328 xloc = xloc + distout*ex
329 yloc = yloc + distout*ey
330 zloc = zloc + distout*ez
379 distout,ipatchout,ifgout)
393 INTEGER,
INTENT(IN) :: icg
394 INTEGER,
INTENT(OUT) :: ifgout,ipatchout
395 REAL(RFREAL),
INTENT(IN) :: ex,ey,ez
396 REAL(RFREAL),
INTENT(INOUT) :: xloc,yloc,zloc
397 REAL(RFREAL),
INTENT(OUT) :: distout
398 TYPE(t_region
),
POINTER :: pregion
404 INTEGER :: c1,c2,errorflag,icl,ict,ifl,iflout,iflout1,iflout2,ifg,ipatch, &
406 INTEGER,
DIMENSION(:,:),
POINTER :: pc2f
407 REAL(RFREAL) :: distout1,distout2,fnx,fny,fnz,toler,xcofg,ycofg,zcofg
408 REAL(RFREAL),
DIMENSION(2) :: xsd
409 REAL(RFREAL),
DIMENSION(6) ::
denom,numer
411 TYPE(t_grid),
POINTER :: pgrid
412 TYPE(t_patch),
POINTER :: ppatch
418 global => pregion%global
421 'RFLU_ModGeometryTools.F90')
427 pgrid => pregion%grid
429 toler = -pregion%mixtInput%tolerICT
435 ict = pgrid%cellGlob2Loc(1,icg)
436 icl = pgrid%cellGlob2Loc(2,icg)
439 CASE ( cell_type_tet )
440 pc2f => pgrid%tet2f(:,:,icl)
441 CASE ( cell_type_hex )
442 pc2f => pgrid%hex2f(:,:,icl)
443 CASE ( cell_type_pri )
444 pc2f => pgrid%pri2f(:,:,icl)
445 CASE ( cell_type_pyr )
446 pc2f => pgrid%pyr2f(:,:,icl)
448 CALL
errorstop(global,err_reached_default,__line__)
479 IF ( ipatch == 0 )
THEN
488 c1 = pgrid%f2c(1,ifg)
489 c2 = pgrid%f2c(2,ifg)
491 IF ( c1 == icg )
THEN
492 fnx = pgrid%fn(xcoord,ifg)
493 fny = pgrid%fn(ycoord,ifg)
494 fnz = pgrid%fn(zcoord,ifg)
495 ELSE IF ( c2 == icg )
THEN
496 fnx = -pgrid%fn(xcoord,ifg)
497 fny = -pgrid%fn(ycoord,ifg)
498 fnz = -pgrid%fn(zcoord,ifg)
500 CALL
errorstop(global,err_reached_default,__line__)
503 xcofg = pgrid%fc(xcoord,ifg)
504 ycofg = pgrid%fc(ycoord,ifg)
505 zcofg = pgrid%fc(zcoord,ifg)
507 numer(ifl) = (xcofg-xloc)*fnx + (ycofg-yloc)*fny + (zcofg-zloc)*fnz
508 denom(ifl) = ex*fnx + ey*fny + ez*fnz
537 ELSE IF ( ipatch > 0 )
THEN
538 ppatch => pregion%patches(ipatch)
545 fnx = ppatch%fn(xcoord,ifg)
546 fny = ppatch%fn(ycoord,ifg)
547 fnz = ppatch%fn(zcoord,ifg)
549 xcofg = ppatch%fc(xcoord,ifg)
550 ycofg = ppatch%fc(ycoord,ifg)
551 zcofg = ppatch%fc(zcoord,ifg)
553 numer(ifl) = (xcofg-xloc)*fnx + (ycofg-yloc)*fny + (zcofg-zloc)*fnz
554 denom(ifl) = ex*fnx + ey*fny + ez*fnz
575 CALL
errorstop(global,err_reached_default,__line__)
585 distout1 = huge(1.0_rfreal)
586 distout2 = huge(1.0_rfreal)
588 iflout1 = crazy_value_int
589 iflout2 = crazy_value_int
591 faceloop:
DO ifl = 1,
nfaces
592 IF ( numer(ifl) > toler )
THEN
593 IF (
denom(ifl) > 0.0 )
THEN
594 distout =
max(numer(ifl),0.0_rfreal)/
denom(ifl)
596 IF ( distout < distout1 )
THEN
602 ELSE IF ( distout < distout2 )
THEN
616 IF ( errorflag == err_none )
THEN
625 ipatchout = pc2f(1,iflout)
626 ifgout = pc2f(2,iflout)
628 xloc = xloc + distout*ex
629 yloc = yloc + distout*ey
630 zloc = zloc + distout*ez
686 'RFLU_ModGeometryTools.F90')
694 IF ( (xloc <
xmin) .OR. (xloc >
xmax) )
THEN
700 IF ( (yloc <
ymin) .OR. (yloc >
ymax) )
THEN
706 IF ( (zloc <
zmin) .OR. (zloc >
zmax) )
THEN
758 INTEGER,
INTENT(IN) ::
dir
759 REAL(RFREAL),
INTENT(INOUT) :: dr(xcoord:zcoord)
766 REAL(RFREAL) :: drsum,drtol
773 'RFLU_ModGeometryTools.F90')
779 drtol = 1.0e-12_rfreal
789 drsum = abs(dr(xcoord)) + abs(dr(ycoord)) + abs(dr(zcoord))
791 IF ( drsum <= drtol )
THEN
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
subroutine registerfunction(global, funName, fileName)
subroutine, public rflu_blin_computexsectline(pRegion, xLoc, yLoc, zLoc, ex, ey, ez, icg, iPatch, ifg, nt, t)
subroutine errorstop(global, errorCode, errorLine, addMessage)
long double dist(long double *coord1, long double *coord2, int size)
subroutine deregisterfunction(global)
CGAL_BEGIN_NAMESPACE void const NT NT NT NT & denom