50void Foam::boundaryCutter::getFaceInfo
73 zoneFlip = fZone.flipMap()[fZone.whichFace(facei)];
80Foam::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);
103 const auto fnd = edgeToAddedPoints.cfind(edgeI);
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;
143void Foam::boundaryCutter::addFace
149 polyTopoChange& meshMod
155 label own = mesh_.faceOwner()[facei];
156 label masterPoint = mesh_.faces()[facei][0];
202bool 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);
232 const auto fnd = edgeToAddedPoints.cfind(edgeI);
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;
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);
408 edgeAddedPoints_.clear();
410 faceAddedPoint_.clear();
411 faceAddedPoint_.resize(faceToFeaturePoint.
size());
444 const label edgeI = iter.key();
447 const edge&
e = mesh_.edges()[edgeI];
454 const point& featurePoint = cuts[cutI];
468 auto fnd = edgeToAddedPoints.
find(edgeI);
474 label sz = addedPoints.
size();
476 addedPoints[sz] = addedPointi;
485 Pout<<
"Added point " << addedPointi <<
" for edge " << edgeI
486 <<
" with cuts:" << edgeToAddedPoints[edgeI] <<
endl;
498 const label facei = iter.key();
500 const face&
f = mesh_.faces()[facei];
502 if (faceToSplit.
found(facei))
505 <<
"Face " << facei <<
" vertices " <<
f
506 <<
" is both marked for face-centre decomposition and"
507 <<
" diagonal splitting."
511 if (mesh_.isInternalFace(facei))
514 <<
"Face " << facei <<
" vertices " <<
f
515 <<
" is not an external face. Cannot split it"
531 faceAddedPoint_.insert(facei, addedPointi);
535 Pout<<
"Added point " << addedPointi <<
" for feature point "
536 << iter.val() <<
" on face " << facei <<
" with centre "
537 << mesh_.faceCentres()[facei] <<
endl;
549 boolList faceUptodate(mesh_.nFaces(),
false);
555 const label facei = iter.key();
556 const label addedPointi = iter.val();
559 face newFace(addEdgeCutsToFace(facei, edgeToAddedPoints));
564 label own = mesh_.faceOwner()[facei];
565 label masterPoint = mesh_.faces()[facei][0];
575 tri[0] = newFace[fp];
577 tri[2] = addedPointi;
620 faceUptodate[facei] =
true;
627 const label facei = iter.key();
629 const face&
f = mesh_.faces()[facei];
631 if (faceAddedPoint_.found(facei))
634 <<
"Face " << facei <<
" vertices " <<
f
635 <<
" is both marked for face-centre decomposition and"
636 <<
" diagonal splitting."
642 face newFace(addEdgeCutsToFace(facei, edgeToAddedPoints));
647 label own = mesh_.faceOwner()[facei];
648 label masterPoint = mesh_.faces()[facei][0];
656 if (fp0 == -1 || fp1 == -1 || fp0 == fp1)
659 <<
"Problem : Face " << facei <<
" vertices " <<
f
660 <<
" newFace:" << newFace <<
" diagonal:" <<
f[
diag[0]]
675 newVerts.
append(newFace[fp]);
677 fp = (fp == newFace.
size()-1 ? 0 : fp+1);
681 newVerts.
append(newFace[fp1]);
708 newVerts.
append(newFace[fp]);
710 fp = (fp == newFace.
size()-1 ? 0 : fp+1);
714 newVerts.
append(newFace[fp0]);
734 faceUptodate[facei] =
true;
742 const label edgeI = iter.key();
744 const labelList& eFaces = mesh_.edgeFaces()[edgeI];
748 label facei = eFaces[i];
750 if (!faceUptodate[facei] && !mesh_.isInternalFace(facei))
753 if (splitFace(facei, pointToPos, edgeToAddedPoints, meshMod))
756 faceUptodate[facei] =
true;
768 const label edgeI = iter.key();
770 const labelList& eFaces = mesh_.edgeFaces()[edgeI];
774 label facei = eFaces[i];
776 if (!faceUptodate[facei])
779 face newFace(addEdgeCutsToFace(facei, edgeToAddedPoints));
781 const label own = mesh_.faceOwner()[facei];
785 if (mesh_.isInternalFace(facei))
787 nei = mesh_.faceNeighbour()[facei];
809 faceUptodate[facei] =
true;
816 edgeAddedPoints_.
resize(edgeToCuts.size());
820 edgeAddedPoints_.insert(mesh_.edges()[iter.key()], iter.val());
835 Map<label> newAddedPoints(faceAddedPoint_.size());
839 const label oldFacei = iter.key();
840 const label oldPointi = iter.val();
852 faceAddedPoint_.transfer(newAddedPoints);
867 const edge&
e = iter.key();
868 const labelList& addedPoints = iter.val();
873 if (newStart >= 0 && newEnd >= 0)
880 label newAddedPointi =
883 if (newAddedPointi >= 0)
885 newAddedPoints[newI++] = newAddedPointi;
894 newEdgeAddedPoints.
insert(newE, newAddedPoints);
900 edgeAddedPoints_.transfer(newEdgeAddedPoints);
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
DynamicList< T, SizeMin > & shrink()
Shrink the allocated space to the number of elements used.
void append(const T &val)
Copy append an element to the end of this list.
Map from edge (expressed as its endpoints) to value. For easier forward declaration it is currently i...
bool found(const Key &key) const
Return true if hashed entry is found in table.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
label size() const noexcept
The number of elements in table.
iterator find(const Key &key)
Find and return an iterator set at the hashed entry.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void setSize(const label n)
Alias for resize()
void resize(const label len)
Adjust allocated size of list.
A HashTable to objects of type <T> with a label key.
iterator end() noexcept
Return an iterator to end traversing the UList.
label find(const T &val, label pos=0) const
Find index of the first occurrence of the value.
void size(const label n)
Older name for setAddressableSize.
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
Does modifications to boundary faces.
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.
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.
void updateMesh()
Update for new mesh topology.
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 faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Class describing modification of a face.
Class describing modification of a point.
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 noexcept
Return true if given face label is internal to the mesh.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const labelIOList & zoneID
List< label > labelList
A List of labels.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
List< edge > edgeList
A List of edges.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.