Calculate all eight vertex coordinates of a given tree ID
the numbering of the vertices is according to [tem_param_module:childPosition]
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(treelmesh_type), | intent(in) | :: | tree |
complete tree for info about dimensions |
||
integer(kind=long_k), | intent(in) | :: | treeID |
input element ID |
all vertices coordinates function return value
pure function tem_vrtxCoordOfId( tree, treeID) result(coord)
! -------------------------------------------------------------------- !
!> complete tree for info about dimensions
type(treelmesh_type), intent(in) :: tree
!> input element ID
integer(kind=long_k), intent(in) :: treeID
!> all vertices coordinates function return value
real(kind=rk) :: coord(3,8)
! -------------------------------------------------------------------- !
real(kind=rk) :: elemBary(3) !< barycenter of current element
real(kind=rk) :: length !< element size
integer :: x(4), iCoord, iVrtx
! -------------------------------------------------------------------- !
x = tem_coordOfId( treeID )
! Get element size
length = tree%global%BoundingCubeLength / real( 2**x(4), kind=rk)
! Get Barycenter
elemBary = tem_BaryOfId( tree, treeID )
! ... and calculate from there the vertex coordinates
do iVrtx = 1, 8
do iCoord = 1, 3
coord( iCoord, iVrtx ) = elemBary( iCoord ) &
& + length*0.5_rk*childPosition( iVrtx, iCoord )
enddo
end do
end function tem_vrtxCoordOfId