MatchFaces3D Subroutine

public subroutine MatchFaces3D(coordsA, sA, coordsB, sB, tol, matched, flip)

Determines whether face sA of element A coincides with face sB of element B, and if so with which flip: face_B(F_flip(u,v)) == face_A(u,v) at the sampled points. Bilinear faces are pinned by their four corners plus one interior point.

Arguments

TypeIntentOptionalAttributesName
real(kind=prec), intent(in) :: coordsA(1:3,1:2,1:2,1:2)
integer, intent(in) :: sA
real(kind=prec), intent(in) :: coordsB(1:3,1:2,1:2,1:2)
integer, intent(in) :: sB
real(kind=prec), intent(in) :: tol
logical, intent(out) :: matched
integer, intent(out) :: flip

Calls

proc~~matchfaces3d~~CallsGraph proc~matchfaces3d MatchFaces3D proc~bilinearfacepoint3d BilinearFacePoint3D proc~matchfaces3d->proc~bilinearfacepoint3d proc~flipfacecoords3d FlipFaceCoords3D proc~matchfaces3d->proc~flipfacecoords3d

Called by

proc~~matchfaces3d~~CalledByGraph proc~matchfaces3d MatchFaces3D proc~simplemortarmesh_mesh3d_t SimpleMortarMesh_Mesh3D_t proc~simplemortarmesh_mesh3d_t->proc~matchfaces3d

Contents

Source Code


Source Code

  subroutine MatchFaces3D(coordsA,sA,coordsB,sB,tol,matched,flip)
    !! Determines whether face sA of element A coincides with face sB of element B,
    !! and if so with which flip: face_B(F_flip(u,v)) == face_A(u,v) at the sampled
    !! points. Bilinear faces are pinned by their four corners plus one interior
    !! point.
    implicit none
    real(prec),intent(in) :: coordsA(1:3,1:2,1:2,1:2)
    integer,intent(in) :: sA
    real(prec),intent(in) :: coordsB(1:3,1:2,1:2,1:2)
    integer,intent(in) :: sB
    real(prec),intent(in) :: tol
    logical,intent(out) :: matched
    integer,intent(out) :: flip
    ! 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) :: pA(1:3),pB(1:3)
    real(prec) :: u2,v2
    integer :: f,n
    logical :: ok

    matched = .false.
    flip = 0
    do f = 0,7
      ok = .true.
      do n = 1,5
        pA = BilinearFacePoint3D(coordsA,sA,us(n),vs(n))
        call FlipFaceCoords3D(us(n),vs(n),f,u2,v2)
        pB = BilinearFacePoint3D(coordsB,sB,u2,v2)
        if(maxval(abs(pA-pB)) > tol) then
          ok = .false.
          exit
        endif
      enddo
      if(ok) then
        matched = .true.
        flip = f
        return
      endif
    enddo

  endsubroutine MatchFaces3D