tem_GetLocalBoundingCube_fromSubTree Function

private function tem_GetLocalBoundingCube_fromSubTree(subTree, globalTree) result(BoundingCube)

Run through all the elements, check the vertices and return the fluid bounding cube

Arguments

Type IntentOptional Attributes Name
type(tem_subTree_type), intent(in) :: subTree

subTree to locate point in

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

corresponding global tree

Return Value real(kind=rk), (3,2)

xyz coordinate for min and max of bounding cube


Calls

proc~~tem_getlocalboundingcube_fromsubtree~~CallsGraph proc~tem_getlocalboundingcube_fromsubtree tem_GetLocalBoundingCube_fromSubTree proc~tem_vrtxcoordofid tem_vrtxCoordOfId proc~tem_getlocalboundingcube_fromsubtree->proc~tem_vrtxcoordofid proc~tem_coordofid tem_CoordOfId proc~tem_vrtxcoordofid->proc~tem_coordofid proc~tem_baryofid tem_BaryOfId proc~tem_vrtxcoordofid->proc~tem_baryofid proc~tem_levelof tem_LevelOf proc~tem_coordofid->proc~tem_levelof proc~tem_baryofid->proc~tem_coordofid proc~tem_elemsizelevel tem_ElemSizeLevel proc~tem_baryofid->proc~tem_elemsizelevel

Called by

proc~~tem_getlocalboundingcube_fromsubtree~~CalledByGraph proc~tem_getlocalboundingcube_fromsubtree tem_GetLocalBoundingCube_fromSubTree interface~tem_getlocalboundingcube tem_GetLocalBoundingCube interface~tem_getlocalboundingcube->proc~tem_getlocalboundingcube_fromsubtree proc~tem_getrealboundingcube tem_GetRealBoundingCube proc~tem_getrealboundingcube->interface~tem_getlocalboundingcube proc~tem_seteffboundingbox_fromsubtree tem_setEffBoundingBox_fromSubTree proc~tem_seteffboundingbox_fromsubtree->interface~tem_getlocalboundingcube proc~tem_seteffboundingbox_fromtree tem_setEffBoundingBox_fromTree proc~tem_seteffboundingbox_fromtree->proc~tem_getrealboundingcube interface~tem_seteffboundingbox tem_setEffBoundingBox interface~tem_seteffboundingbox->proc~tem_seteffboundingbox_fromsubtree interface~tem_seteffboundingbox->proc~tem_seteffboundingbox_fromtree proc~tem_create_subtree_of tem_create_subTree_of proc~tem_create_subtree_of->interface~tem_seteffboundingbox

Contents


Source Code

  function tem_GetLocalBoundingCube_fromSubTree( subTree, globalTree ) &
    &        result(BoundingCube)
    ! -------------------------------------------------------------------- !
    !> subTree to locate point in
    type(tem_subTree_type), intent(in) :: subTree
    !> corresponding global tree
    type(treelmesh_type), intent(in) :: globalTree
    !> xyz coordinate for min and max of bounding cube
    real(kind=rk) :: BoundingCube(3,2)
    ! -------------------------------------------------------------------- !
    real(kind=rk) :: vrtxCoord(3,8) ! coordinates for all eight vertices
    real(kind=rk) :: minX(3) ! xyz coordinate for min of bounding cube
    real(kind=rk) :: maxX(3) ! xyz coordinate for max of bounding cube
    integer(kind=long_k) :: tTreeID
    integer :: iElem, iVert
    ! -------------------------------------------------------------------- !

    ! if the subTree equals to the global shape
    if( subTree%useGlobalMesh ) then
      ! ... the effective bounding cube equals to the one of the tree
      BoundingCube = globalTree%global%effboundingCube(3,2)
    else ! if this is not the case
      minX =  huge( minX )
      maxX = -huge( maxX )

      ! loop over all elements
      do iElem = 1, subTree%nElems
        ! ... and distinguish between local shapes and other shapes
        if( subTree%useLocalMesh ) then
          ! ... copy the treeIDs directly
          tTreeID = subTree%treeID( iElem )
        else
          ! ... the treeIDs from the globalTree via the positions in map2global
          tTreeID = globalTree%treeID( subTree%map2global( iElem ))
        end if
        ! Calculate coordinates of vertices
        vrtxCoord(:,:) = tem_vrtxCoordOfId( globalTree, tTreeID )
        do iVert = 1, 8
          ! Compare with min max
          minX(:) = min( minX(:), vrtxCoord(:, iVert ))
          maxX(:) = max( maxX(:), vrtxCoord(:, iVert ))
        enddo
      enddo
      BoundingCube(:,1) = minX(:)
      BoundingCube(:,2) = maxX(:)
    end if ! useGlobalShape

  end function tem_GetLocalBoundingCube_fromSubTree