tem_shape_subTreeFromGeomInters Subroutine

public subroutine tem_shape_subTreeFromGeomInters(me, inTree, countElems, countPoints, grwPnts, storePnts, map2global)

This routine creates subTree from geometry intersection

Arguments

Type IntentOptional AttributesName
type(tem_shape_type), intent(in) :: me

shape objects on which to work

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

Global tree

integer, intent(inout) :: countElems(globalMaxLevels)

How many elements there will be for each level in the track

integer, intent(inout) :: countPoints

How many points there will be

type(tem_grwPoints_type), intent(inout) :: grwPnts

growing array to store tracking points

logical, intent(in) :: storePnts

to Store points in grwPnts

type(dyn_intarray_type), intent(inout) :: map2global

growing array for the map2global


Calls

proc~~tem_shape_subtreefromgeominters~~CallsGraph proc~tem_shape_subtreefromgeominters tem_shape_subTreeFromGeomInters proc~tem_cano_storepntsinsubtree tem_cano_storePntsInSubTree proc~tem_shape_subtreefromgeominters->proc~tem_cano_storepntsinsubtree proc~tem_spherecubeoverlap tem_sphereCubeOverlap proc~tem_shape_subtreefromgeominters->proc~tem_spherecubeoverlap proc~tem_stlcubeoverlap tem_stlCubeOverlap proc~tem_shape_subtreefromgeominters->proc~tem_stlcubeoverlap proc~tem_ellipsoidcubeoverlap tem_ellipsoidCubeOverlap proc~tem_shape_subtreefromgeominters->proc~tem_ellipsoidcubeoverlap proc~tem_trianglecubeoverlap tem_triangleCubeOverlap proc~tem_shape_subtreefromgeominters->proc~tem_trianglecubeoverlap proc~tem_levelof tem_LevelOf proc~tem_shape_subtreefromgeominters->proc~tem_levelof mpi_wtime mpi_wtime proc~tem_shape_subtreefromgeominters->mpi_wtime interface~append~13 append proc~tem_shape_subtreefromgeominters->interface~append~13 proc~tem_converttreeidtocube tem_convertTreeIDtoCube proc~tem_shape_subtreefromgeominters->proc~tem_converttreeidtocube proc~tem_cano_initsubtree tem_cano_initSubTree proc~tem_shape_subtreefromgeominters->proc~tem_cano_initsubtree proc~tem_abort tem_abort proc~tem_shape_subtreefromgeominters->proc~tem_abort proc~tem_cylindercubeoverlap tem_cylinderCubeOverlap proc~tem_shape_subtreefromgeominters->proc~tem_cylindercubeoverlap interface~init init proc~tem_shape_subtreefromgeominters->interface~init proc~tem_cano_storepntsinsubtree->interface~append~13 proc~tem_coordofreal tem_CoordOfReal proc~tem_cano_storepntsinsubtree->proc~tem_coordofreal proc~tem_posofid tem_PosOfId proc~tem_cano_storepntsinsubtree->proc~tem_posofid proc~tem_idofcoord tem_IdOfCoord proc~tem_cano_storepntsinsubtree->proc~tem_idofcoord proc~hollowspherecubeoverlap hollowSphereCubeOverlap proc~tem_spherecubeoverlap->proc~hollowspherecubeoverlap proc~solidspherecubeoverlap solidSphereCubeOverlap proc~tem_spherecubeoverlap->proc~solidspherecubeoverlap proc~tem_stlcubeoverlap->proc~tem_trianglecubeoverlap proc~solidellipsoidcubeoverlap solidellipsoidCubeOverlap proc~tem_ellipsoidcubeoverlap->proc~solidellipsoidcubeoverlap proc~hollowellipsoidcubeoverlap hollowellipsoidCubeOverlap proc~tem_ellipsoidcubeoverlap->proc~hollowellipsoidcubeoverlap proc~triboxoverlap_loc triBoxOverlap_loc proc~tem_trianglecubeoverlap->proc~triboxoverlap_loc proc~append_da_label append_da_label interface~append~13->proc~append_da_label proc~append_da_veclabel append_da_veclabel interface~append~13->proc~append_da_veclabel proc~tem_endofid tem_endOfId proc~tem_converttreeidtocube->proc~tem_endofid proc~tem_elemsize tem_ElemSize proc~tem_converttreeidtocube->proc~tem_elemsize proc~tem_originofid tem_originOfId proc~tem_converttreeidtocube->proc~tem_originofid proc~tem_cano_initsubtree->proc~tem_levelof proc~tem_cano_initsubtree->interface~append~13 proc~tem_cano_initsubtree->proc~tem_converttreeidtocube proc~tem_cano_initsubtree->proc~tem_coordofreal proc~tem_planecubeoverlap tem_planeCubeOverlap proc~tem_cano_initsubtree->proc~tem_planecubeoverlap proc~tem_linecubeoverlap tem_lineCubeOverlap proc~tem_cano_initsubtree->proc~tem_linecubeoverlap proc~tem_cano_initsubtree->proc~tem_posofid proc~tem_boxcubeoverlap tem_boxCubeOverlap proc~tem_cano_initsubtree->proc~tem_boxcubeoverlap proc~tem_cano_initsubtree->proc~tem_idofcoord mpi_abort mpi_abort proc~tem_abort->mpi_abort proc~tem_cylindercubeoverlap->proc~tem_spherecubeoverlap proc~tem_cylindercubeoverlap->proc~tem_linecubeoverlap proc~init_grwpoints init_grwPoints interface~init->proc~init_grwpoints

Called by

proc~~tem_shape_subtreefromgeominters~~CalledByGraph proc~tem_shape_subtreefromgeominters tem_shape_subTreeFromGeomInters proc~tem_create_subtree_of tem_create_subTree_of proc~tem_create_subtree_of->proc~tem_shape_subtreefromgeominters proc~tem_create_subtree_of_st_funlist tem_create_subTree_of_st_funList proc~tem_create_subtree_of_st_funlist->proc~tem_create_subtree_of proc~tem_write_debugmesh tem_write_debugMesh proc~tem_write_debugmesh->proc~tem_create_subtree_of program~tem_varsys_test tem_varSys_test program~tem_varsys_test->proc~tem_create_subtree_of proc~tem_init_tracker_subtree tem_init_tracker_subTree proc~tem_init_tracker_subtree->proc~tem_create_subtree_of proc~tem_init_convergence tem_init_convergence proc~tem_init_convergence->proc~tem_create_subtree_of program~tem_variable_evaltype_test tem_variable_evaltype_test program~tem_variable_evaltype_test->proc~tem_create_subtree_of_st_funlist program~tem_varsys_stfunvar_test tem_varSys_stfunVar_test program~tem_varsys_stfunvar_test->proc~tem_create_subtree_of_st_funlist program~tem_variable_extract_test tem_variable_extract_test program~tem_variable_extract_test->proc~tem_create_subtree_of_st_funlist proc~check_variableoperations check_variableOperations proc~check_variableoperations->proc~tem_create_subtree_of_st_funlist program~tem_variable_combine_test tem_variable_combine_Test program~tem_variable_combine_test->proc~tem_create_subtree_of_st_funlist program~tem_varsys_opvar_test tem_varSys_opVar_test program~tem_varsys_opvar_test->proc~tem_create_subtree_of_st_funlist program~tem_logical_opertor_test tem_logical_opertor_test program~tem_logical_opertor_test->proc~check_variableoperations

Contents


Source Code

  subroutine tem_shape_subTreeFromGeomInters( me, inTree, countElems, &
    &                                         countPoints, grwPnts,   &
    &                                         storePnts, map2global   )
    ! --------------------------------------------------------------------------
    !> shape objects on which to work
    type(tem_shape_type ),intent(in) :: me
    !> Global tree
    type(treelmesh_type), intent(in) :: inTree
    !> How many elements there will be for each level in the track
    integer, intent( inout ) :: countElems( globalMaxLevels )
    !> How many points there will be
    integer, intent( inout ) :: countPoints
    !> growing array for the map2global
    type(dyn_intArray_type), intent(inout) :: map2global
    !> growing array to store tracking points
    type(tem_grwPoints_type), intent(inout) :: grwPnts
    !> to Store points in grwPnts
    logical, intent(in) :: storePnts
    ! --------------------------------------------------------------------------
    real(kind=rk) :: tStart, tEnd
    integer :: iElem, dPos, tLevel, iObj
    logical :: wasAdded, intersects, addToSubTree
    type(tem_cube_type) :: cube
    integer(kind=long_k) :: treeID
    ! --------------------------------------------------------------------------
    write(logUnit(4),"(A)") 'Extracting subTree from geometrical shapes-tree' &
      &                    //' intersection'
    tStart = mpi_wtime()

    select case (trim(me%kind))
    case ('canoND')
      ! treat canoND seperately to efficiently handle cano kind = points
      call tem_cano_initSubTree( me            = me%canoND(:), &
        &                        inTree        = inTree,       &
        &                        countElems    = countElems,   &
        &                        map2global    = map2global,   &
        &                        shapeInverted = me%inverted   )
    case ('triangle', 'stl', 'sphere', 'ellipsoid', 'cylinder')
      do iElem = 1, inTree%nElems
        treeID = inTree%treeID(iElem)
        call tem_convertTreeIDtoCube(cube, inTree, treeID)
        intersects = .false.
        ! Treat each object of same geometry kind
        select case (trim(me%kind))
        case ('triangle')
          do iObj = 1, size(me%triangle)
            intersects = intersects                                 &
              & .or. tem_triangleCubeOverlap(me%triangle(iObj), cube)
          end do
        case ('stl')
          intersects = tem_stlCubeOverlap(me%stl_data, cube)
        case ('sphere')
          do iObj = 1, size(me%sphere)
            intersects = intersects                             &
              & .or. tem_sphereCubeOverlap(me%sphere(iObj), cube)
          end do
        case ('ellipsoid')
          do iObj = 1, size(me%ellipsoid)
            intersects = intersects                                   &
              & .or. tem_ellipsoidCubeOverlap(me%ellipsoid(iObj), cube)
          end do
        case ('cylinder')
          do iObj = 1, size(me%cylinder)
            intersects = intersects                                 &
              & .or. tem_cylinderCubeOverlap(me%cylinder(iObj), cube)
          end do
        end select

        addToSubTree = .false.
        if (.not. me%inverted .and. intersects) then
          ! Shape intersects with current element and not inverted
          addToSubTree = .true.
        else if (me%inverted .and. .not. intersects) then
          ! shape not intersected and is inverted shape so add this to subTree
          addToSubTree = .true.
        end if

        if (addToSubTree) then
          ! append iElem in inTree to the map (note that already existing
          ! ones are omitted)
          call append( me       = map2global, &
            &          pos      = dpos,       &
            &          val      = iElem ,     &
            &          wasAdded = wasAdded    )

          ! Count up if it was added
          if( wasAdded ) then
            tLevel   = tem_levelOf( treeID )
            countElems( tLevel ) = countElems( tLevel ) + 1
          end if ! wasAdded
        end if !intersects
      end do !iElem
    case default
      call tem_abort('In tem_shape_subTreeFromGeomInters: Unknown shape kind')
    end select

    countPoints = 0
    call init(me=grwPnts)
    if ( storePnts .and. (map2global%nVals > 0) ) then
      select case (trim(me%kind))
      case ('canoND')
        call tem_cano_storePntsInSubTree( me          = me%canoND(:), &
          &                               inTree      = inTree,       &
          &                               countPoints = countPoints,  &
          &                               grwPnts     = grwPnts,      &
          &                               map2global  = map2global    )
      case default
        call tem_abort('Use get_points supported only for canoND')
      end select
    end if
    tEnd = mpi_wtime()
    write(logunit(4),"(A,E12.6)") 'Done. This process cost: ', tEnd-tStart

  end subroutine tem_shape_subTreeFromGeomInters