tem_BaryOfId Function

public pure function tem_BaryOfId(tree, TreeID) result(bary)

The following function provides the coordinates of the barycenter for a given treeID in the complete mesh.

Arguments

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

mesh information

integer(kind=long_k), intent(in) :: TreeID

input Element ID

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

barycenter return value


Source Code

  pure function tem_BaryOfId(tree,TreeID) result(bary)
    ! -------------------------------------------------------------------- !
    !> mesh information
    type(treelmesh_type), intent(in) :: tree
    !> input Element ID
    integer(kind=long_k), intent(in) :: TreeID
    !> barycenter return value
    real(kind=rk) :: bary(3)
    ! -------------------------------------------------------------------- !
    integer       :: coord(4) ! spatial index triple for a given ID
    real(kind=rk) :: dx ! size of Element
    ! -------------------------------------------------------------------- !
    coord = tem_CoordOfId(TreeID)
    dx = tem_elemSizeLevel( tree, coord(4) )
    bary = tree%global%origin + (real(coord(:3), kind=rk) + 0.5_rk)*dx

  end function tem_BaryOfId