tem_findPath Subroutine

public recursive subroutine tem_findPath(Path, eligible_child, ElemList, pathlist, nElems, otherLevel)

Recursive routine to find all actual (eligible) leave nodes in the local partition for a given treeID.

Todo

HK: when doing this for the complete domain it would probably better just compute the ID on the finest level along with the information on the level of each leaf, in order to speed up things a little. This way comparison would be just a simple integer comparison.

Arguments

Type IntentOptional Attributes Name
type(tem_path_type), intent(in) :: Path

Path to the leaf to find in the array of Elements

integer, intent(in) :: eligible_child(:)

Candidate childs, which might be considered as neighbors

type(tem_longList), pointer :: ElemList

linked list of resulting elements building the neighbor

type(tem_path_type), intent(in) :: pathlist(nElems)

array of paths

integer, intent(in) :: nElems

number of elements in list

logical, intent(inout), optional :: otherLevel

entry is on another level


Calls

proc~~tem_findpath~~CallsGraph proc~tem_findpath tem_findPath proc~tem_findpath->proc~tem_findpath interface~append~2 append proc~tem_findpath->interface~append~2 proc~tem_pathof tem_PathOf proc~tem_findpath->proc~tem_pathof proc~tem_posofpath tem_PosOfPath proc~tem_findpath->proc~tem_posofpath proc~tem_appenddp1darray tem_appendDp1dArray interface~append~2->proc~tem_appenddp1darray proc~tem_appenddp2darray tem_appendDp2dArray interface~append~2->proc~tem_appenddp2darray proc~tem_appendint1darray tem_appendInt1dArray interface~append~2->proc~tem_appendint1darray proc~tem_appendint2darray tem_appendInt2dArray interface~append~2->proc~tem_appendint2darray proc~tem_appendintlist tem_appendIntList interface~append~2->proc~tem_appendintlist proc~tem_appendintlong1darray tem_appendIntLong1dArray interface~append~2->proc~tem_appendintlong1darray proc~tem_appendintlong2darray tem_appendIntLong2dArray interface~append~2->proc~tem_appendintlong2darray proc~tem_appendintlongarrayto1darray tem_appendIntLongArrayTo1dArray interface~append~2->proc~tem_appendintlongarrayto1darray proc~tem_appendlonglist tem_appendLongList interface~append~2->proc~tem_appendlonglist proc~tem_appendsp1darray tem_appendSp1dArray interface~append~2->proc~tem_appendsp1darray proc~tem_appendsp2darray tem_appendSp2dArray interface~append~2->proc~tem_appendsp2darray

Source Code

  recursive subroutine tem_findPath( Path, eligible_child, ElemList, &
    &                                Pathlist, nElems, otherLevel    )
    ! -------------------------------------------------------------------- !
    !> Path to the leaf to find in the array of Elements
    type(tem_path_type), intent(in) :: Path
    !> Candidate childs, which might be considered as neighbors
    integer, intent(in) :: eligible_child(:)
    !> linked list of resulting elements building the neighbor
    type(tem_longList), pointer :: ElemList
    !> number of elements in list
    integer, intent(in)  :: nElems
    !> array of paths
    type(tem_path_type), intent(in)  :: pathlist(nElems)
    !> entry is on another level
    logical,optional,intent(inout) :: otherLevel
    ! -------------------------------------------------------------------- !
    integer(kind=long_k) :: pos
    integer :: i
    integer(kind=long_k) :: off
    type(tem_path_type) :: childPath
    ! -------------------------------------------------------------------- !

    ! binary search of the Path in the array of actual present elements
    ! Return pos < 0 if
    pos = tem_PosOfPath(Path, Pathlist)

    ! If the neighbor is on a level higher than myself, it should be
    ! delivered by binary search

    if (pos > 0 ) then
      ! Element actually exists, append it to the list
       call append(ElemList, pos)
    else if (pos < 0) then
      ! Element is a GhostFromFiner, look for childs
      if( present( otherLevel ) ) otherLevel = .true.
      off = Path%Node(1)*8
      do i=1,size(eligible_child)
        childPath = tem_pathOf(off + eligible_child(i))
        call tem_findPath( childPath, eligible_child, ElemList, &
          &                Pathlist, nElems, otherLevel)
      end do
    else ! pos == 0
    end if

  end subroutine tem_findPath