51 void Foam::undoableMeshCutter::printCellRefTree
55 const splitCell* splitCellPtr
60 os <<
indent << splitCellPtr->cellLabel() <<
endl;
62 word subIndent =
indent +
"--";
64 printCellRefTree(os, subIndent, splitCellPtr->master());
66 printCellRefTree(os, subIndent, splitCellPtr->slave());
72 void Foam::undoableMeshCutter::printRefTree(Ostream& os)
const
76 const splitCell* splitPtr = iter.val();
79 while (splitPtr->parent())
81 if (!splitPtr->isMaster())
89 splitPtr = splitPtr->parent();
97 printCellRefTree(os, word(
""), splitPtr);
105 void Foam::undoableMeshCutter::updateLabels
108 Map<splitCell*>& liveSplitCells
113 bool changed =
false;
117 const splitCell* splitPtr = iter.val();
122 <<
"Problem: null pointer on liveSplitCells list"
126 label celli = splitPtr->cellLabel();
128 if (celli != map[celli])
143 Map<splitCell*> newLiveSplitCells(2*liveSplitCells.size());
147 splitCell* splitPtr = iter.val();
149 const label celli = splitPtr->cellLabel();
151 const label newCelli = map[celli];
153 if (
debug && (celli != newCelli))
155 Pout<<
"undoableMeshCutter::updateLabels :"
156 <<
" Updating live (split)cell from " << celli
157 <<
" to " << newCelli <<
endl;
164 splitPtr->cellLabel() = newCelli;
167 newLiveSplitCells.insert(newCelli, splitPtr);
170 liveSplitCells = newLiveSplitCells;
178 Foam::undoableMeshCutter::undoableMeshCutter
215 otherSidePtr->
parent() =
nullptr;
217 splitPtr->
parent() =
nullptr;
223 splitPtr = parentPtr;
245 const label celli = iter.key();
246 const label addedCelli = iter.val();
251 auto findCell = liveSplitCells_.find(celli);
253 if (!findCell.found())
268 parentPtr->
master() = masterPtr;
269 parentPtr->
slave() = slavePtr;
273 if (liveSplitCells_.found(addedCelli))
276 <<
"problem addedCell:" << addedCelli
280 liveSplitCells_.insert(celli, masterPtr);
281 liveSplitCells_.insert(addedCelli, slavePtr);
289 liveSplitCells_.erase(findCell);
297 parentPtr->
master() = masterPtr;
298 parentPtr->
slave() = slavePtr;
302 if (liveSplitCells_.found(addedCelli))
305 <<
"problem addedCell:" << addedCelli
309 liveSplitCells_.insert(celli, masterPtr);
310 liveSplitCells_.insert(addedCelli, slavePtr);
316 Pout<<
"** After refinement: liveSplitCells_:" <<
endl;
332 faceRemover_.updateMesh(morphMap);
347 <<
"Only call if constructed with unrefinement capability"
360 <<
"Live split cell without parent" <<
endl
372 liveSplitCells_.found(slavePtr->
cellLabel())
392 liveSplitFaces.append(commonFacei);
397 return liveSplitFaces.shrink();
408 <<
"Only call if constructed with unrefinement capability"
412 Map<label> addedCells(liveSplitCells_.size());
421 <<
"Live split cell without parent" <<
endl
433 liveSplitCells_.found(slavePtr->
cellLabel())
456 <<
"Only call if constructed with unrefinement capability"
466 faceRemover().compatibleRemoves
474 if (facesToRemove.size() != splitFaces.size())
476 Pout<<
"cellRegion:" << cellRegion <<
endl;
477 Pout<<
"cellRegionMaster:" << cellRegionMaster <<
endl;
480 <<
"Faces to remove:" << splitFaces <<
endl
481 <<
"to be removed:" << facesToRemove
488 forAll(facesToRemove, facesToRemoveI)
490 label facei = facesToRemove[facesToRemoveI];
492 if (!
mesh().isInternalFace(facei))
495 <<
"Trying to remove face that is not internal"
502 auto ownFind = liveSplitCells_.find(own);
503 auto nbrFind = liveSplitCells_.find(nbr);
505 if (ownFind.found() && nbrFind.found())
519 Pout<<
"Updating for removed splitFace " << facei
520 <<
" own:" << own <<
" nbr:" << nbr
528 <<
"No parent for owner " << ownPtr->
cellLabel()
535 <<
"No parent for neighbour " << nbrPtr->
cellLabel()
539 if (parentPtr != nbrPtr->
parent())
542 <<
"Owner and neighbour liveSplitCell entries do not have"
543 <<
" same parent. facei:" << facei <<
" owner:" << own
544 <<
" ownparent:" << parentPtr->
cellLabel()
545 <<
" neighbour:" << nbr
559 <<
"Owner and neighbour liveSplitCell entries are"
560 <<
" refined themselves or the parent is not refined"
563 <<
" neighbour unrefined:" << nbrPtr->
isUnrefined()
564 <<
" master unrefined:" << parentPtr->
isUnrefined()
569 liveSplitCells_.erase(ownFind);
572 liveSplitCells_.erase(liveSplitCells_.find(nbr));
591 liveSplitCells_.insert(own, parentPtr);
604 faceRemover().setRefinement
612 return facesToRemove;