identify_additionalNeigh Subroutine

private subroutine identify_additionalNeigh(tree, proc, levelDesc, pathFirst, pathLast, stencil)

identify additionally required neighbor elements run over the 'require' list of elements, which was accumulated before in init_elemLevels. The list includes neighbor elements of stencil neighbors, for stencils with the requireNeighNeigh attribute set. This is needed for example for LBM boundary stencil elements, which in turn require their compute stencil neighborhood to allow PULL operations from there

What exactly is the require list for? - Used ONLY for boundary stencil with higher order neighbors i.e only when require nVals > 0

Arguments

Type IntentOptional Attributes Name
type(treelmesh_type), intent(in) :: tree

the global tree

type(tem_comm_env_type), intent(in) :: proc

Process description to use.

type(tem_levelDesc_type), intent(inout) :: levelDesc(tree%global%minlevel:)

the level descriptor to be filled

type(tem_path_type), intent(in) :: pathFirst(:)

first treeID path in every process

type(tem_path_type), intent(in) :: pathLast(:)

last treeID path in every process

type(tem_stencilHeader_type), intent(in) :: stencil

the compute stencil, for which the additional neighbors are reconstructed


Calls

proc~~identify_additionalneigh~~CallsGraph proc~identify_additionalneigh identify_additionalNeigh interface~positionofval~5 positionofval proc~identify_additionalneigh->interface~positionofval~5 proc~identify_elements identify_elements proc~identify_additionalneigh->proc~identify_elements proc~tem_horizontalspacer tem_horizontalSpacer proc~identify_additionalneigh->proc~tem_horizontalspacer proc~posofval_label posofval_label interface~positionofval~5->proc~posofval_label proc~identify_elements->proc~identify_elements interface~append~11 append proc~identify_elements->interface~append~11 interface~init~24 init proc~identify_elements->interface~init~24 proc~create_allparentneighbors create_allParentNeighbors proc~identify_elements->proc~create_allparentneighbors proc~identify_stencilneigh identify_stencilNeigh proc~identify_elements->proc~identify_stencilneigh proc~single_process_element single_process_element proc~identify_elements->proc~single_process_element proc~tem_directchildren tem_directChildren proc~identify_elements->proc~tem_directchildren proc~tem_find_depproc tem_find_depProc proc~identify_elements->proc~tem_find_depproc proc~tem_levelof tem_LevelOf proc~identify_elements->proc~tem_levelof proc~tem_pathof tem_PathOf proc~identify_elements->proc~tem_pathof proc~tem_tidinfo tem_tIDinfo proc~identify_elements->proc~tem_tidinfo proc~append_ga_dynlong append_ga_dynlong interface~append~11->proc~append_ga_dynlong proc~append_ga_dynlong_vec append_ga_dynlong_vec interface~append~11->proc~append_ga_dynlong_vec proc~init_ga2d_real init_ga2d_real interface~init~24->proc~init_ga2d_real proc~create_allparentneighbors->proc~identify_elements proc~create_allparentneighbors->interface~append~11 proc~create_allparentneighbors->proc~identify_stencilneigh interface~tem_parentof tem_ParentOf proc~create_allparentneighbors->interface~tem_parentof proc~identify_stencilneigh->proc~identify_elements interface~sortedposofval~5 sortedposofval proc~posofval_label->interface~sortedposofval~5 proc~single_process_element->interface~append~11 proc~single_process_element->interface~init~24 proc~single_process_element->proc~tem_levelof proc~identify_local_element identify_local_element proc~single_process_element->proc~identify_local_element proc~tem_abort tem_abort proc~single_process_element->proc~tem_abort proc~tem_find_depproc_globsearch tem_find_depProc_globSearch proc~tem_find_depproc->proc~tem_find_depproc_globsearch proc~tem_pathcomparison tem_PathComparison proc~tem_find_depproc->proc~tem_pathcomparison proc~tem_baryofid tem_BaryOfId proc~tem_tidinfo->proc~tem_baryofid proc~tem_coordofid tem_CoordOfId proc~tem_tidinfo->proc~tem_coordofid proc~tem_elemsize tem_ElemSize proc~tem_tidinfo->proc~tem_elemsize

Called by

proc~~identify_additionalneigh~~CalledByGraph proc~identify_additionalneigh identify_additionalNeigh proc~build_levelelements build_levelElements proc~build_levelelements->proc~identify_additionalneigh proc~tem_find_allelements tem_find_allElements proc~tem_find_allelements->proc~identify_additionalneigh proc~tem_find_allelements->proc~build_levelelements proc~tem_create_leveldesc tem_create_levelDesc proc~tem_create_leveldesc->proc~tem_find_allelements proc~tem_dimbydim_construction tem_dimByDim_construction proc~tem_dimbydim_construction->proc~tem_create_leveldesc proc~tem_build_face_info tem_build_face_info proc~tem_build_face_info->proc~tem_dimbydim_construction

Source Code

  subroutine identify_additionalNeigh( tree, proc, levelDesc, pathFirst,        &
    &                                  pathLast, stencil )
    ! ---------------------------------------------------------------------------
    !> the global tree
    type(treelmesh_type), intent(in) :: tree
    !> Process description to use.
    type(tem_comm_env_type), intent(in) :: proc
    !> the level descriptor to be filled
    type(tem_levelDesc_type), intent(inout) :: levelDesc(tree%global%minlevel:)
    !> first treeID path in every process
    type(tem_path_type), intent(in) :: pathFirst(:)
    !> last treeID path in every process
    type(tem_path_type), intent(in) :: pathLast(:)
    !> the compute stencil, for which the additional neighbors are reconstructed
    type(tem_stencilHeader_type), intent(in) :: stencil
    ! ---------------------------------------------------------------------------
    integer :: iLevel, posInElem, neighPos, elemPos, iNeighElem, iElem
    integer(kind=long_k) :: treeID
    ! ---------------------------------------------------------------------------

    call tem_horizontalSpacer( fUnit = dbgUnit(1), before = 1 )
    write(dbgUnit(3),*) 'Inside routine: identify_additionalNeigh'

    ! The position of the compute stencil
    do iLevel = tree%global%minlevel, tree%global%maxLevel
      ! Run over the additionally required element list
      do iElem = 1, levelDesc( iLevel )%require%nVals
        ! get the position of the treeID in the element list
        posInElem = PositionOfVal( me  = levelDesc( iLevel )%elem%tID,             &
          &                        val = levelDesc( iLevel )%require%val( iElem ))
        ! get the element position
        if( posInElem > 0 ) then
          if ( levelDesc( iLevel )%elem%eType%val( posInElem ) > 0) then
            ! Run over all the neighbors of the compute stencil
            do iNeighElem = 1, stencil%QQN
              ! position of neighbor treeID in dynamic array of neighID
              neighPos = levelDesc( iLevel )%elem%stencil%val( posInElem )         &
                &                         %val(1)%tIDpos( iNeighElem )
              if( neighPos > 0 ) then
                treeID = &
                  & levelDesc( iLevel )%elem%neighID%val( posInElem )%val( neighPos )
                call identify_elements( TreeID     = treeID,        &
                  &                     tree       = tree,           &
                  &                     pathFirst  = pathFirst,      &
                  &                     pathLast   = pathLast,       &
                  &                     levelDesc  = levelDesc,      &
                  &                     elemPos    = elemPos,        &
                  &                     proc       = proc,           &
                  &                     nesting    = 0,              &
                  &                     stencil    = stencil,        &
                  &       skip_add_additionalGhost = .true.             )
              else ! neighPos =< 0, i.e. no additional neighbor
                elemPos = 0
              end if
              levelDesc( iLevel )%elem%stencil%val( posInElem )%val(1)    &
                &                %totalPos( iNeighElem ) = elemPos
            end do ! neighPos > 0
          else ! eType <= 0
            write(logUnit(8),*) 'Can not find additional neighbor: ', treeID
          end if  ! valid elemType
        else ! posInElem <= 0
          write(logUnit(2),*) 'element which requires additional neighbor is not part of total list'
        end if ! posInElem > 0
      end do ! iElem
    end do ! iLevel

    write(dbgUnit(1),*) 'Leave routine: identify_additionalNeigh'
    call tem_horizontalSpacer( fUnit = dbgUnit(1), after = 1 )

  end subroutine identify_additionalNeigh