This subroutine collects the treeIDs of all elements in the level descriptor on the local partition (e.g. used in debug mesh, no general option for now).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_levelDesc_type), | intent(in) | :: | levelDesc(:) |
level descriptor including all elements (fluid, ghost, halo) |
||
integer(kind=long_k), | intent(out), | allocatable | :: | treeID(:) |
temporary array of treeIDs |
subroutine tem_shape_initLocal( levelDesc, treeID )
! ---------------------------------------------------------------------------
!> level descriptor including all elements (fluid, ghost, halo)
type(tem_levelDesc_type ),intent(in) :: levelDesc(:)
!> temporary array of treeIDs
integer(kind=long_k), allocatable, intent(out) :: treeID(:)
! ---------------------------------------------------------------------------
integer :: offset
integer :: nTotalElems
integer :: iLevel
integer :: iElem
! ---------------------------------------------------------------------------
write(logUnit(1),*) 'Initializing shape with all elements on this partition'
! get the total number of elements in the level descriptor
nTotalElems = sum(levelDesc(:)%nElems)
! allocate the array of treeIDs
allocate(treeID(nTotalElems))
offset = 0
! copy the treeIDs to the array
do iLevel = 1,size(levelDesc)
do iElem = 1, size( levelDesc( iLevel )%total )
treeID( offset + iElem ) = levelDesc(iLevel)%total(iElem)
end do
offset = offset + size(levelDesc( iLevel )%total)
end do
end subroutine tem_shape_initLocal