tem_findElement Subroutine

public recursive subroutine tem_findElement(TreeID, eligible_child, ElemList, treeIDlist, nElems, Part_First, Part_Last, otherLevel)

Recursive routine to find all actual (eligible) leave nodes in the local partition for a given treeID. Alternatively use tem_findPath, which uses precomputed paths in the tree and should speed up the search (at the expense of storing the paths beforehand).

Arguments

Type IntentOptional Attributes Name
integer(kind=long_k) :: TreeID

TreeID to find in the array of Elements

integer :: eligible_child(:)

Candidate childs, which might be considered as neighbors

type(tem_longList), pointer :: ElemList

linked list of resulting elements building the neighbor

integer(kind=long_k), intent(in) :: treeIDlist(nElems)

array of treeIDs

integer, intent(in) :: nElems

number of elements in list

integer(kind=long_k), intent(in) :: Part_First(:)

parts first entry

integer(kind=long_k), intent(in) :: Part_Last(:)

parts last entry

logical, intent(inout), optional :: otherLevel

entry is on another level


Calls

proc~~tem_findelement~~CallsGraph proc~tem_findelement tem_findElement proc~tem_findelement->proc~tem_findelement proc~tem_posofid tem_PosOfId proc~tem_findelement->proc~tem_posofid interface~append~11 append proc~tem_findelement->interface~append~11 proc~tem_pathof tem_PathOf proc~tem_posofid->proc~tem_pathof proc~tem_pathcomparison tem_PathComparison proc~tem_posofid->proc~tem_pathcomparison proc~tem_appendint2darray tem_appendInt2dArray interface~append~11->proc~tem_appendint2darray proc~tem_appendintlist tem_appendIntList interface~append~11->proc~tem_appendintlist proc~tem_appendintlong1darray tem_appendIntLong1dArray interface~append~11->proc~tem_appendintlong1darray proc~tem_appendintlong2darray tem_appendIntLong2dArray interface~append~11->proc~tem_appendintlong2darray proc~tem_appendsp1darray tem_appendSp1dArray interface~append~11->proc~tem_appendsp1darray proc~tem_appendsp2darray tem_appendSp2dArray interface~append~11->proc~tem_appendsp2darray proc~tem_appendintlongarrayto1darray tem_appendIntLongArrayTo1dArray interface~append~11->proc~tem_appendintlongarrayto1darray proc~tem_appendint1darray tem_appendInt1dArray interface~append~11->proc~tem_appendint1darray proc~tem_appendlonglist tem_appendLongList interface~append~11->proc~tem_appendlonglist proc~tem_appenddp1darray tem_appendDp1dArray interface~append~11->proc~tem_appenddp1darray proc~tem_appenddp2darray tem_appendDp2dArray interface~append~11->proc~tem_appenddp2darray

Contents

Source Code


Source Code

  recursive subroutine tem_findElement( TreeID, eligible_child, ElemList, &
    &                                   treeIDlist, nElems, Part_First,   &
    &                                   Part_Last, otherLevel             )
    ! -------------------------------------------------------------------- !
    !> TreeID to find in the array of Elements
    integer(kind=long_k) :: TreeID
    !> Candidate childs, which might be considered as neighbors
    integer :: 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 treeIDs
    integer(kind=long_k), intent(in)  :: treeIDlist(nElems)
    !> parts first entry
    integer(kind=long_k), intent(in) :: Part_First(:)
    !> parts last entry
    integer(kind=long_k), intent(in) :: Part_Last(:)
    !> entry is on another level
    logical,optional,intent(inout) :: otherLevel
    ! -------------------------------------------------------------------- !
    integer(kind=long_k) :: pos
    integer :: i
    integer(kind=long_k) :: childID, off
    ! -------------------------------------------------------------------- !

    ! binary search of the ID in the array of actual present elements
    ! Return pos < 0 if
    pos = tem_PosOfId(TreeID, treeIDlist)

    ! 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 virtual neighbor, look for childs
        if( present( otherLevel ) ) otherLevel = .true.
        off = TreeID*8
        do i=1,size(eligible_child)
          childID = off + eligible_child(i)
          call tem_findElement( childID, eligible_child, ElemList,        &
            &                   treeIDlist, nElems, Part_First, Part_Last )
        end do
      end if
    end if

  end subroutine tem_findElement