oc_reflect Function

public pure function oc_reflect(s, c) result(rc)

Sibling child index obtained by reflecting c across face s (swap the half-index of the direction normal to s).

Arguments

TypeIntentOptionalAttributesName
integer, intent(in) :: s
integer, intent(in) :: c

Return Value integer


Called by

proc~~oc_reflect~~CalledByGraph proc~oc_reflect oc_reflect proc~faceneighbor_octreemesh3d FaceNeighbor_OctreeMesh3D proc~faceneighbor_octreemesh3d->proc~oc_reflect proc~faceneighbor_octreemesh3d->proc~faceneighbor_octreemesh3d

Contents

Source Code


Source Code

  pure function oc_reflect(s,c) result(rc)
    !! Sibling child index obtained by reflecting c across face s (swap the half-index of
    !! the direction normal to s).
    implicit none
    integer,intent(in) :: s,c
    integer :: rc
    integer,parameter :: xref(1:8) = [2,1,4,3,6,5,8,7] ! swap ax (s = 3,5)
    integer,parameter :: yref(1:8) = [4,3,2,1,8,7,6,5] ! swap ay (s = 2,4)
    integer,parameter :: zref(1:8) = [5,6,7,8,1,2,3,4] ! swap az (s = 1,6)
    if(s == 1 .or. s == 6) then
      rc = zref(c)
    elseif(s == 2 .or. s == 4) then
      rc = yref(c)
    else
      rc = xref(c)
    endif
  endfunction oc_reflect