This routine prepares the ground work for dumping the adapted mesh to disk. The new treeIDs which were created while adaptive refinement are sorted within the levelDescriptor elem type, and then passed to the dump_treelmesh routine for dumping.
will be written for that
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(tem_levelDesc_type), | intent(inout) | :: | levelDesc(:) | |||
type(treelmesh_type), | intent(inout) | :: | tree | |||
type(tem_comm_env_type), | intent(in) | :: | proc |
subroutine tem_adapt_dump_newMesh(levelDesc, tree, proc ) ! --------------------------------------------------------------------------- type(tem_levelDesc_type), intent(inout) :: levelDesc(:) type(treelmesh_type) , intent(inout) :: tree type(tem_comm_env_type) , intent(in) :: proc ! --------------------------------------------------------------------------- ! A temporary list of TreeIDs type( grw_longArray_type ) :: loc_treeID type( treelmesh_type ) :: newTree integer(kind=long_k) :: children(8) integer :: iElem, iChild integer :: elemPos, level integer :: iErr ! --------------------------------------------------------------------------- call init( me = loc_treeID, length = tree%nElems ) ! We loop over all the elements of OLD/ORIGINAL mesh ! this nElems will be updated later and has to be stored ! for this routine ! If an element was sacrificed, its 8 children are appended ! at its original position in the tree to preserve the space filling curve do iElem = 1, tree%nElems level = tem_levelOf(tree%treeID(iElem) ) elemPos = PositionOfVal( me = levelDesc(level)%elem%tID, & & val = tree%treeID(iElem) ) if( .not. levelDesc(level)%elem%property%val(elemPos) == prp_chgElems ) then call append( me = loc_treeID, & val = tree%treeID(iElem) ) else children = tem_directChildren( tree%treeID(iElem) ) do iChild = 1, 8 call append( me = loc_treeID, & & val = children(iChild) ) end do end if end do ! @todo: The children need to be added recursively, and a separate routine !! will be written for that ! @todo: A separate routine for coarsening needs to be implemented ! Initialize the newTree and inherit some data from old allocate( newTree%treeID (loc_treeID%nVals) ) allocate( newTree%Part_First (loc_treeID%nVals) ) allocate( newTree%Part_Last (loc_treeID%nVals) ) allocate( newTree%ElemPropertyBits(loc_treeID%nVals) ) allocate( newTree%pathList (loc_treeID%nVals) ) newTree%treeID = loc_treeID%val newTree%nElems = loc_treeID%nVals newTree%global = tree%global ! Now dump the mesh to disk !KJ: This needs to be re-thought as where and when to do it call MPI_ALLREDUCE( loc_treeID%nVals, newTree%global%nElems, 1, MPI_INTEGER, & & MPI_SUM, proc%comm, iErr ) call dump_treelmesh( me = newTree ) end subroutine tem_adapt_dump_newMesh