tem_build_horizontalDependencies Subroutine

public subroutine tem_build_horizontalDependencies(iStencil, levelDesc, tree, computeStencil)

Building neighor array

Todo

is neighID and stencil in element_type still used after this?

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: iStencil

Index of your neighbor list??

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

Level descriptor for each level of your mesh (starting from minimum level).

type(treelmesh_type), intent(in) :: tree

Tree representation of your mesh.

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

The stencil you build the horizontal dependencies for.


Calls

proc~~tem_build_horizontaldependencies~~CallsGraph proc~tem_build_horizontaldependencies tem_build_horizontalDependencies proc~tem_build_listhorizontaldep tem_build_listHorizontalDep proc~tem_build_horizontaldependencies->proc~tem_build_listhorizontaldep proc~tem_build_treehorizontaldep tem_build_treeHorizontalDep proc~tem_build_horizontaldependencies->proc~tem_build_treehorizontaldep proc~tem_treeidintotal tem_treeIDinTotal proc~tem_build_listhorizontaldep->proc~tem_treeidintotal interface~positionofval~5 positionofval proc~tem_build_treehorizontaldep->interface~positionofval~5 proc~tem_baryofid tem_BaryOfId proc~tem_build_treehorizontaldep->proc~tem_baryofid proc~tem_stencil_getheaderpos tem_stencil_getHeaderPos proc~tem_build_treehorizontaldep->proc~tem_stencil_getheaderpos proc~tem_build_treehorizontaldep->proc~tem_treeidintotal proc~posofval_label posofval_label interface~positionofval~5->proc~posofval_label proc~tem_coordofid tem_CoordOfId proc~tem_baryofid->proc~tem_coordofid proc~tem_elemsizelevel tem_ElemSizeLevel proc~tem_baryofid->proc~tem_elemsizelevel proc~tem_etypeofid tem_eTypeOfId proc~tem_treeidintotal->proc~tem_etypeofid tem_positioninsorted tem_positioninsorted proc~tem_treeidintotal->tem_positioninsorted interface~sortedposofval~5 sortedposofval proc~posofval_label->interface~sortedposofval~5 proc~tem_levelof tem_LevelOf proc~tem_coordofid->proc~tem_levelof proc~tem_etypeofid->interface~positionofval~5

Called by

proc~~tem_build_horizontaldependencies~~CalledByGraph proc~tem_build_horizontaldependencies tem_build_horizontalDependencies proc~tem_create_leveldesc tem_create_levelDesc proc~tem_create_leveldesc->proc~tem_build_horizontaldependencies 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 tem_build_horizontalDependencies( iStencil, levelDesc, tree,      &
    &                                          computeStencil )
    ! ---------------------------------------------------------------------------
    !> Tree representation of your mesh.
    type(treelmesh_type), intent(in) :: tree
    !> Level descriptor for each level of your mesh (starting from minimum
    !! level).
    type(tem_levelDesc_type), intent(inout) :: levelDesc(tree%global%minLevel:)
    !> Index of your neighbor list??
    integer, intent(in) :: iStencil
    !> The stencil you build the horizontal dependencies for.
    type(tem_stencilHeader_type), intent(in) :: computeStencil
    ! ---------------------------------------------------------------------------
    integer :: iLevel, iIndex
    integer :: nElemsWithNeigh
    ! ---------------------------------------------------------------------------

    write(logUnit(4),"(A,I0)") 'Build neighbor array for stencil: ', iStencil

    do iLevel = tree%global%minLevel,tree%global%maxLevel

      if( computeStencil%useAll .and. iStencil == 1 ) then
        ! JQ: is it possible the 1st stencil does not use all?
        ! all fluid and ghost and halo elements
        nElemsWithNeigh = levelDesc(iLevel)%nElems
      else if( computeStencil%useAll ) then
        ! @todo: the logic of this IF condition is not clear
        ! all fluid and ghost elements no halos
        nElemsWithNeigh =   levelDesc(iLevel)%nElems     &
          &               - levelDesc(iLevel)%elem%nElems( eT_halo )
      else
        ! only the fluids and ghosts??? that have the stencil iStencil
        nElemsWithNeigh = computeStencil%elemLvl( iLevel )%nVals
      end if

      write(logUnit(4),"(A,I2,A,I0)") ' level: ', iLevel, &
        &                             ', nElems to treat: ', nElemsWithNeigh

      ! allocate the nghElems array with the number of elements this stencil is
      ! used by
      allocate( levelDesc( iLevel )%neigh( iStencil )%            &
        &          nghElems( computeStencil%QQN, nElemsWithNeigh ) )

      iIndex = 0
      if( computeStencil%QQN > 0 ) then
        ! we init everything by default with 0 to find a bug as fast as possible
        levelDesc( iLevel )%neigh( iStencil )%nghElems(:,:) = 0
        if (computeStencil%useAll) then
!          write(logUnit(5),*) '     fluid elements  ', iIndex
          call tem_build_listHorizontalDep(                                    &
            &                  levelDesc      = levelDesc( iLevel ),           &
            &                  iStencil       = iStencil,                      &
            &                  posInSortElem  = levelDesc( iLevel )%totalPnt,  &
            &                  nElems         = nElemsWithNeigh,               &
            &                  iIndex         = iIndex )

        else ! stencil not using all elements
!          write(logUnit(5),*) '     not all elems   ', iIndex
          call tem_build_treeHorizontalDep(                                    &
            &         levelDesc      = levelDesc( iLevel ),                    &
            &         computeStencil = computeStencil,                         &
            &         iStencil       = iStencil,                               &
            &         list           = computeStencil%elemLvl( iLevel )%val,   &
            &         nElems         = nElemsWithNeigh,                        &
            &         tree           = tree                                    )
        end if
      end if

    end do ! iLevel

  end subroutine tem_build_horizontalDependencies