48 void Foam::undoableMeshCutter::printCellRefTree
52 const splitCell* splitCellPtr
57 os << indent << splitCellPtr->cellLabel() <<
endl;
59 word subIndent = indent +
"--";
61 printCellRefTree(os, subIndent, splitCellPtr->master());
63 printCellRefTree(os, subIndent, splitCellPtr->slave());
69 void Foam::undoableMeshCutter::printRefTree(Ostream& os)
const 73 const splitCell* splitPtr = iter();
76 while (splitPtr->parent())
78 if (!splitPtr->isMaster())
86 splitPtr = splitPtr->parent();
94 printCellRefTree(os, word(
""), splitPtr);
102 void Foam::undoableMeshCutter::updateLabels
105 Map<splitCell*>& liveSplitCells
110 bool changed =
false;
114 const splitCell* splitPtr = iter();
120 "undoableMeshCutter::updateLabels" 121 "(const labelList&, Map<splitCell*>&)" 122 ) <<
"Problem: null pointer on liveSplitCells list" 126 label cellI = splitPtr->cellLabel();
128 if (cellI != map[cellI])
143 Map<splitCell*> newLiveSplitCells(2*liveSplitCells.size());
145 forAllIter(Map<splitCell*>, liveSplitCells, iter)
147 splitCell* splitPtr = iter();
149 label cellI = splitPtr->cellLabel();
151 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
186 liveSplitCells_(mesh.
nCells()/100 + 100),
215 otherSidePtr->
parent() = NULL;
217 splitPtr->
parent() = NULL;
223 splitPtr = parentPtr;
245 label cellI = iter.key();
247 label addedCellI = iter();
254 liveSplitCells_.find(cellI);
256 if (findCell == liveSplitCells_.end())
271 parentPtr->
master() = masterPtr;
272 parentPtr->
slave() = slavePtr;
276 if (liveSplitCells_.found(addedCellI))
279 <<
"problem addedCell:" << addedCellI
283 liveSplitCells_.insert(cellI, masterPtr);
284 liveSplitCells_.insert(addedCellI, slavePtr);
292 liveSplitCells_.erase(findCell);
300 parentPtr->
master() = masterPtr;
301 parentPtr->
slave() = slavePtr;
305 if (liveSplitCells_.found(addedCellI))
308 <<
"problem addedCell:" << addedCellI
312 liveSplitCells_.insert(cellI, masterPtr);
313 liveSplitCells_.insert(addedCellI, slavePtr);
319 Pout<<
"** After refinement: liveSplitCells_:" <<
endl;
335 faceRemover_.updateMesh(morphMap);
350 <<
"Only call if constructed with unrefinement capability" 363 <<
"Live split cell without parent" <<
endl 375 liveSplitCells_.found(slavePtr->
cellLabel())
395 liveSplitFaces.append(commonFaceI);
400 return liveSplitFaces.shrink();
411 <<
"Only call if constructed with unrefinement capability" 415 Map<label> addedCells(liveSplitCells_.size());
424 <<
"Live split cell without parent" <<
endl 436 liveSplitCells_.found(slavePtr->
cellLabel())
458 FatalErrorIn(
"undoableMeshCutter::removeSplitFaces(const labelList&)")
459 <<
"Only call if constructed with unrefinement capability" 469 faceRemover().compatibleRemoves
477 if (facesToRemove.
size() != splitFaces.
size())
479 Pout<<
"cellRegion:" << cellRegion <<
endl;
480 Pout<<
"cellRegionMaster:" << cellRegionMaster <<
endl;
484 "undoableMeshCutter::removeSplitFaces(const labelList&)" 485 ) <<
"Faces to remove:" << splitFaces << endl
486 <<
"to be removed:" << facesToRemove
493 forAll(facesToRemove, facesToRemoveI)
495 label faceI = facesToRemove[facesToRemoveI];
497 if (!
mesh().isInternalFace(faceI))
501 "undoableMeshCutter::removeSplitFaces(const labelList&)" 502 ) <<
"Trying to remove face that is not internal" 516 (ownFind == liveSplitCells_.end())
517 || (nbrFind == liveSplitCells_.end())
537 Pout<<
"Updating for removed splitFace " << faceI
538 <<
" own:" << own <<
" nbr:" << nbr
547 "undoableMeshCutter::removeSplitFaces(const labelList&)" 548 ) <<
"No parent for owner " << ownPtr->
cellLabel()
556 "undoableMeshCutter::removeSplitFaces(const labelList&)" 557 ) <<
"No parent for neighbour " << nbrPtr->
cellLabel()
561 if (parentPtr != nbrPtr->
parent())
565 "undoableMeshCutter::removeSplitFaces(const labelList&)" 566 ) <<
"Owner and neighbour liveSplitCell entries do not have" 567 <<
" same parent. faceI:" << faceI <<
" owner:" << own
568 <<
" ownparent:" << parentPtr->
cellLabel()
569 <<
" neighbour:" << nbr
584 "undoableMeshCutter::removeSplitFaces(const labelList&)" 585 ) <<
"Owner and neighbour liveSplitCell entries are" 586 <<
" refined themselves or the parent is not refined" 589 <<
" neighbour unrefined:" << nbrPtr->
isUnrefined()
590 <<
" master unrefined:" << parentPtr->
isUnrefined()
595 liveSplitCells_.erase(ownFind);
598 liveSplitCells_.erase(liveSplitCells_.find(nbr));
618 liveSplitCells_.insert(own, parentPtr);
631 faceRemover().setRefinement
639 return facesToRemove;
Description of cell after splitting. Contains cellLabel and pointers to cells it it split in...
void updateMesh(const mapPolyMesh &morphMap)
Update stored refinement pattern for changes to mesh. Only.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
label getSharedFace(const primitiveMesh &, const label cell0, const label cell1)
Return face shared by two cells. Throws error if none found.
An STL-conforming iterator.
A HashTable to objects of type <T> with a label key.
#define forAllIter(Container, container, iter)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void setRefinement(const cellCuts &cuts, polyTopoChange &)
Refine cells acc. to cellCuts. Plays topology changes.
void size(const label)
Override size to be inconsistent with allocated storage.
splitCell * master() const
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
splitCell * slave() const
Ostream & endl(Ostream &os)
Add newline and flush stream.
~undoableMeshCutter()
Destructor.
bool isUnrefined() const
Check if this is unrefined (i.e. has no master or slave)
splitCell * getOther() const
Returns other half of split cell. I.e. slave if this is master.
labelList getSplitFaces() const
Calculate split faces from current liveCells. Only.
dimensionedScalar cos(const dimensionedScalar &ds)
splitCell * parent() const
Unit conversion functions.
errorManip< error > abort(error &err)
virtual const labelList & faceOwner() const
Return face owner.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Mesh consisting of general polyhedral cells.
List< label > labelList
A List of labels.
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
bool isMaster() const
Check if this is master cell of split.
const labelList & reverseCellMap() const
Reverse cell map.
Direct mesh changes based on v1.3 polyTopoChange syntax.
virtual const labelList & faceNeighbour() const
Return face neighbour.
Map< label > getAddedCells() const
Like getSplitFaces but returns map from original to added cell.
void setRefinement(const cellCuts &cuts, polyTopoChange &meshMod)
Do actual cutting with cut description. Inserts mesh changes.
defineTypeNameAndDebug(combustionModel, 0)
labelList removeSplitFaces(const labelList &splitFaces, polyTopoChange &)
Remove some refinement. Needs to be supplied subset of.
prefixOSstream Pout(cout,"Pout")
Description of cuts across cells.