tem_shape_initByLevels Subroutine

private subroutine tem_shape_initByLevels(inTree, minLevel, maxLevel, countElems, map2global)

Arguments

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

Global mesh from which the elements are identified and then stored to

integer, intent(in) :: minLevel

level range of target elements

integer, intent(in) :: maxLevel

level range of target elements

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

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

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

growing array. Elements positions in inTree%treeID


Calls

proc~~tem_shape_initbylevels~~CallsGraph proc~tem_shape_initbylevels tem_shape_initByLevels interface~tem_tostr tem_toStr proc~tem_shape_initbylevels->interface~tem_tostr proc~tem_firstidatlevel tem_FirstIdAtLevel proc~tem_shape_initbylevels->proc~tem_firstidatlevel interface~append~9 append proc~tem_shape_initbylevels->interface~append~9 proc~tem_lastidatlevel tem_LastIdAtLevel proc~tem_shape_initbylevels->proc~tem_lastidatlevel interface~tem_log tem_log proc~tem_shape_initbylevels->interface~tem_log proc~tem_levelof tem_LevelOf proc~tem_shape_initbylevels->proc~tem_levelof proc~tem_d2str tem_d2str interface~tem_tostr->proc~tem_d2str proc~tem_r2str_arr tem_r2str_arr interface~tem_tostr->proc~tem_r2str_arr proc~tem_i2str_arr tem_i2str_arr interface~tem_tostr->proc~tem_i2str_arr proc~tem_b2str_arr tem_b2str_arr interface~tem_tostr->proc~tem_b2str_arr proc~tem_l2str tem_l2str interface~tem_tostr->proc~tem_l2str proc~tem_r2str tem_r2str interface~tem_tostr->proc~tem_r2str proc~tem_b2str tem_b2str interface~tem_tostr->proc~tem_b2str proc~tem_i2str tem_i2str interface~tem_tostr->proc~tem_i2str proc~tem_d2str_arr tem_d2str_arr interface~tem_tostr->proc~tem_d2str_arr proc~tem_l2str_arr tem_l2str_arr interface~tem_tostr->proc~tem_l2str_arr proc~append_da_label append_da_label interface~append~9->proc~append_da_label proc~append_da_veclabel append_da_veclabel interface~append~9->proc~append_da_veclabel proc~tem_log_for tem_log_for interface~tem_log->proc~tem_log_for proc~tem_log_primary tem_log_primary interface~tem_log->proc~tem_log_primary interface~sortedposofval~5 sortedposofval proc~append_da_label->interface~sortedposofval~5 interface~expand~9 expand proc~append_da_label->interface~expand~9 proc~append_da_veclabel->interface~expand~9 proc~sortposofval_label sortposofval_label interface~sortedposofval~5->proc~sortposofval_label proc~expand_da_label expand_da_label interface~expand~9->proc~expand_da_label

Called by

proc~~tem_shape_initbylevels~~CalledByGraph proc~tem_shape_initbylevels tem_shape_initByLevels proc~tem_shape2subtree tem_shape2subTree proc~tem_shape2subtree->proc~tem_shape_initbylevels proc~tem_create_subtree_of tem_create_subTree_of proc~tem_create_subtree_of->proc~tem_shape2subtree proc~tem_init_convergence tem_init_convergence proc~tem_init_convergence->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_write_debugmesh tem_write_debugMesh proc~tem_write_debugmesh->proc~tem_create_subtree_of 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

Contents


Source Code

  subroutine tem_shape_initByLevels( inTree, minLevel, maxLevel, countElems, &
    &                                map2global )
    ! ---------------------------------------------------------------------------
    !> Global mesh from which the elements are identified and then stored to
    type( treelmesh_type ), intent(in) :: inTree
    !> level range of target elements
    integer, intent(in)  :: minLevel, maxLevel
    !> How many elements there will be for each level in the track
    integer, intent(out) :: countElems( globalMaxLevels )
    !> growing array. Elements positions in inTree%treeID
    type(dyn_intArray_type), intent(inout) :: map2global
    ! ---------------------------------------------------------------------------
    integer(kind=long_k)  :: myID, minID, maxID
    integer :: tLevel, dPos, iElem, loc_min, loc_max
    logical :: wasAdded
    ! ---------------------------------------------------------------------------

    loc_min = minLevel
    loc_max = maxLevel
    if ( minLevel > maxLevel ) then
      ! take inverse
      loc_min = maxLevel
      loc_max = minLevel
    end if

    if ( minLevel < 1 )               loc_min = 1
    if ( maxLevel > globalMaxLevels ) loc_max = globalMaxLevels

    call tem_log(3, 'Initializing shapes by elements between level '&
      &        //trim(tem_toStr(loc_min))//' and '//trim(tem_toStr(loc_max)) )

    ! the treeID range is the first ID on min level and the last ID on max level
    minID = tem_firstIdAtLevel( loc_min )
    maxID =  tem_lastIdAtLevel( loc_max )

    ! Loop over all elements in inTree
    do iElem = 1, inTree%nElems

      myID = inTree%treeID(iElem)

      if( (myID >= minID) .and. (myID <= maxID) ) then
        ! Append to treeID list (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( inTree%treeID(iElem) )
          countElems( tLevel ) = countElems( tLevel ) + 1
        end if ! wasAdded

      end if

    end do ! iElem

  end subroutine tem_shape_initByLevels