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)
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);
#define forAll(list, i)
Loop across all elements in list.
const labelList & reversePointMap() const
Reverse point map.
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 face.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable
A face is a list of labels corresponding to mesh vertices.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
virtual const labelList & faceNeighbour() const
Return face neighbour.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label nextLabel(const label i) const
Next vertex on face.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
HashTable< T, label, Hash< label > >::const_iterator const_iterator
Class containing data for point addition.
void transfer(HashTable< T, Key, Hash > &)
Transfer the contents of the argument table into this table.
label size() const
Return number of elements in table.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
boundaryCutter(const polyMesh &mesh)
Construct from mesh.
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.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
An STL-conforming iterator.
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
An ordered pair of two objects of type <T> with first() and second() elements.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
bool found(const label &) const
Return true if hashedEntry is found in table.
void clear()
Clear all entries from table.
virtual const labelList & faceOwner() const
Return face owner.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
List< label > labelList
A List of labels.
iterator begin()
Iterator set to the beginning of the HashTable.
virtual const faceList & faces() const
Return raw faces.
An STL-conforming hash table.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
errorManip< error > abort(error &err)
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
Class describing modification of a point.
defineTypeNameAndDebug(combustionModel, 0)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
const vectorField & faceCentres() const
void setSize(const label)
Reset size of List.
~boundaryCutter()
Destructor.
label end() const
Return end vertex label.
prefixOSstream Pout(cout, "Pout")
Direct mesh changes based on v1.3 polyTopoChange syntax.
Hash function class for primitives. All non-primitives used to hash entries on hash tables likely nee...
void resize(const label newSize)
Resize the hash table for efficiency.
const doubleScalar e
Elementary charge.
Mesh consisting of general polyhedral cells.
const labelListList & edgeFaces() const
label start() const
Return start vertex label.
const labelList & reverseFaceMap() const
Reverse face map.
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
A HashTable to objects of type <T> with a label key.
label setAction(const topoAction &action)
For compatibility with polyTopoChange: set topological action.