50 const Foam::vector Foam::boundaryMesh::splitNormal_(3, 2, 1);
53 const Foam::scalar Foam::boundaryMesh::distanceTol_ = 1
e-2;
59 Foam::label Foam::boundaryMesh::nFeatureEdges(label pointi)
const 67 label edgeI = pEdges[pEdgeI];
69 if (edgeToFeature_[edgeI] != -1)
79 Foam::label Foam::boundaryMesh::nextFeatureEdge
89 label nbrEdgeI = pEdges[pEdgeI];
91 if (nbrEdgeI != edgeI)
93 label featI = edgeToFeature_[nbrEdgeI];
112 const label startEdgeI,
118 label edgeI = startEdgeI;
122 label vertI =
e.start();
124 while (!isFeaturePoint[vertI])
128 edgeI = nextFeatureEdge(edgeI, vertI);
130 if ((edgeI == -1) || (edgeI == startEdgeI))
139 vertI =
e.otherVertex(vertI);
151 labelList featLabels(featureEdges_.size());
153 label featLabelI = 0;
155 label initEdgeI = edgeI;
160 label featI = edgeToFeature_[edgeI];
167 featLabels[featLabelI++] = featI;
169 featVisited[featI] =
true;
175 vertI =
e.otherVertex(vertI);
179 edgeI = nextFeatureEdge(edgeI, vertI);
181 if ((edgeI == -1) || (edgeI == initEdgeI))
186 while (!isFeaturePoint[vertI]);
190 featLabels.setSize(featLabelI);
196 void Foam::boundaryMesh::markEdges
198 const label maxDistance,
202 DynamicList<label>& visited
209 if (minDistance[edgeI] == -1)
212 visited.append(edgeI);
214 else if (minDistance[edgeI] <=
distance)
227 forAll(startEdges, pEdgeI)
257 Foam::label Foam::boundaryMesh::findPatchID
260 const word& patchName
281 names[patchi] = patches_[patchi].name();
287 Foam::label Foam::boundaryMesh::whichPatch
297 if ((facei >=
pp.start()) && (facei < (
pp.start() +
pp.size())))
321 label facei = changedFaces[i];
327 label edgeI = fEdges[fEdgeI];
329 if (!regionEdge[edgeI] && (edgeRegion[edgeI] == -1))
331 edgeRegion[edgeI] = region;
333 changedEdges[changedI++] = edgeI;
338 changedEdges.setSize(changedI);
357 label edgeI = changedEdges[i];
363 label facei = eFaces[eFacei];
365 if (faceRegion[facei] == -1)
367 faceRegion[facei] = region;
369 changedFaces[changedI++] = facei;
374 changedFaces.setSize(changedI);
381 void Foam::boundaryMesh::markZone
389 faceZone[facei] = currentZone;
401 changedEdges = faceToEdge
411 Pout<<
"From changedFaces:" << changedFaces.size()
412 <<
" to changedEdges:" << changedEdges.size()
416 if (changedEdges.empty())
421 changedFaces = edgeToFace(currentZone, changedEdges, faceZone);
425 Pout<<
"From changedEdges:" << changedEdges.size()
426 <<
" to changedFaces:" << changedFaces.size()
430 if (changedFaces.empty())
458 meshPtr_.reset(
nullptr);
472 meshFace_.setSize(nBFaces);
497 meshFace_[bFacei] =
pp.start() + patchFacei;
499 bFaces[bFacei] =
pp[patchFacei];
508 Pout<<
"read : patches now:" <<
endl;
512 const boundaryPatch& bp = patches_[patchi];
515 <<
" size : " << bp.size() <<
endl 516 <<
" start : " << bp.start() <<
endl 517 <<
" type : " << bp.physicalType() <<
endl 534 new bMesh(globalPatch.localFaces(), globalPatch.localPoints())
539 const bMesh& msh = *meshPtr_;
541 Pout<<
"** Start of Faces **" <<
endl;
545 const face&
f = msh[facei];
551 ctr += msh.points()[
f[fp]];
561 Pout<<
"** End of Faces **" <<
endl;
563 Pout<<
"** Start of Points **" <<
endl;
565 forAll(msh.points(), pointi)
568 <<
" coord:" << msh.points()[pointi]
572 Pout<<
"** End of Points **" <<
endl;
576 featurePoints_.clear();
577 featureEdges_.clear();
579 featureToEdge_.clear();
580 edgeToFeature_.resize(meshPtr_->nEdges());
583 featureSegments_.clear();
598 SortableList<label> regions(surf.
size());
602 regions[triI] = surf[triI].region();
607 Map<label> regionToBoundaryPatch;
609 label oldRegion = -1111;
610 label boundPatch = 0;
614 if (regions[i] != oldRegion)
616 regionToBoundaryPatch.insert(regions[i], boundPatch);
618 oldRegion = regions[i];
627 if (surfPatches.size() == regionToBoundaryPatch.size())
632 patches_.resize(surfPatches.size());
635 forAll(surfPatches, patchi)
637 const geometricSurfacePatch& surfPatch = surfPatches[patchi];
648 surfPatch.geometricType()
657 patches_.resize(regionToBoundaryPatch.size());
680 const labelList& indices = regions.indices();
689 label surfRegion = regions[0];
690 label foamRegion = regionToBoundaryPatch[surfRegion];
692 Pout<<
"Surface region " << surfRegion <<
" becomes boundary patch " 693 << foamRegion <<
" with name " << patches_[foamRegion].
name() <<
endl;
697 label startFacei = 0;
701 label triI = indices[indexI];
703 const labelledTri& tri = surf.
localFaces()[triI];
705 if (tri.region() != surfRegion)
708 boundaryPatch& bp = patches_[foamRegion];
710 bp.size() = bFacei - startFacei;
711 bp.start() = startFacei;
713 surfRegion = tri.region();
714 foamRegion = regionToBoundaryPatch[surfRegion];
716 Pout<<
"Surface region " << surfRegion <<
" becomes boundary patch " 717 << foamRegion <<
" with name " << patches_[foamRegion].
name()
723 meshFace_[bFacei] = triI;
725 bFaces[bFacei++] = face(tri);
729 boundaryPatch& bp = patches_[foamRegion];
731 bp.size() = bFacei - startFacei;
732 bp.start() = startFacei;
744 featurePoints_.clear();
745 featureEdges_.clear();
747 featureToEdge_.clear();
748 edgeToFeature_.resize(meshPtr_->nEdges());
751 featureSegments_.clear();
764 surfPatches[patchi] =
780 label totalNTris = getNTris(0,
mesh().size(), nTris);
789 startTri[facei] = triI;
791 triI += nTris[facei];
797 triangulate(0,
mesh().size(), totalNTris, triVerts);
801 List<labelledTri> tris(totalNTris);
807 const boundaryPatch& bp = patches_[patchi];
811 label facei = bp.start() + patchFacei;
813 label triVertI = 3*startTri[facei];
815 for (label faceTriI = 0; faceTriI < nTris[facei]; faceTriI++)
817 label v0 = triVerts[triVertI++];
818 label v1 = triVerts[triVertI++];
819 label v2 = triVerts[triVertI++];
821 tris[triI++] = labelledTri(v0, v1, v2, patchi);
826 triSurface surf(tris, surfPatches,
mesh().
points());
828 OFstream surfStream(fName);
830 surf.
write(surfStream);
860 scalar
sign =
mesh().faceNormals()[bFacei] & splitNormal_;
864 rightFaces.
append(bFacei);
877 Pout<<
"getNearest :" 878 <<
" rightBin:" << rightFaces.
size()
879 <<
" leftBin:" << leftFaces.
size()
900 scalar tol = 1
e-6 * overallBb.
avgDim();
912 const scalar planarTol =
953 Pout<<
"getNearest : built trees" <<
endl;
966 const scalar searchDimSqr =
magSqr(searchSpan);
968 forAll(nearestBFacei, patchFacei)
974 if (
debug && (patchFacei % 1000) == 0)
976 Pout<<
"getNearest : patchFace:" << patchFacei
977 <<
" meshFacei:" << meshFacei <<
" ctr:" << ctr <<
endl;
986 scalar typDim = -GREAT;
995 pointIndexHit rightInfo = rightTree.findNearest(ctr, searchDimSqr);
999 pointIndexHit leftInfo = leftTree.findNearest(ctr, searchDimSqr);
1001 if (rightInfo.
hit())
1006 label rightFacei = rightFaces[rightInfo.
index()];
1007 label leftFacei = leftFaces[leftInfo.
index()];
1009 label rightDist = rightInfo.
point().dist(ctr);
1010 label leftDist = leftInfo.
point().dist(ctr);
1012 scalar rightSign =
n & ns[rightFacei];
1013 scalar leftSign =
n & ns[leftFacei];
1017 (rightSign > 0 && leftSign > 0)
1018 || (rightSign < 0 && leftSign < 0)
1022 if (rightDist < leftDist)
1024 nearestBFacei[patchFacei] = rightFacei;
1028 nearestBFacei[patchFacei] = leftFacei;
1040 typDim *= distanceTol_;
1042 if (rightDist < typDim && leftDist < typDim)
1047 nearestBFacei[patchFacei] = rightFacei;
1051 nearestBFacei[patchFacei] = leftFacei;
1057 if (rightDist < leftDist)
1059 nearestBFacei[patchFacei] = rightFacei;
1063 nearestBFacei[patchFacei] = leftFacei;
1072 label rightFacei = rightFaces[rightInfo.
index()];
1073 nearestBFacei[patchFacei] = rightFacei;
1084 nearestBFacei[patchFacei] = leftFaces[leftInfo.
index()];
1089 nearestBFacei[patchFacei] = -1;
1094 return nearestBFacei;
1101 const polyBoundaryMesh& oldPatches,
1111 HashTable<label> nameToIndex(2*patches_.size());
1113 Map<word> indexToName(2*patches_.size());
1116 label nNewPatches = patches_.size();
1118 forAll(oldPatches, oldPatchi)
1120 const polyPatch&
patch = oldPatches[oldPatchi];
1121 const label newPatchi = findPatchID(
patch.name());
1123 if (newPatchi != -1)
1125 nameToIndex.insert(
patch.name(), newPatchi);
1126 indexToName.insert(newPatchi,
patch.name());
1132 forAll(patches_, bPatchi)
1134 const boundaryPatch& bp = patches_[bPatchi];
1136 if (!nameToIndex.found(bp.name()))
1138 nameToIndex.insert(bp.name(), bPatchi);
1139 indexToName.insert(bPatchi, bp.name());
1151 label meshFacei = newMesh.nInternalFaces();
1154 label facesToBeDone = newMesh.nBoundaryFaces();
1156 forAll(patches_, bPatchi)
1158 const boundaryPatch& bp = patches_[bPatchi];
1160 const label newPatchi = nameToIndex[bp.name()];
1163 const label oldPatchi = findPatchID(oldPatches, bp.name());
1165 if (oldPatchi == -1)
1170 Pout<<
"patchify : Creating new polyPatch:" << bp.
name()
1171 <<
" type:" << bp.physicalType() <<
endl;
1184 newMesh.boundaryMesh()
1188 meshFacei += facesToBeDone;
1196 const polyPatch& oldPatch = oldPatches[oldPatchi];
1200 Pout<<
"patchify : Cloning existing polyPatch:" 1209 newMesh.boundaryMesh(),
1216 meshFacei += facesToBeDone;
1226 Pout<<
"Patchify : new polyPatch list:" <<
endl;
1228 forAll(newPatches, patchi)
1230 const polyPatch& newPatch = newPatches[patchi];
1235 <<
" type :" << newPatch.typeName <<
endl 1236 <<
" size :" << newPatch.size() <<
endl 1237 <<
" start:" << newPatch.start() <<
endl 1238 <<
" index:" << patchi <<
endl;
1244 repatchPolyTopoChanger polyMeshRepatcher(newMesh);
1245 polyMeshRepatcher.changePatches(newPatches);
1251 if (newPatches.size())
1253 List<DynamicList<label>> patchFaces(nNewPatches);
1256 label nAvgFaces = newMesh.nBoundaryFaces() / nNewPatches;
1258 forAll(patchFaces, newPatchi)
1260 patchFaces[newPatchi].setCapacity(nAvgFaces);
1268 forAll(oldPatches, oldPatchi)
1270 const polyPatch&
patch = oldPatches[oldPatchi];
1276 label meshFacei =
patch.start() + patchFacei;
1278 label bFacei = meshFacei - newMesh.nInternalFaces();
1280 patchFaces[whichPatch(nearest[bFacei])].append(meshFacei);
1284 forAll(patchFaces, newPatchi)
1286 patchFaces[newPatchi].shrink();
1293 for (label newPatchi = 1; newPatchi < patchFaces.size(); newPatchi++)
1299 polyMeshRepatcher.changePatchID(
pFaces[pFacei], newPatchi);
1303 polyMeshRepatcher.repatch();
1310 edgeToFeature_.setSize(
mesh().nEdges());
1312 edgeToFeature_ = -1;
1317 featureToEdge_.setSize(
mesh().nEdges());
1321 if (minCos >= 0.9999)
1326 edgeToFeature_[edgeI] = featureI;
1327 featureToEdge_[featureI++] = edgeI;
1336 if (eFaces.size() == 2)
1338 label face0I = eFaces[0];
1340 label face1I = eFaces[1];
1351 const vector& n0 =
mesh().faceNormals()[face0I];
1353 const vector& n1 =
mesh().faceNormals()[face1I];
1355 float cosAng = n0 & n1;
1357 if (cosAng < minCos)
1359 edgeToFeature_[edgeI] = featureI;
1360 featureToEdge_[featureI++] = edgeI;
1367 edgeToFeature_[edgeI] = featureI;
1368 featureToEdge_[featureI++] = edgeI;
1374 featureToEdge_.setSize(featureI);
1380 featureEdges_.setSize(featureI);
1387 forAll(featureToEdge_, fEdgeI)
1389 label edgeI = featureToEdge_[fEdgeI];
1393 label start = featToMeshPoint[
e.start()];
1397 featToMeshPoint[
e.start()] = featPtI;
1399 featurePoints_[featPtI] =
mesh().
points()[
e.start()];
1406 label
end = featToMeshPoint[
e.end()];
1410 featToMeshPoint[
e.end()] = featPtI;
1412 featurePoints_[featPtI] =
mesh().
points()[
e.end()];
1420 featureEdges_[fEdgeI] = edge(start,
end);
1424 featurePoints_.setSize(featPtI);
1436 forAll(featureToEdge_, featI)
1438 label edgeI = featureToEdge_[featI];
1442 if (nFeatureEdges(
e.start()) != 2)
1444 isFeaturePoint[
e.start()] =
true;
1447 if (nFeatureEdges(
e.end()) != 2)
1449 isFeaturePoint[
e.end()] =
true;
1459 DynamicList<labelList> segments;
1462 boolList featVisited(featureToEdge_.size(),
false);
1466 label startFeatI = -1;
1468 forAll(featVisited, featI)
1470 if (!featVisited[featI])
1478 if (startFeatI == -1)
1489 featureToEdge_[startFeatI],
1500 featureSegments_.setSize(segments.size());
1504 featureSegments_[segmentI] = segments[segmentI];
1514 DynamicList<label> visitedEdges;
1517 markEdges(8, edgeI, 0, minDistance, visitedEdges);
1520 extraEdges_.transfer(visitedEdges);
1524 Foam::label Foam::boundaryMesh::whichPatch(
const label facei)
const 1537 <<
"Cannot find face " << facei <<
" in list of boundaryPatches " 1545 Foam::label Foam::boundaryMesh::findPatchID(
const word& patchName)
const 1549 if (patches_[patchi].
name() == patchName)
1561 patches_.setSize(patches_.size() + 1);
1565 label patchi = patches_.size()-1;
1567 boundaryPatch* bpPtr =
new boundaryPatch
1576 patches_.set(patchi, bpPtr);
1580 Pout<<
"addPatch : patches now:" <<
endl;
1584 const boundaryPatch& bp = patches_[patchi];
1587 <<
" size : " << bp.size() <<
endl 1588 <<
" start : " << bp.start() <<
endl 1589 <<
" type : " << bp.physicalType() <<
endl 1598 const label delPatchi = findPatchID(patchName);
1600 if (delPatchi == -1)
1603 <<
"Can't find patch named " << patchName
1607 if (patches_[delPatchi].size())
1610 <<
"Trying to delete non-empty patch " << patchName
1611 <<
endl <<
"Current size:" << patches_[delPatchi].size()
1615 PtrList<boundaryPatch> newPatches(patches_.size() - 1);
1617 for (label patchi = 0; patchi < delPatchi; patchi++)
1619 newPatches.set(patchi, patches_[patchi].clone());
1624 for (label patchi = delPatchi + 1; patchi < patches_.size(); patchi++)
1626 newPatches.set(patchi - 1, patches_[patchi].clone());
1629 patches_ = std::move(newPatches);
1633 Pout<<
"deletePatch : patches now:" <<
endl;
1637 const boundaryPatch& bp = patches_[patchi];
1640 <<
" size : " << bp.size() <<
endl 1641 <<
" start : " << bp.start() <<
endl 1642 <<
" type : " << bp.physicalType() <<
endl 1651 const word& patchName,
1652 const word& patchType
1655 const label changeI = findPatchID(patchName);
1660 <<
"Can't find patch named " << patchName
1669 PtrList<boundaryPatch> newPatches(patches_.size());
1673 if (patchi == changeI)
1676 const boundaryPatch& oldBp = patches_[patchi];
1678 boundaryPatch* bpPtr =
new boundaryPatch
1687 newPatches.set(patchi, bpPtr);
1692 newPatches.set(patchi, patches_[patchi].clone());
1696 patches_ = newPatches;
1709 <<
"List of patchIDs not equal to number of faces." <<
endl 1723 if (patchID < 0 || patchID >= patches_.size())
1726 <<
"PatchID " <<
patchID <<
" out of range" 1739 for (label patchi = 1; patchi < patches_.size(); patchi++)
1741 startFace[patchi] = startFace[patchi-1] + nFaces[patchi-1];
1745 PtrList<boundaryPatch> newPatches(patches_.size());
1749 const boundaryPatch& bp = patches_[patchi];
1764 patches_ = newPatches;
1768 Pout<<
"changeFaces : patches now:" <<
endl;
1772 const boundaryPatch& bp = patches_[patchi];
1775 <<
" size : " << bp.size() <<
endl 1776 <<
" start : " << bp.start() <<
endl 1777 <<
" type : " << bp.physicalType() <<
endl 1790 oldToNew[facei] = startFace[
patchID]++;
1800 newFaces[oldToNew[facei]] =
mesh()[facei];
1801 newMeshFace[oldToNew[facei]] = meshFace_[facei];
1806 std::unique_ptr<bMesh> newMeshPtr(
new bMesh(newFaces,
mesh().
points()));
1809 meshFace_.transfer(newMeshFace);
1816 meshPtr_ = std::move(newMeshPtr);
1830 const label startFacei,
1835 label totalNTris = 0;
1839 for (label i = 0; i < nFaces; i++)
1841 label faceNTris = getNTris(startFacei + i);
1843 nTris[i] = faceNTris;
1845 totalNTris += faceNTris;
1855 const label startFacei,
1857 const label totalNTris,
1862 triVerts.
setSize(3*totalNTris);
1866 for (label i = 0; i < nFaces; i++)
1868 label facei = startFacei + i;
1881 forAll(triFaces, triFacei)
1883 const face& triF = triFaces[triFacei];
1885 triVerts[vertI++] = triF[0];
1886 triVerts[vertI++] = triF[1];
1887 triVerts[vertI++] = triF[2];
1896 const label startFacei,
1902 SubList<face>(
mesh(), nFaces, startFacei),
1906 return patch.nPoints();
1913 const label startFacei,
1915 const label totalNTris,
1927 localToGlobal =
patch.meshPoints();
1930 triVerts.
setSize(3*totalNTris);
1934 for (label i = 0; i < nFaces; i++)
1944 f.triangles(
patch.localPoints(), nTri, triFaces);
1948 forAll(triFaces, triFacei)
1950 const face& triF = triFaces[triFacei];
1952 triVerts[vertI++] = triF[0];
1953 triVerts[vertI++] = triF[1];
1954 triVerts[vertI++] = triF[2];
1963 const label seedFacei,
1969 forAll(protectedEdges, i)
1971 protectedEdge[protectedEdges[i]] =
true;
1979 markZone(protectedEdge, seedFacei, 0, currentZone);
1982 visited.setSize(
mesh().size());
1984 forAll(currentZone, facei)
1986 if (currentZone[facei] == 0)
1988 visited[facei] =
true;
1992 visited[facei] =
false;
dimensionedScalar sign(const dimensionedScalar &ds)
const labelListList & pointEdges() const
Return point-edge addressing.
const labelList patchIDs(pbm.indices(polyPatchNames, true))
const List< face_type > & localFaces() const
Return patch faces addressing into local point list.
void addPatch(const word &patchName)
Add to back of patch list.
void size(const label n)
Older name for setAddressableSize.
List< word > names(const UPtrList< T > &list, const UnaryMatchPredicate &matcher)
List of names generated by calling name() for each list item and filtered for matches.
A class for handling file names.
void read(const polyMesh &)
Read from boundaryMesh of polyMesh.
void setFeatureEdges(const scalar minCos)
Set featureEdges, edgeToFeature, featureSegments according.
Like polyPatch but without reference to mesh. Used in boundaryMesh to hold data on patches...
A face is a list of labels corresponding to mesh vertices.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const Field< point_type > & localPoints() const
Return pointField of points in patch.
label getNPoints(const label startFacei, const label nFaces) const
Number of points used in face subset.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
const labelListList & faceEdges() const
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const labelListList & pointEdges() const
Cell-face mesh analysis engine.
void triangulate(const label startFacei, const label nFaces, const label totalNTris, labelList &triVerts) const
Simple triangulation of face subset. TotalNTris is total number.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
bool empty() const noexcept
True if List is empty (ie, size() is zero)
label getNTris(const label facei) const
Simple triangulation of face subset. Returns number of triangles.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void writeTriSurface(const fileName &) const
Write to file.
virtual const pointField & points() const =0
Return mesh points.
void patchify(const labelList &nearest, const polyBoundaryMesh &oldPatches, polyMesh &newMesh) const
Take over patches onto polyMesh from nearest face in *this.
scalar distance(const vector &p1, const vector &p2)
This class describes the interaction of an object (often a face) and a point. It carries the info of ...
labelList getNearest(const primitiveMesh &pMesh, const vector &searchSpan) const
Get bMesh index of nearest face for every boundary face in.
void markFaces(const labelList &protectedEdges, const label facei, boolList &visited) const
const point & min() const noexcept
Minimum describing the bounding box.
virtual const fileName & name() const override
Get the name of the output serial stream. (eg, the name of the Fstream file name) ...
void write(Ostream &os) const
Write to Ostream in simple OpenFOAM format.
void changePatchType(const word &patchName, const word &type)
Change patch.
scalar avgDim() const
Average length/height/width dimension.
void deletePatch(const word &patchName)
Delete from patch list.
boundaryMesh()
Default construct.
virtual const pointField & points() const
Return raw points.
#define forAll(list, i)
Loop across all elements in list.
static word defaultName(const label n=-1)
Default patch name: "patch" or "patchN".
List< face > faceList
List of faces.
PtrList< polyPatch > polyPatchList
Store lists of polyPatch as a PtrList.
label size() const noexcept
The number of elements in table.
const point & max() const noexcept
Maximum describing the bounding box.
A list of faces which address into the list of points.
const point_type & point() const noexcept
Return point, no checks.
A List obtained as a section of another List.
const geometricSurfacePatchList & patches() const noexcept
const dimensionedScalar e
Elementary charge.
void setSize(const label n)
Alias for resize()
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
const wordList area
Standard area field types (scalar, vector, tensor, etc)
void clear()
Clear the list, i.e. set size to zero.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
A class for handling words, derived from Foam::string.
label size() const noexcept
The number of entries in the list.
Encapsulation of data needed to search on PrimitivePatches.
label nInternalFaces() const noexcept
Number of internal faces.
void append(const T &val)
Copy append an element to the end of this list.
label index() const noexcept
Return the hit index.
errorManip< error > abort(error &err)
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
wordList patchNames() const
Get names of patches.
const word & name() const noexcept
The patch name.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
int debug
Static debugging option.
DynamicList< T, SizeMin > & shrink()
Calls shrink_to_fit() and returns a reference to the DynamicList.
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
const word & physicalType() const noexcept
The (optional) physical type of the patch.
List< geometricSurfacePatch > geometricSurfacePatchList
List of geometricSurfacePatch.
defineTypeNameAndDebug(combustionModel, 0)
static constexpr const char *const emptyType
The name for an 'empty' type.
PrimitivePatch< List< face >, const pointField & > primitiveFacePatch
A PrimitivePatch with List storage for the faces, const reference for the point field.
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
A PrimitivePatch with a SubList addressing for the faces, const reference for the point field...
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=cellModel::ref(cellModel::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].reset(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]
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
const vectorField & faceCentres() const
void setExtraEdges(const label edgeI)
Set extraEdges to edges 'near' to edgeI. Uses point-edge walk.
List< word > wordList
List of word.
bool hit() const noexcept
Is there a hit?
vector point
Point is a vector.
Non-pointer based hierarchical recursive searching.
void readTriSurface(const fileName &)
Read from triSurface.
const vectorField & faceAreas() const
A List with indirect addressing. Like IndirectList but does not store addressing. ...
virtual const faceList & faces() const =0
Return faces.
const polyBoundaryMesh & patches
const std::string patch
OpenFOAM patch number as a std::string.
void triangulateLocal(const label startFacei, const label nFaces, const label totalNTris, labelList &triVerts, labelList &localToGlobal) const
Same as triangulate but in local vertex numbering.
Identifies a surface patch/zone by name and index, with geometric type.
Standard boundBox with extra functionality for use in octree.
static autoPtr< polyPatch > New(const word &patchType, const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm)
Return pointer to a new patch created on freestore from components.
Mesh consisting of general polyhedral cells.
const bMesh & mesh() const
List< label > labelList
A List of labels.
A patch is a list of labels that address the faces in the global face list.
label start() const noexcept
The start of the patch.
Triangulated surface description with patch information.
label nBoundaryFaces() const noexcept
Number of boundary faces (== nFaces - nInternalFaces)
PrimitivePatch< List< face >, const pointField > bMesh
Holder of faceList and points. (v.s. e.g. primitivePatch which references points) ...
List< bool > boolList
A List of bools.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
const labelListList & edgeFaces() const
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
label size() const noexcept
The size of the patch.
void changeFaces(const labelList &patchIDs, labelList &oldToNew)
Recalculate face ordering and patches. Return old to new.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
static constexpr const zero Zero
Global zero (0)