tem_stencil_findIndexOfDir Function

public pure function tem_stencil_findIndexOfDir(findDir, cxDir) result(idx)

Find the index of the given direction in the list of all directions. -1 if not found.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: findDir(3)

vector index to find in cxDir

integer, intent(in) :: cxDir(:,:)

array of vectors

Return Value integer


Source Code

  pure function tem_stencil_findIndexOfDir(findDir, cxDir) result(idx)
    ! -------------------------------------------------------------------- !
    !> vector index to find in cxDir
    integer, intent(in) :: findDir(3)
    !> array of vectors
    integer, intent(in)  :: cxDir(:,:)
    integer :: idx
    ! -------------------------------------------------------------------- !
    integer :: iDir
    ! -------------------------------------------------------------------- !

    idx = -1

    do iDir = 1, size(cxDir, 2)

      if ( cxDir(1, iDir) == findDir(1)       &
        &  .and. cxDir(2, iDir) == findDir(2) &
        &  .and. cxDir(3, iDir) == findDir(3) ) then
        idx = iDir
      end if

    end do

  end function tem_stencil_findIndexOfDir