tem_FirstIdAtLevel Function

public elemental function tem_FirstIdAtLevel(level) result(res)

This function delivers the refinement level of a TreeID

The refinement level of a \ref treelmesh_module::treelmesh_type::treeid "treeID" is found by repeatedly computing the parents with the equation used in the [tem_ParentOf function] (@ref tem_parentatlevel) and counting the iterations, until the universal root is reached.

First TreeID in the complete tree on a given level

e.g. level 1: 1 .. 8 -> offset = 1 level 2: 9 .. 72 -> offset = 9 level 3: 73 .. -> offset = 73

A level offset is calculated by summing all the nodes of coarser levels. With a level count starting at \f$0\f$ on the coarsest level (the universal root node), this offset \f$s\f$ for a given level \f$L\f$ can be computed by the follwing equation: \f[ s = \sum\limits_{i=0}^{L-1} 8^i = \frac{8^{L} - 1}{7} \f]

Arguments

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

level to check

Return Value integer(kind=long_k)

resulting first treeID


Called by

proc~~tem_firstidatlevel~~CalledByGraph proc~tem_firstidatlevel tem_FirstIdAtLevel proc~tem_cano_storepntsinsubtree tem_cano_storePntsInSubTree proc~tem_cano_storepntsinsubtree->proc~tem_firstidatlevel proc~generate_treelm_cube generate_treelm_cube proc~generate_treelm_cube->proc~tem_firstidatlevel proc~generate_treelm_slice generate_treelm_slice proc~generate_treelm_slice->proc~tem_firstidatlevel proc~load_bc_intern_1d load_BC_intern_1D proc~load_bc_intern_1d->proc~tem_firstidatlevel proc~tem_cano_checkneigh tem_cano_checkNeigh proc~tem_cano_checkneigh->proc~tem_firstidatlevel proc~tem_calc_neighbors tem_calc_neighbors proc~tem_calc_neighbors->proc~tem_firstidatlevel proc~tem_shape_initbylevels tem_shape_initByLevels proc~tem_shape_initbylevels->proc~tem_firstidatlevel proc~generate_treelm_elements generate_treelm_elements proc~generate_treelm_elements->proc~tem_firstidatlevel proc~generate_treelm_line generate_treelm_line proc~generate_treelm_line->proc~tem_firstidatlevel proc~tem_load_internal tem_load_internal proc~tem_load_internal->proc~generate_treelm_cube proc~tem_load_internal->proc~generate_treelm_slice proc~tem_load_internal->proc~generate_treelm_elements proc~tem_load_internal->proc~generate_treelm_line proc~tem_shape_subtreefromgeominters tem_shape_subTreeFromGeomInters proc~tem_shape_subtreefromgeominters->proc~tem_cano_storepntsinsubtree proc~tem_shape_subtreefromgeominters->proc~tem_cano_checkneigh proc~init_tem_bc_prop init_tem_bc_prop proc~init_tem_bc_prop->proc~load_bc_intern_1d proc~tem_init_elemlevels tem_init_elemLevels proc~tem_init_elemlevels->proc~tem_calc_neighbors proc~tem_shape2subtree tem_shape2subTree proc~tem_shape2subtree->proc~tem_shape_initbylevels proc~tem_shape2subtree->proc~tem_shape_subtreefromgeominters proc~load_tem load_tem proc~load_tem->proc~tem_load_internal proc~tem_create_subtree_of tem_create_subTree_of proc~tem_create_subtree_of->proc~tem_shape2subtree proc~tem_create_leveldesc tem_create_levelDesc proc~tem_create_leveldesc->proc~tem_init_elemlevels proc~tem_restart_readheader tem_restart_readHeader proc~tem_restart_readheader->proc~load_tem proc~tem_write_debugmesh tem_write_debugMesh proc~tem_write_debugmesh->proc~tem_create_subtree_of proc~tem_init_convergence tem_init_convergence proc~tem_init_convergence->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 proc~tem_init_tracker_subtree tem_init_tracker_subTree proc~tem_init_tracker_subtree->proc~tem_create_subtree_of proc~tem_dimbydim_construction tem_dimByDim_construction proc~tem_dimbydim_construction->proc~tem_create_leveldesc

Contents

Source Code


Source Code

  elemental function tem_FirstIdAtLevel( level ) result(res)
    ! ---------------------------------------------------------------------------
    !> level to check
    integer, intent(in) :: level
    !> resulting first treeID
    integer(kind=long_k) :: res
    ! ---------------------------------------------------------------------------

    res = ( 8_long_k**level - 1_long_k ) / 7_long_k

  end function tem_FirstIdAtLevel