This routine identify all the elements in inTree that has a certain property bit, save their positions in inTree into array: map2global, save the number of these elements into level wise array: countElems (e.g. for shape kind='property').
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=long_k), | intent(in) | :: | propBits |
shape objects on which to work |
||
type(treelmesh_type), | intent(in) | :: | inTree |
Global mesh from which the elements are identified and then stored to |
||
integer, | intent(out) | :: | countElems(globalMaxLevels) |
How many elements there will be for each level in the track |
||
type(dyn_intarray_type), | intent(inout) | :: | map2global |
growing array. Elements positions in inTree%treeID |
subroutine tem_shape_initPropElements( propBits, inTree, countElems, map2global )
! ---------------------------------------------------------------------------
!> shape objects on which to work
integer( kind=long_k ), intent(in) :: propBits
!> Global mesh from which the elements are identified and then stored to
type( treelmesh_type ), intent(in) :: inTree
!> How many elements there will be for each level in the track
integer, intent( out ) :: countElems( globalMaxLevels )
!> growing array. Elements positions in inTree%treeID
type(dyn_intArray_type), intent(inout) :: map2global
! ---------------------------------------------------------------------------
integer(kind=long_k) :: elemProp, match
integer :: tLevel, dPos, iElem
logical :: wasAdded
! ---------------------------------------------------------------------------
write(logUnit(1),*) 'Initializing shapes of elements that have a ' &
& // 'certain property'
! Loop over all elements in inTree
do iElem = 1, inTree%nElems
! get its property bits
elemProp = inTree%elemPropertyBits( iElem )
! check whether its property
match = iand( propBits, elemProp )
if( match > 0_long_k ) then
! Append to treeID list (note that already existing ones are
! omitted)
call append( me = map2global, &
& pos = dPos, &
& val = iElem, &
& wasAdded = wasAdded )
! Count up if it was added
if( wasAdded ) then
tLevel = tem_levelOf( inTree%treeID(iElem) )
countElems( tLevel ) = countElems( tLevel ) + 1
end if ! wasAdded
end if ! match > 0
end do ! iElem
end subroutine tem_shape_initPropElements