The following function provides the coordinates of the barycenter for a given treeID in the complete mesh.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(treelmesh_type), | intent(in) | :: | tree |
mesh information |
||
integer(kind=long_k), | intent(in) | :: | TreeID |
input Element ID |
barycenter return value
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