Determines whether face sSmall of the small element coincides with half h of face sBig of the big element, split along big-face trace coordinate split (1 or 2), under the given flip: face_small(F_flip(u,v)) == face_big(half_h(u,v)) at the sampled points.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=prec), | intent(in) | :: | coordsBig(1:3,1:2,1:2,1:2) | |||
| integer, | intent(in) | :: | sBig | |||
| integer, | intent(in) | :: | h | |||
| integer, | intent(in) | :: | split | |||
| real(kind=prec), | intent(in) | :: | coordsSmall(1:3,1:2,1:2,1:2) | |||
| integer, | intent(in) | :: | sSmall | |||
| integer, | intent(in) | :: | flip | |||
| real(kind=prec), | intent(in) | :: | tol |
function HalfMatches3D(coordsBig,sBig,h,split,coordsSmall,sSmall,flip,tol) result(matched)
!! Determines whether face sSmall of the small element coincides with half h of
!! face sBig of the big element, split along big-face trace coordinate split (1 or
!! 2), under the given flip: face_small(F_flip(u,v)) == face_big(half_h(u,v)) at
!! the sampled points.
implicit none
real(prec),intent(in) :: coordsBig(1:3,1:2,1:2,1:2)
integer,intent(in) :: sBig,h,split
real(prec),intent(in) :: coordsSmall(1:3,1:2,1:2,1:2)
integer,intent(in) :: sSmall,flip
real(prec),intent(in) :: tol
logical :: matched
! Local
real(prec),parameter :: us(1:5) = [-1.0_prec,1.0_prec,-1.0_prec,1.0_prec,0.25_prec]
real(prec),parameter :: vs(1:5) = [-1.0_prec,-1.0_prec,1.0_prec,1.0_prec,-0.5_prec]
real(prec) :: pBig(1:3),pSmall(1:3)
real(prec) :: uh,vh,u2,v2
integer :: n
matched = .true.
do n = 1,5
! Big-face coordinates of the half's point
uh = us(n)
vh = vs(n)
if(split == 1) then
uh = 0.5_prec*(us(n)+real(2*h-3,prec))
else
vh = 0.5_prec*(vs(n)+real(2*h-3,prec))
endif
pBig = BilinearFacePoint3D(coordsBig,sBig,uh,vh)
call FlipFaceCoords3D(us(n),vs(n),flip,u2,v2)
pSmall = BilinearFacePoint3D(coordsSmall,sSmall,u2,v2)
if(maxval(abs(pBig-pSmall)) > tol) then
matched = .false.
return
endif
enddo
endfunction HalfMatches3D