50 void Foam::boundaryCutter::getFaceInfo
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();
453 const edge&
e = mesh_.edges()[edgeI];
461 const point& featurePoint = cuts[cutI];
477 if (fnd != edgeToAddedPoints.
end())
483 addedPoints[sz] = addedPointi;
492 Pout<<
"Added point " << addedPointi <<
" for edge " << edgeI
493 <<
" with cuts:" << edgeToAddedPoints[edgeI] <<
endl;
505 label facei = iter.key();
507 const face&
f = mesh_.faces()[facei];
509 if (faceToSplit.
found(facei))
512 <<
"Face " << facei <<
" vertices " <<
f
513 <<
" is both marked for face-centre decomposition and"
514 <<
" diagonal splitting."
518 if (mesh_.isInternalFace(facei))
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 "
543 << mesh_.faceCentres()[facei] <<
endl;
555 boolList faceUptodate(mesh_.nFaces(),
false);
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);
571 label own = mesh_.faceOwner()[facei];
572 label masterPoint = mesh_.faces()[facei][0];
582 tri[0] = newFace[fp];
584 tri[2] = addedPointi;
627 faceUptodate[facei] =
true;
634 label facei = iter.key();
636 const face&
f = mesh_.faces()[facei];
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);
654 label own = mesh_.faceOwner()[facei];
655 label masterPoint = mesh_.faces()[facei][0];
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]);
715 newVerts.
append(newFace[fp]);
717 fp = (fp == newFace.
size()-1 ? 0 : fp+1);
721 newVerts.
append(newFace[fp0]);
741 faceUptodate[facei] =
true;
749 label edgeI = iter.key();
751 const labelList& eFaces = mesh_.edgeFaces()[edgeI];
755 label facei = eFaces[i];
757 if (!faceUptodate[facei] && !mesh_.isInternalFace(facei))
760 if (splitFace(facei, pointToPos, edgeToAddedPoints, meshMod))
763 faceUptodate[facei] =
true;
775 label edgeI = iter.key();
777 const labelList& eFaces = mesh_.edgeFaces()[edgeI];
781 label facei = eFaces[i];
783 if (!faceUptodate[facei])
786 face newFace(addEdgeCutsToFace(facei, edgeToAddedPoints));
788 label own = mesh_.faceOwner()[facei];
792 if (mesh_.isInternalFace(facei))
794 nei = mesh_.faceNeighbour()[facei];
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());
842 Map<label> newAddedPoints(faceAddedPoint_.size());
846 label oldFacei = iter.key();
850 label oldPointi = iter();
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.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
void clear()
Clear the addressed list, i.e. set the size to zero.
An STL-conforming iterator.
An STL-conforming hash table.
label size() const
Return number of elements in table.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
bool found(const Key &) const
Return true if hashedEntry is found in table.
Hash function class for primitives. All non-primitives used to hash entries on hash tables likely nee...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void resize(const label)
Alias for setSize(const label)
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
A HashTable to objects of type <T> with a label key.
HashTable< T, label, Hash< label > >::const_iterator const_iterator
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
Does modifications to boundary faces.
void topoChange(const polyTopoChangeMap &)
Force recalculation of locally stored data on topological change.
~boundaryCutter()
Destructor.
boundaryCutter(const polyMesh &mesh)
Construct from mesh.
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.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
A face is a list of labels corresponding to mesh vertices.
label nextLabel(const label i) const
Next vertex on face.
A face addition data class. A face can be inflated either from a point or from another face and can e...
Class containing data for point addition.
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
Mesh consisting of general polyhedral cells.
const meshFaceZones & faceZones() const
Return face zones.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Class describing modification of a face.
Class describing modification of a point.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const labelList & reversePointMap() const
Reverse point map.
const labelList & reverseFaceMap() const
Reverse face map.
Direct mesh changes based on v1.3 polyTopoChange syntax.
label setAction(const topoAction &action)
For compatibility with polyTopoChange: set topological action.
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
defineTypeNameAndDebug(combustionModel, 0)
prefixOSstream Pout(cout, "Pout")
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
static iteratorEnd end()
iteratorEnd set to beyond the end of any HashTable