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();
119 <<
"Problem: null pointer on liveSplitCells list" 123 label celli = splitPtr->cellLabel();
125 if (celli != map[celli])
140 Map<splitCell*> newLiveSplitCells(2*liveSplitCells.size());
142 forAllIter(Map<splitCell*>, liveSplitCells, iter)
144 splitCell* splitPtr = iter();
146 label celli = splitPtr->cellLabel();
148 label newCelli = map[celli];
150 if (debug && (celli != newCelli))
152 Pout<<
"undoableMeshCutter::updateLabels :" 153 <<
" Updating live (split)cell from " << celli
154 <<
" to " << newCelli <<
endl;
161 splitPtr->cellLabel() = newCelli;
164 newLiveSplitCells.insert(newCelli, splitPtr);
167 liveSplitCells = newLiveSplitCells;
183 liveSplitCells_(mesh.
nCells()/100 + 100),
212 otherSidePtr->
parent() =
nullptr;
214 splitPtr->
parent() =
nullptr;
220 splitPtr = parentPtr;
242 label celli = iter.key();
244 label addedCelli = iter();
251 liveSplitCells_.find(celli);
253 if (findCell == liveSplitCells_.end())
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_.topoChange(map);
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" 509 (ownFind == liveSplitCells_.end())
510 || (nbrFind == liveSplitCells_.end())
530 Pout<<
"Updating for removed splitFace " << facei
531 <<
" own:" << own <<
" nbr:" << nbr
539 <<
"No parent for owner " << ownPtr->
cellLabel()
546 <<
"No parent for neighbour " << nbrPtr->
cellLabel()
550 if (parentPtr != nbrPtr->
parent())
553 <<
"Owner and neighbour liveSplitCell entries do not have" 554 <<
" same parent. facei:" << facei <<
" owner:" << own
555 <<
" ownparent:" << parentPtr->
cellLabel()
556 <<
" neighbour:" << nbr
570 <<
"Owner and neighbour liveSplitCell entries are" 571 <<
" refined themselves or the parent is not refined" 574 <<
" neighbour unrefined:" << nbrPtr->
isUnrefined()
575 <<
" master unrefined:" << parentPtr->
isUnrefined()
580 liveSplitCells_.erase(ownFind);
583 liveSplitCells_.erase(liveSplitCells_.find(nbr));
603 liveSplitCells_.insert(own, parentPtr);
616 faceRemover().setRefinement
624 return facesToRemove;
#define forAll(list, i)
Loop across all elements in list.
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
bool isMaster() const
Check if this is master cell of split.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
~undoableMeshCutter()
Destructor.
virtual const labelList & faceNeighbour() const
Return face neighbour.
splitCell * getOther() const
Returns other half of split cell. I.e. slave if this is master.
Unit conversion functions.
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Description of cuts across cells.
scalar degToRad(const scalar deg)
Conversion from degrees to radians.
undoableMeshCutter(const polyMesh &mesh, const bool undoable=true)
Construct from mesh and flag whether refinement pattern needs.
splitCell * slave() const
An STL-conforming iterator.
dimensionedScalar cos(const dimensionedScalar &ds)
bool isUnrefined() const
Check if this is unrefined (i.e. has no master or slave)
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
splitCell * parent() const
Description of cell after splitting. Contains cellLabel and pointers to cells it it split in...
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
virtual const labelList & faceOwner() const
Return face owner.
void setRefinement(const cellCuts &cuts, polyTopoChange &)
Refine cells acc. to cellCuts. Plays topology changes.
Map< label > getAddedCells() const
Like getSplitFaces but returns map from original to added cell.
List< label > labelList
A List of labels.
errorManip< error > abort(error &err)
void setRefinement(const cellCuts &cuts, polyTopoChange &meshMod)
Do actual cutting with cut description. Inserts mesh changes.
defineTypeNameAndDebug(combustionModel, 0)
const labelList & reverseCellMap() const
Reverse cell map.
splitCell * master() const
labelList removeSplitFaces(const labelList &splitFaces, polyTopoChange &)
Remove some refinement. Needs to be supplied subset of.
prefixOSstream Pout(cout, "Pout")
Direct mesh changes based on v1.3 polyTopoChange syntax.
void topoChange(const polyTopoChangeMap &)
Force recalculation of locally stored data on topological change.
Mesh consisting of general polyhedral cells.
labelList getSplitFaces() const
Calculate split faces from current liveCells. Only.
void topoChange(const polyTopoChangeMap &map)
Update stored refinement pattern for changes to mesh. Only.
A HashTable to objects of type <T> with a label key.