Add parentID as GhostFromFiner. Then set its BC from its children. If any children do NOT exist, recursively call this routine to add them as GhostFromFiner.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=long_k), | intent(in) | :: | elemID |
requested treeID |
||
type(tem_levelDesc_type), | intent(inout) | :: | levelDesc(minLevel:) |
the level descriptor to be filled |
||
integer, | intent(in) | :: | minLevel |
minimum level fluid element in the tree |
||
type(treelmesh_type), | intent(in) | :: | tree |
tree information |
||
logical, | intent(out) | :: | updated |
was the current element updated in this call? |
||
integer, | intent(out) | :: | foundPos | |||
type(tem_stencilHeader_type), | intent(in) | :: | stencil |
current stencil definition |
recursive subroutine add_ghostFromFiner( elemID, levelDesc, minLevel, & & tree, updated, foundPos, stencil ) ! -------------------------------------------------------------------- ! !> requested treeID integer(kind=long_k), intent(in) :: elemID !> minimum level fluid element in the tree integer, intent(in) :: minLevel !> the level descriptor to be filled type(tem_levelDesc_type), intent(inout) :: levelDesc(minLevel:) !> tree information type(treelmesh_type), intent(in) :: tree ! position of elemID in elem%tID list integer, intent(out) :: foundPos !> was the current element updated in this call? logical, intent(out) :: updated !> current stencil definition type( tem_stencilHeader_type ), intent(in) :: stencil ! -------------------------------------------------------------------- ! integer :: iChild, level integer(kind=long_k) :: children(8), property logical :: wasAdded, childUpdated integer :: childPos(8) type(tem_path_type) :: childPath ! -------------------------------------------------------------------- ! ! Set as not updated by default updated = .false. ! Create the ghostFromFiner level = tem_LevelOf( elemID ) call append( me = levelDesc( level )%elem, & & tID = elemID, & & eType = eT_ghostFromFiner, & & property = 0_long_k, & & sourceProc = tree%global%myPart+1, & & pos = foundPos, & & wasAdded = wasAdded ) if( wasAdded ) then updated = .true. children = tem_directChildren( elemID ) childPos = 0 ! reset child positions. non-existing children are 0 ! reset property property = 0_long_k ! if added elemID is more than level coarser than available child treeID ! in original treeID list then add all children between level and ! neighLevel do iChild = 1, 8 ! Return position in the treeIDlist childPath = tem_PathOf( children( iChild )) childPos( iChild ) = tem_PosOfPath( childPath, tree%pathList ) if( childPos( iChild ) < 0 ) then ! This child does NOT exists, recusively add it as a ghostFromFiner. call add_ghostFromFiner( elemID = children( iChild ), & & levelDesc = levelDesc, & & minLevel = minlevel, & & tree = tree, & & foundPos = childPos( iChild ), & & updated = childUpdated, & & stencil = stencil ) ! Unify all properties of the children property = ieor( property, & & levelDesc(level+1) & & %elem & & %property & & %val( childPos(iChild) ) ) updated = ( updated .or. childUpdated ) else ! This child is a Fluid, i.e. already exists in element list childPos( iChild ) = PositionOfVal( & & levelDesc( level+1 )%elem%tID, children(iChild) ) end if end do ! iChild = 1, 8 ! Now reconstruct current element's neighborhood ! based on the children's information call tem_find_BCs_fromFiner( childPos = childPos, & & sourceLevel = level + 1, & & targetLevel = level, & & targetPos = foundPos, & & levelDesc = levelDesc, & & minLevel = minLevel, & & stencil = stencil ) else ! ghostFromFiner element was not added ! Hence, we found available information which now has to be returned updated = .false. end if end subroutine add_ghostFromFiner