50 void Foam::boundaryCutter::getFaceInfo
60 if (!mesh_.isInternalFace(faceI))
62 patchID = mesh_.boundaryMesh().whichPatch(faceI);
65 zoneID = mesh_.faceZones().whichZone(faceI);
71 const faceZone& fZone = mesh_.faceZones()[zoneID];
73 zoneFlip = fZone.flipMap()[fZone.whichFace(faceI)];
80 Foam::face Foam::boundaryCutter::addEdgeCutsToFace
83 const Map<labelList>& edgeToAddedPoints
86 const edgeList& edges = mesh_.edges();
87 const face& f = mesh_.faces()[faceI];
88 const labelList& fEdges = mesh_.faceEdges()[faceI];
91 DynamicList<label> newFace(2 * f.size());
96 newFace.append(f[fp]);
99 label v1 = f.nextLabel(fp);
105 if (fnd != edgeToAddedPoints.end())
110 if (edges[edgeI].start() == f[fp])
115 newFace.append(addedPoints[i]);
123 newFace.append(addedPoints[i]);
130 returnFace.transfer(newFace);
134 Pout<<
"addEdgeCutsToFace:" <<
nl 135 <<
" from : " << f <<
nl 136 <<
" to : " << returnFace <<
endl;
143 void Foam::boundaryCutter::addFace
149 polyTopoChange& meshMod
153 label patchID, zoneID, zoneFlip;
154 getFaceInfo(faceI, patchID, zoneID, zoneFlip);
155 label own = mesh_.faceOwner()[faceI];
156 label masterPoint = mesh_.faces()[faceI][0];
202 bool Foam::boundaryCutter::splitFace
205 const Map<point>& pointToPos,
206 const Map<labelList>& edgeToAddedPoints,
207 polyTopoChange& meshMod
210 const edgeList& edges = mesh_.edges();
211 const face& f = mesh_.faces()[faceI];
212 const labelList& fEdges = mesh_.faceEdges()[faceI];
215 label nSplitEdges = 0;
216 label nModPoints = 0;
217 label nTotalSplits = 0;
221 if (pointToPos.found(f[fp]))
228 label nextV = f.nextLabel(fp);
234 if (fnd != edgeToAddedPoints.end())
237 nTotalSplits += fnd().size();
243 Pout<<
"Face:" << faceI
244 <<
" nModPoints:" << nModPoints
245 <<
" nSplitEdges:" << nSplitEdges
246 <<
" nTotalSplits:" << nTotalSplits <<
endl;
249 if (nSplitEdges == 0 && nModPoints == 0)
251 FatalErrorIn(
"boundaryCutter::splitFace") <<
"Problem : face:" << faceI
252 <<
" nSplitEdges:" << nSplitEdges
253 <<
" nTotalSplits:" << nTotalSplits
257 else if (nSplitEdges + nModPoints == 1)
261 Warning <<
"Face " << faceI <<
" has only one edge cut " <<
endl;
272 label patchID, zoneID, zoneFlip;
273 getFaceInfo(faceI, patchID, zoneID, zoneFlip);
276 face extendedFace(addEdgeCutsToFace(faceI, edgeToAddedPoints));
283 if (extendedFace[fp] >= mesh_.nPoints())
295 if (pointToPos.found(extendedFace[fp]))
311 bool modifiedFace =
false;
335 DynamicList<label> newFace(extendedFace.size());
341 label pointI = extendedFace[fp];
343 newFace.append(pointI);
349 pointI >= mesh_.nPoints()
350 || pointToPos.found(pointI)
356 tmpFace.transfer(newFace);
359 addFace(faceI, tmpFace, modifiedFace, meshMod);
362 newFace.append(extendedFace[startFp]);
363 newFace.append(extendedFace[fp]);
366 fp = (fp+1) % extendedFace.size();
370 if (newFace.size() > 2)
374 tmpFace.transfer(newFace);
377 addFace(faceI, tmpFace, modifiedFace, meshMod);
415 edgeAddedPoints_.
clear();
417 faceAddedPoint_.
clear();
418 faceAddedPoint_.
resize(faceToFeaturePoint.
size());
451 label edgeI = iter.key();
461 const point& featurePoint = cuts[cutI];
477 if (fnd != edgeToAddedPoints.end())
483 addedPoints[sz] = addedPointI;
487 edgeToAddedPoints.insert(edgeI,
labelList(1, addedPointI));
492 Pout<<
"Added point " << addedPointI <<
" for edge " << edgeI
493 <<
" with cuts:" << edgeToAddedPoints[edgeI] <<
endl;
505 label faceI = iter.key();
509 if (faceToSplit.
found(faceI))
512 <<
"Face " << faceI <<
" vertices " << f
513 <<
" is both marked for face-centre decomposition and" 514 <<
" diagonal splitting." 521 <<
"Face " << faceI <<
" vertices " << f
522 <<
" is not an external face. Cannot split it" 537 faceAddedPoint_.
insert(faceI, addedPointI);
541 Pout<<
"Added point " << addedPointI <<
" for feature point " 542 << iter() <<
" on face " << faceI <<
" with centre " 561 label faceI = iter.key();
564 face newFace(addEdgeCutsToFace(faceI, edgeToAddedPoints));
566 label addedPointI = iter();
569 label patchID, zoneID, zoneFlip;
570 getFaceInfo(faceI, patchID, zoneID, zoneFlip);
582 tri[0] = newFace[fp];
584 tri[2] = addedPointI;
627 faceUptodate[faceI] =
true;
634 label faceI = iter.key();
638 if (faceAddedPoint_.
found(faceI))
641 <<
"Face " << faceI <<
" vertices " << f
642 <<
" is both marked for face-centre decomposition and" 643 <<
" diagonal splitting." 649 face newFace(addEdgeCutsToFace(faceI, edgeToAddedPoints));
652 label patchID, zoneID, zoneFlip;
653 getFaceInfo(faceI, patchID, zoneID, zoneFlip);
663 if (fp0 == -1 || fp1 == -1 || fp0 == fp1)
666 <<
"Problem : Face " << faceI <<
" vertices " << f
667 <<
" newFace:" << newFace <<
" diagonal:" << f[diag[0]]
682 newVerts.
append(newFace[fp]);
684 fp = (fp == newFace.
size()-1 ? 0 : fp+1);
688 newVerts.append(newFace[fp1]);
696 face(newVerts.shrink()),
715 newVerts.append(newFace[fp]);
717 fp = (fp == newFace.
size()-1 ? 0 : fp+1);
721 newVerts.append(newFace[fp0]);
728 face(newVerts.shrink()),
741 faceUptodate[faceI] =
true;
749 label edgeI = iter.key();
755 label faceI = eFaces[i];
760 if (splitFace(faceI, pointToPos, edgeToAddedPoints, meshMod))
763 faceUptodate[faceI] =
true;
775 label edgeI = iter.key();
781 label faceI = eFaces[i];
783 if (!faceUptodate[faceI])
786 face newFace(addEdgeCutsToFace(faceI, edgeToAddedPoints));
797 label patchID, zoneID, zoneFlip;
798 getFaceInfo(faceI, patchID, zoneID, zoneFlip);
816 faceUptodate[faceI] =
true;
823 edgeAddedPoints_.
resize(edgeToCuts.size());
827 edgeAddedPoints_.
insert(mesh_.
edges()[iter.key()], iter());
846 label oldFaceI = iter.key();
850 label oldPointI = iter();
854 if (newFaceI >= 0 && newPointI >= 0)
856 newAddedPoints.insert(newFaceI, newPointI);
861 faceAddedPoint_.
transfer(newAddedPoints);
873 newEdgeAddedPoints(edgeAddedPoints_.
size());
878 edgeAddedPoints_.
begin();
879 iter != edgeAddedPoints_.
end();
883 const edge&
e = iter.key();
889 if (newStart >= 0 && newEnd >= 0)
898 label newAddedPointI =
901 if (newAddedPointI >= 0)
903 newAddedPoints[newI++] = newAddedPointI;
912 newEdgeAddedPoints.insert(newE, newAddedPoints);
918 edgeAddedPoints_.
transfer(newEdgeAddedPoints);
label setAction(const topoAction &action)
For compatibility with polyTopoChange: set topological action.
A face addition data class. A face can be inflated either from a point or from another face and can e...
void setRefinement(const Map< point > &pointToPos, const Map< List< point > > &edgeToCuts, const Map< labelPair > &faceToSplit, const Map< point > &faceToFeaturePoint, polyTopoChange &meshMod)
Do actual cutting with cut description. Inserts mesh changes.
const labelList & reverseFaceMap() const
Reverse face map.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
An ordered pair of two objects of type <T> with first() and second() elements.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const labelList & reversePointMap() const
Reverse point map.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
An STL-conforming iterator.
An STL-conforming hash table.
A HashTable to objects of type <T> with a label key.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Class describing modification of a point.
void resize(const label newSize)
Resize the hash table for efficiency.
void size(const label)
Override size to be inconsistent with allocated storage.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
label nextLabel(const label i) const
Next vertex on face.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A face is a list of labels corresponding to mesh vertices.
Hash function class for primitives. All non-primitives used to hash entries on hash tables likely nee...
const double e
Elementary charge.
~boundaryCutter()
Destructor.
void setSize(const label)
Reset size of List.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void clear()
Clear all entries from table.
Class describing modification of a face.
label size() const
Return number of elements in table.
errorManip< error > abort(error &err)
virtual const labelList & faceOwner() const
Return face owner.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
#define forAllReverse(list, i)
Mesh consisting of general polyhedral cells.
const labelListList & edgeFaces() const
label end() const
Return end vertex label.
List< label > labelList
A List of labels.
void transfer(HashTable< T, Key, Hash > &)
Transfer the contents of the argument table into this table.
Direct mesh changes based on v1.3 polyTopoChange syntax.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
label start() const
Return start vertex label.
Class containing data for point addition.
virtual const faceList & faces() const
Return raw faces.
iterator begin()
Iterator set to the beginning of the HashTable.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
label findEdge(const edgeList &edges, const labelList &candidates, const label v0, const label v1)
Return edge among candidates that uses the two vertices.
virtual const labelList & faceNeighbour() const
Return face neighbour.
HashTable< T, label, Hash< label > >::const_iterator const_iterator
bool found(const label &) const
Return true if hashedEntry is found in table.
defineTypeNameAndDebug(combustionModel, 0)
prefixOSstream Pout(cout,"Pout")
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
const vectorField & faceCentres() const