Go to the documentation of this file.
84 cuts[cuts.fcIndex(index)] == twoCuts[1]
85 || cuts[cuts.rcIndex(index)] == twoCuts[1]
131 if (
mesh().isInternalFace(faceI))
153 const label exposedPatchI
185 const label exposedPatchI,
197 own =
mesh().faceOwner()[faceI];
199 if (cellLoops[own].size() && firstCommon(
f, anchorPts[own]) == -1)
207 if (
mesh().isInternalFace(faceI))
209 nei =
mesh().faceNeighbour()[faceI];
211 if (cellLoops[nei].size() && firstCommon(
f, anchorPts[nei]) == -1)
217 patchID =
mesh().boundaryMesh().whichPatch(faceI);
219 if (patchID == -1 && (own == -1 || nei == -1))
222 patchID = exposedPatchI;
234 zoneID =
mesh().faceZones().whichZone(faceI);
252 const label masterPointI,
262 getZoneInfo(faceI, zoneID, zoneFlip);
264 if ((nei == -1) || (own != -1 && own < nei))
269 Pout<<
"Adding face " << newFace
270 <<
" with new owner:" << own
271 <<
" with new neighbour:" << nei
272 <<
" patchID:" << patchID
273 <<
" anchor:" << masterPointI
274 <<
" zoneID:" << zoneID
275 <<
" zoneFlip:" << zoneFlip
302 <<
" with new owner:" << nei
303 <<
" with new neighbour:" << own
304 <<
" patchID:" << patchID
305 <<
" anchor:" << masterPointI
306 <<
" zoneID:" << zoneID
307 <<
" zoneFlip:" << zoneFlip
345 getZoneInfo(faceI, zoneID, zoneFlip);
349 (own !=
mesh().faceOwner()[faceI])
351 mesh().isInternalFace(faceI)
352 && (nei !=
mesh().faceNeighbour()[faceI])
354 || (newFace !=
mesh().faces()[faceI])
359 Pout<<
"Modifying face " << faceI
360 <<
" old vertices:" <<
mesh().faces()[faceI]
361 <<
" new vertices:" << newFace
362 <<
" new owner:" << own
363 <<
" new neighbour:" << nei
364 <<
" new patch:" << patchID
365 <<
" new zoneID:" << zoneID
366 <<
" new zoneFlip:" << zoneFlip
370 if ((nei == -1) || (own != -1 && own < nei))
425 newFace[newFp++] =
f[fp];
427 fp = (fp + 1) %
f.size();
429 newFace[newFp] =
f[fp];
453 <<
"Cannot find vertex (new numbering) " << v0
463 <<
"Cannot find vertex (new numbering) " << v1
469 f0.
setSize((endFp + 1 +
f.size() - startFp) %
f.size());
470 f1.setSize(
f.size() - f0.
size() + 2);
472 copyFace(
f, startFp, endFp, f0);
473 copyFace(
f, endFp, startFp,
f1);
483 face newFace(2 *
f.size());
490 newFace[newFp++] =
f[fp];
493 label fp1 =
f.fcIndex(fp);
501 newFace[newFp++] = fnd();
534 label vertI = addedPoints_[
e];
536 newFace[newFaceI++] = vertI;
543 newFace[newFaceI++] = vertI;
545 label nextCut = loop[loop.fcIndex(fp)];
547 if (!isEdge(nextCut))
550 label nextVertI = getVertex(nextCut);
558 addedPoints_.
find(
mesh().edges()[edgeI]);
560 if (fnd != addedPoints_.end())
562 newFace[newFaceI++] = fnd();
589 const label exposedPatchI,
597 addedFaces_.resize(cuts.
nLoops());
599 addedPoints_.clear();
600 addedPoints_.resize(cuts.
nLoops());
611 if (exposedPatchI < 0 || exposedPatchI >=
patches.size())
614 <<
"Illegal exposed patch " << exposedPatchI
630 if (debug && findCutCell(cuts,
mesh().edgeCells()[edgeI]) == -1)
633 <<
"Problem: cut edge but none of the cells using it is\n"
634 <<
"edge:" << edgeI <<
" verts:" <<
e
639 label masterPointI =
e.start();
646 point newPt = weight*v1 + (1.0-weight)*v0;
661 addedPoints_.insert(
e, addedPointI);
665 Pout<<
"Added point " << addedPointI
667 << masterPointI <<
" of edge " << edgeI
668 <<
" vertices " <<
e <<
endl;
682 const labelList& loop = cellLoops[cellI];
693 usedPoint[getVertex(
cut)] =
true;
697 const labelList& anchors = anchorPts[cellI];
701 usedPoint[anchors[i]] =
true;
711 usedPoint[cPoints[i]] =
true;
722 const edge& fCut = iter();
732 if (!usedPoint[pointI])
735 <<
"Problem: faceSplitCut not used by any loop"
736 <<
" or cell anchor point"
737 <<
"face:" << iter.key() <<
" point:" << pointI
749 if (!usedPoint[pointI])
752 <<
"Problem: point is marked as cut but"
753 <<
" not used by any loop"
754 <<
" or cell anchor point"
755 <<
"point:" << pointI
766 if (!usedPoint[pointI])
772 Pout<<
"Removing unused point " << pointI <<
endl;
785 const labelList& loop = cellLoops[cellI];
789 if (cutPatch[cellI] < 0 || cutPatch[cellI] >=
patches.size())
792 <<
"Illegal patch " << cutPatch[cellI]
793 <<
" provided for cut cell " << cellI
801 face newFace(loopToFace(cellI, loop));
806 label masterPointI = findPatchFacePoint(newFace, exposedPatchI);
826 addedFaces_.insert(cellI, addedFaceI);
830 Pout<<
"Added splitting face " << newFace <<
" index:"
831 << addedFaceI <<
" from masterPoint:" << masterPointI
832 <<
" to owner " << cellI <<
" with anchors:"
849 writeCuts(
Pout, loop, weights);
870 label faceI = iter.key();
873 face newFace(addEdgeCutsToFace(faceI));
876 const edge& splitEdge = iter();
878 label cut0 = splitEdge[0];
883 label edgeI = getEdge(cut0);
884 v0 = addedPoints_[
mesh().
edges()[edgeI]];
888 v0 = getVertex(cut0);
891 label cut1 = splitEdge[1];
895 label edgeI = getEdge(cut1);
896 v1 = addedPoints_[
mesh().
edges()[edgeI]];
900 v1 = getVertex(cut1);
905 splitFace(newFace, v0, v1, f0,
f1);
911 if (
mesh().isInternalFace(faceI))
919 <<
" own:" << own <<
" nei:" << nei
921 <<
" and f1:" <<
f1 <<
endl;
940 if (cellLoops[own].empty())
946 else if (isIn(splitEdge, cellLoops[own]))
950 if (firstCommon(f0, anchorPts[own]) != -1)
967 if (firstCommon(
f, anchorPts[own]) != -1)
987 if (cellLoops[nei].empty())
992 else if (isIn(splitEdge, cellLoops[nei]))
998 if (firstCommon(f0, anchorPts[nei]) != -1)
1014 if (firstCommon(
f, anchorPts[nei]) != -1)
1031 Pout<<
"f0 own:" << f0Own <<
" nei:" << f0Nei
1032 <<
" f1 own:" << f1Own <<
" nei:" << f1Nei
1043 patchID = exposedPatchI;
1050 bool modifiedFaceI =
false;
1057 modFace(meshMod, faceI, f0, f0Own, f0Nei, patchID);
1058 modifiedFaceI =
true;
1066 modFace(meshMod, faceI, f0, f0Own, f0Nei, patchID);
1067 modifiedFaceI =
true;
1072 modFace(meshMod, faceI, f0, f0Own, f0Nei, -1);
1073 modifiedFaceI =
true;
1091 modFace(meshMod, faceI,
f1, f1Own, f1Nei, patchID);
1092 modifiedFaceI =
true;
1096 label masterPointI = findPatchFacePoint(
f1, patchID);
1118 modFace(meshMod, faceI,
f1, f1Own, f1Nei, patchID);
1119 modifiedFaceI =
true;
1123 label masterPointI = findPatchFacePoint(
f1, patchID);
1142 modFace(meshMod, faceI,
f1, f1Own, f1Nei, -1);
1143 modifiedFaceI =
true;
1147 label masterPointI = findPatchFacePoint(
f1, -1);
1149 addFace(meshMod, faceI, masterPointI,
f1, f1Own, f1Nei, -1);
1154 if (f0Own == -1 && f0Nei == -1 && !modifiedFaceI)
1160 Pout<<
"Removed face " << faceI <<
endl;
1164 faceUptodate[faceI] =
true;
1177 if (edgeIsCut[edgeI])
1183 label faceI = eFaces[i];
1185 if (!faceUptodate[faceI])
1192 label own, nei, patchID;
1193 faceCells(cuts, exposedPatchI, faceI, own, nei, patchID);
1196 if (own == -1 && nei == -1)
1202 Pout<<
"Removed face " << faceI <<
endl;
1208 face newFace(addEdgeCutsToFace(faceI));
1212 Pout<<
"Added edge cuts to face " << faceI
1214 <<
" newFace:" << newFace <<
endl;
1228 faceUptodate[faceI] =
true;
1245 if (!faceUptodate[faceI])
1248 label own, nei, patchID;
1249 faceCells(cuts, exposedPatchI, faceI, own, nei, patchID);
1251 if (own == -1 && nei == -1)
1257 Pout<<
"Removed face " << faceI <<
endl;
1262 modFace(meshMod, faceI, faces[faceI], own, nei, patchID);
1265 faceUptodate[faceI] =
true;
1271 Pout<<
"meshCutAndRemove:" <<
nl
1272 <<
" cells split:" << cuts.
nLoops() <<
nl
1273 <<
" faces added:" << addedFaces_.size() <<
nl
1274 <<
" points added on edges:" << addedPoints_.size() <<
nl
1284 Map<label> newAddedFaces(addedFaces_.size());
1288 label cellI = iter.key();
1291 label addedFaceI = iter();
1295 if ((newCellI >= 0) && (newAddedFaceI >= 0))
1300 && (newCellI != cellI || newAddedFaceI != addedFaceI)
1303 Pout<<
"meshCutAndRemove::updateMesh :"
1304 <<
" updating addedFace for cell " << cellI
1305 <<
" from " << addedFaceI
1306 <<
" to " << newAddedFaceI
1309 newAddedFaces.insert(newCellI, newAddedFaceI);
1314 addedFaces_.transfer(newAddedFaces);
1323 addedPoints_.begin();
1324 iter != addedPoints_.end();
1328 const edge&
e = iter.key();
1334 label addedPointI = iter();
1338 if ((newStart >= 0) && (newEnd >= 0) && (newAddedPointI >= 0))
1340 edge newE =
edge(newStart, newEnd);
1345 && (
e != newE || newAddedPointI != addedPointI)
1348 Pout<<
"meshCutAndRemove::updateMesh :"
1349 <<
" updating addedPoints for edge " <<
e
1350 <<
" from " << addedPointI
1351 <<
" to " << newAddedPointI
1355 newAddedPoints.
insert(newE, newAddedPointI);
1360 addedPoints_.transfer(newAddedPoints);
virtual const pointField & points() const
Return raw points.
face reverseFace() const
Return face with reverse direction.
label nLoops() const
Number of valid cell loops.
const boolList & pointIsCut() const
Is mesh point cut.
const Map< edge > & faceSplitCut() const
Gives for split face the two cuts that split the face into two.
Class containing data for point removal.
#define forAll(list, i)
Loop across all elements in list.
const labelListList & cellPoints() const
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
const labelListList & edgeFaces() const
label findCutCell(const cellCuts &, const labelList &) const
Returns -1 or the cell in cellLabels that is cut.
Direct mesh changes based on v1.3 polyTopoChange syntax.
face addEdgeCutsToFace(const label faceI) const
Add cuts of edges to face.
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Combines edge or vertex in single label. Used to specify cuts across cell circumference.
bool insert(const Key &, const T &newElmt)
Insert a new hashedEntry.
A HashTable to objects of type <T> with a label key.
Class describing modification of a face.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const labelListList & cellAnchorPoints() const
For each cut cell the points on the 'anchor' side of the cell.
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
Mesh consisting of general polyhedral cells.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
face loopToFace(const label cellI, const labelList &loop) const
Convert loop of cuts into face.
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=*(cellModeller::lookup("hex"));labelList hexLabels(8);label activeCells=0;labelList pointMap(nPoints);forAll(pointMap, i){ pointMap[i]=i;}for(label i=0;i< nPoints;i++){ if(f[i] > 0.0) { hexLabels[0]=i;hexLabels[1]=i1tab[i];hexLabels[2]=i3tab[i1tab[i]];hexLabels[3]=i3tab[i];hexLabels[4]=i8tab[i];hexLabels[5]=i1tab[i8tab[i]];hexLabels[6]=i3tab[i1tab[i8tab[i]]];hexLabels[7]=i3tab[i8tab[i]];cellShapes[activeCells]=cellShape(hex, hexLabels);edgeList edges=cellShapes[activeCells].edges();forAll(edges, ei) { if(edges[ei].mag(points)< SMALL) { label start=pointMap[edges[ei].start()];while(start !=pointMap[start]) { start=pointMap[start];} label end=pointMap[edges[ei].end()];while(end !=pointMap[end]) { end=pointMap[end];} label minLabel=min(start, end);pointMap[start]=pointMap[end]=minLabel;} } cellZoning[activeCells]=idreg[i];activeCells++;}}cellShapes.setSize(activeCells);cellZoning.setSize(activeCells);forAll(cellShapes, celli){ cellShape &cs=cellShapes[celli];forAll(cs, i) { cs[i]=pointMap[cs[i]];} cs.collapse();}label bcIDs[11]={-1, 0, 2, 4, -1, 5, -1, 6, 7, 8, 9};const label nBCs=12;const word *kivaPatchTypes[nBCs]={ &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &symmetryPolyPatch::typeName, &wedgePolyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &symmetryPolyPatch::typeName, &oldCyclicPolyPatch::typeName};enum patchTypeNames{ PISTON, VALVE, LINER, CYLINDERHEAD, AXIS, WEDGE, INFLOW, OUTFLOW, PRESIN, PRESOUT, SYMMETRYPLANE, CYCLIC};const char *kivaPatchNames[nBCs]={ "piston", "valve", "liner", "cylinderHead", "axis", "wedge", "inflow", "outflow", "presin", "presout", "symmetryPlane", "cyclic"};List< SLList< face > > pFaces[nBCs]
void faceCells(const cellCuts &cuts, const label exposedPatchI, const label faceI, label &own, label &nei, label &patchID) const
Get new owner and neighbour of face. Checks anchor points to see if.
const scalarField & edgeWeight() const
If edge is cut gives weight (ratio between start() and end())
HashTable< label, edge, Hash< edge > > addedPoints_
Points added in last setRefinement. Per split edge label of added.
static bool isIn(const edge &, const labelList &)
Do the elements of edge appear in consecutive order in the list.
Hash function class for primitives. All non-primitives used to hash entries on hash tables likely nee...
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Pre-declare SubField and related Field type.
A subset of mesh faces organised as a primitive patch.
void getZoneInfo(const label faceI, label &zoneID, bool &zoneFlip) const
Get zone information for face.
virtual const labelList & faceOwner() const
Return face owner.
const labelListList & cellLoops() const
For each cut cell the cut along the circumference.
meshCutAndRemove(const meshCutAndRemove &)
Disallow default bitwise copy construct.
Patchify triangles based on orientation w.r.t other (triangulated or triangulatable) surfaces.
label whichFace(const label globalCellID) const
Helper function to re-direct to zone::localID(...)
errorManip< error > abort(error &err)
const double e
Elementary charge.
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
iterator find(const Key &)
Find and return an iterator set at the hashedEntry.
An STL-conforming hash table.
const labelList & reverseFaceMap() const
Reverse face map.
void setSize(const label)
Reset size of List.
label findPatchFacePoint(const face &f, const label patchI) const
Find point on face that is part of original mesh and that is.
const labelList & reverseCellMap() const
Reverse cell map.
virtual const faceList & faces() const
Return raw faces.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label setAction(const topoAction &action)
For compatibility with polyTopoChange: set topological action.
void setRefinement(const label exposedPatchI, const cellCuts &cuts, const labelList &cutPatch, polyTopoChange &meshMod)
Do actual cutting with cut description. Inserts mesh changes.
prefixOSstream Pout(cout, "Pout")
const labelList & reversePointMap() const
Reverse point map.
Class containing data for face removal.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
const boolList & edgeIsCut() const
Is edge cut.
void addFace(polyTopoChange &meshMod, const label faceI, const label masterPointI, const face &newFace, const label owner, const label neighbour, const label patchID)
Adds a face from point. Flips face if owner>neighbour.
Class containing data for point addition.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A face addition data class. A face can be inflated either from a point or from another face and can e...
A face is a list of labels corresponding to mesh vertices.
void size(const label)
Override size to be inconsistent with allocated storage.
void splitFace(const face &f, const label v0, const label v1, face &f0, face &f1) const
Split face along cut into two faces. Faces are in same point.
const boolList & flipMap() const
Return face flip map.
defineTypeNameAndDebug(combustionModel, 0)
void modFace(polyTopoChange &meshMod, const label faceI, const face &newFace, const label owner, const label neighbour, const label patchID)
Modifies existing faceI for either new owner/neighbour or.
labelList pointLabels(nPoints, -1)
virtual const labelList & faceNeighbour() const
Return face neighbour.
label findInternalFacePoint(const labelList &pointLabels) const
Returns first pointI in pointLabels that uses an internal.
void copyFace(const face &f, const label startFp, const label endFp, face &newFace) const
static label firstCommon(const labelList &lst1, const labelList &lst2)
Description of cuts across cells.
static const labelSphericalTensor labelI(1)
Identity labelTensor.
const polyMesh & mesh() const
void reverse(UList< T > &, const label n)