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
295 const polyPatch& pp =
patches[patchi];
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);
473 meshFace_.setSize(nBFaces);
498 meshFace_[bFacei] = pp.
start() + patchFacei;
500 bFaces[bFacei] = pp[patchFacei];
509 Pout<<
"read : patches now:" <<
endl;
513 const boundaryPatch& bp = patches_[patchi];
516 <<
" size : " << bp.size() <<
endl 517 <<
" start : " << bp.start() <<
endl 518 <<
" type : " << bp.physicalType() <<
endl 535 new bMesh(globalPatch.localFaces(), globalPatch.localPoints())
540 const bMesh& msh = *meshPtr_;
542 Pout<<
"** Start of Faces **" <<
endl;
546 const face&
f = msh[facei];
552 ctr += msh.points()[
f[fp]];
562 Pout<<
"** End of Faces **" <<
endl;
564 Pout<<
"** Start of Points **" <<
endl;
566 forAll(msh.points(), pointi)
569 <<
" coord:" << msh.points()[pointi]
573 Pout<<
"** End of Points **" <<
endl;
577 featurePoints_.clear();
578 featureEdges_.clear();
580 featureToEdge_.clear();
581 edgeToFeature_.resize(meshPtr_->nEdges());
584 featureSegments_.clear();
599 SortableList<label> regions(surf.
size());
603 regions[triI] = surf[triI].region();
608 Map<label> regionToBoundaryPatch;
610 label oldRegion = -1111;
611 label boundPatch = 0;
615 if (regions[i] != oldRegion)
617 regionToBoundaryPatch.insert(regions[i], boundPatch);
619 oldRegion = regions[i];
628 if (surfPatches.size() == regionToBoundaryPatch.size())
633 patches_.setSize(surfPatches.size());
636 forAll(surfPatches, patchi)
638 const geometricSurfacePatch& surfPatch = surfPatches[patchi];
649 surfPatch.geometricType()
658 patches_.setSize(regionToBoundaryPatch.size());
681 const labelList& indices = regions.indices();
690 label surfRegion = regions[0];
691 label foamRegion = regionToBoundaryPatch[surfRegion];
693 Pout<<
"Surface region " << surfRegion <<
" becomes boundary patch " 694 << foamRegion <<
" with name " << patches_[foamRegion].
name() <<
endl;
698 label startFacei = 0;
702 label triI = indices[indexI];
704 const labelledTri& tri = surf.
localFaces()[triI];
706 if (tri.region() != surfRegion)
709 boundaryPatch& bp = patches_[foamRegion];
711 bp.size() = bFacei - startFacei;
712 bp.start() = startFacei;
714 surfRegion = tri.region();
715 foamRegion = regionToBoundaryPatch[surfRegion];
717 Pout<<
"Surface region " << surfRegion <<
" becomes boundary patch " 718 << foamRegion <<
" with name " << patches_[foamRegion].
name()
724 meshFace_[bFacei] = triI;
726 bFaces[bFacei++] = face(tri);
730 boundaryPatch& bp = patches_[foamRegion];
732 bp.size() = bFacei - startFacei;
733 bp.start() = startFacei;
745 featurePoints_.clear();
746 featureEdges_.clear();
748 featureToEdge_.clear();
749 edgeToFeature_.resize(meshPtr_->nEdges());
752 featureSegments_.clear();
765 surfPatches[patchi] =
781 label totalNTris = getNTris(0,
mesh().size(), nTris);
790 startTri[facei] = triI;
792 triI += nTris[facei];
798 triangulate(0,
mesh().size(), totalNTris, triVerts);
802 List<labelledTri> tris(totalNTris);
808 const boundaryPatch& bp = patches_[patchi];
812 label facei = bp.start() + patchFacei;
814 label triVertI = 3*startTri[facei];
816 for (label faceTriI = 0; faceTriI < nTris[facei]; faceTriI++)
818 label v0 = triVerts[triVertI++];
819 label v1 = triVerts[triVertI++];
820 label v2 = triVerts[triVertI++];
822 tris[triI++] = labelledTri(v0, v1, v2, patchi);
827 triSurface surf(tris, surfPatches,
mesh().
points());
829 OFstream surfStream(fName);
831 surf.
write(surfStream);
861 scalar
sign =
mesh().faceNormals()[bFacei] & splitNormal_;
865 rightFaces.
append(bFacei);
878 Pout<<
"getNearest :" 879 <<
" rightBin:" << rightFaces.
size()
880 <<
" leftBin:" << leftFaces.
size()
901 scalar tol = 1
e-6 * overallBb.
avgDim();
913 const scalar planarTol =
954 Pout<<
"getNearest : built trees" <<
endl;
967 const scalar searchDimSqr =
magSqr(searchSpan);
969 forAll(nearestBFacei, patchFacei)
975 if (
debug && (patchFacei % 1000) == 0)
977 Pout<<
"getNearest : patchFace:" << patchFacei
978 <<
" meshFacei:" << meshFacei <<
" ctr:" << ctr <<
endl;
987 scalar typDim = -GREAT;
996 pointIndexHit rightInfo = rightTree.findNearest(ctr, searchDimSqr);
1000 pointIndexHit leftInfo = leftTree.findNearest(ctr, searchDimSqr);
1002 if (rightInfo.
hit())
1007 label rightFacei = rightFaces[rightInfo.
index()];
1008 label leftFacei = leftFaces[leftInfo.
index()];
1010 label rightDist = rightInfo.
point().dist(ctr);
1011 label leftDist = leftInfo.
point().dist(ctr);
1013 scalar rightSign =
n & ns[rightFacei];
1014 scalar leftSign =
n & ns[leftFacei];
1018 (rightSign > 0 && leftSign > 0)
1019 || (rightSign < 0 && leftSign < 0)
1023 if (rightDist < leftDist)
1025 nearestBFacei[patchFacei] = rightFacei;
1029 nearestBFacei[patchFacei] = leftFacei;
1041 typDim *= distanceTol_;
1043 if (rightDist < typDim && leftDist < typDim)
1048 nearestBFacei[patchFacei] = rightFacei;
1052 nearestBFacei[patchFacei] = leftFacei;
1058 if (rightDist < leftDist)
1060 nearestBFacei[patchFacei] = rightFacei;
1064 nearestBFacei[patchFacei] = leftFacei;
1073 label rightFacei = rightFaces[rightInfo.
index()];
1074 nearestBFacei[patchFacei] = rightFacei;
1085 nearestBFacei[patchFacei] = leftFaces[leftInfo.
index()];
1090 nearestBFacei[patchFacei] = -1;
1095 return nearestBFacei;
1102 const polyBoundaryMesh& oldPatches,
1112 HashTable<label> nameToIndex(2*patches_.size());
1114 Map<word> indexToName(2*patches_.size());
1117 label nNewPatches = patches_.size();
1119 forAll(oldPatches, oldPatchi)
1121 const polyPatch&
patch = oldPatches[oldPatchi];
1122 const label newPatchi = findPatchID(
patch.name());
1124 if (newPatchi != -1)
1126 nameToIndex.insert(
patch.name(), newPatchi);
1127 indexToName.insert(newPatchi,
patch.name());
1133 forAll(patches_, bPatchi)
1135 const boundaryPatch& bp = patches_[bPatchi];
1137 if (!nameToIndex.found(bp.name()))
1139 nameToIndex.insert(bp.name(), bPatchi);
1140 indexToName.insert(bPatchi, bp.name());
1152 label meshFacei = newMesh.nInternalFaces();
1155 label facesToBeDone = newMesh.nBoundaryFaces();
1157 forAll(patches_, bPatchi)
1159 const boundaryPatch& bp = patches_[bPatchi];
1161 const label newPatchi = nameToIndex[bp.name()];
1164 const label oldPatchi = findPatchID(oldPatches, bp.name());
1166 if (oldPatchi == -1)
1171 Pout<<
"patchify : Creating new polyPatch:" << bp.
name()
1172 <<
" type:" << bp.physicalType() <<
endl;
1185 newMesh.boundaryMesh()
1189 meshFacei += facesToBeDone;
1197 const polyPatch& oldPatch = oldPatches[oldPatchi];
1201 Pout<<
"patchify : Cloning existing polyPatch:" 1210 newMesh.boundaryMesh(),
1217 meshFacei += facesToBeDone;
1227 Pout<<
"Patchify : new polyPatch list:" <<
endl;
1229 forAll(newPatches, patchi)
1231 const polyPatch& newPatch = newPatches[patchi];
1236 <<
" type :" << newPatch.typeName <<
endl 1237 <<
" size :" << newPatch.size() <<
endl 1238 <<
" start:" << newPatch.start() <<
endl 1239 <<
" index:" << patchi <<
endl;
1245 repatchPolyTopoChanger polyMeshRepatcher(newMesh);
1246 polyMeshRepatcher.changePatches(newPatches);
1252 if (newPatches.size())
1254 List<DynamicList<label>> patchFaces(nNewPatches);
1257 label nAvgFaces = newMesh.nBoundaryFaces() / nNewPatches;
1259 forAll(patchFaces, newPatchi)
1261 patchFaces[newPatchi].setCapacity(nAvgFaces);
1269 forAll(oldPatches, oldPatchi)
1271 const polyPatch&
patch = oldPatches[oldPatchi];
1277 label meshFacei =
patch.start() + patchFacei;
1279 label bFacei = meshFacei - newMesh.nInternalFaces();
1281 patchFaces[whichPatch(nearest[bFacei])].append(meshFacei);
1285 forAll(patchFaces, newPatchi)
1287 patchFaces[newPatchi].shrink();
1294 for (label newPatchi = 1; newPatchi < patchFaces.size(); newPatchi++)
1300 polyMeshRepatcher.changePatchID(
pFaces[pFacei], newPatchi);
1304 polyMeshRepatcher.repatch();
1311 edgeToFeature_.setSize(
mesh().nEdges());
1313 edgeToFeature_ = -1;
1318 featureToEdge_.setSize(
mesh().nEdges());
1322 if (minCos >= 0.9999)
1327 edgeToFeature_[edgeI] = featureI;
1328 featureToEdge_[featureI++] = edgeI;
1337 if (eFaces.size() == 2)
1339 label face0I = eFaces[0];
1341 label face1I = eFaces[1];
1352 const vector& n0 =
mesh().faceNormals()[face0I];
1354 const vector& n1 =
mesh().faceNormals()[face1I];
1356 float cosAng = n0 & n1;
1358 if (cosAng < minCos)
1360 edgeToFeature_[edgeI] = featureI;
1361 featureToEdge_[featureI++] = edgeI;
1368 edgeToFeature_[edgeI] = featureI;
1369 featureToEdge_[featureI++] = edgeI;
1375 featureToEdge_.setSize(featureI);
1381 featureEdges_.setSize(featureI);
1388 forAll(featureToEdge_, fEdgeI)
1390 label edgeI = featureToEdge_[fEdgeI];
1394 label start = featToMeshPoint[
e.start()];
1398 featToMeshPoint[
e.start()] = featPtI;
1400 featurePoints_[featPtI] =
mesh().
points()[
e.start()];
1407 label
end = featToMeshPoint[
e.end()];
1411 featToMeshPoint[
e.end()] = featPtI;
1413 featurePoints_[featPtI] =
mesh().
points()[
e.end()];
1421 featureEdges_[fEdgeI] = edge(start,
end);
1425 featurePoints_.setSize(featPtI);
1437 forAll(featureToEdge_, featI)
1439 label edgeI = featureToEdge_[featI];
1443 if (nFeatureEdges(
e.start()) != 2)
1445 isFeaturePoint[
e.start()] =
true;
1448 if (nFeatureEdges(
e.end()) != 2)
1450 isFeaturePoint[
e.end()] =
true;
1460 DynamicList<labelList> segments;
1463 boolList featVisited(featureToEdge_.size(),
false);
1467 label startFeatI = -1;
1469 forAll(featVisited, featI)
1471 if (!featVisited[featI])
1479 if (startFeatI == -1)
1490 featureToEdge_[startFeatI],
1501 featureSegments_.setSize(segments.size());
1505 featureSegments_[segmentI] = segments[segmentI];
1515 DynamicList<label> visitedEdges;
1518 markEdges(8, edgeI, 0, minDistance, visitedEdges);
1521 extraEdges_.transfer(visitedEdges);
1525 Foam::label Foam::boundaryMesh::whichPatch(
const label facei)
const 1538 <<
"Cannot find face " << facei <<
" in list of boundaryPatches " 1546 Foam::label Foam::boundaryMesh::findPatchID(
const word& patchName)
const 1550 if (patches_[patchi].
name() == patchName)
1562 patches_.setSize(patches_.size() + 1);
1566 label patchi = patches_.size()-1;
1568 boundaryPatch* bpPtr =
new boundaryPatch
1577 patches_.set(patchi, bpPtr);
1581 Pout<<
"addPatch : patches now:" <<
endl;
1585 const boundaryPatch& bp = patches_[patchi];
1588 <<
" size : " << bp.size() <<
endl 1589 <<
" start : " << bp.start() <<
endl 1590 <<
" type : " << bp.physicalType() <<
endl 1599 const label delPatchi = findPatchID(patchName);
1601 if (delPatchi == -1)
1604 <<
"Can't find patch named " << patchName
1608 if (patches_[delPatchi].size())
1611 <<
"Trying to delete non-empty patch " << patchName
1612 <<
endl <<
"Current size:" << patches_[delPatchi].size()
1616 PtrList<boundaryPatch> newPatches(patches_.size() - 1);
1618 for (label patchi = 0; patchi < delPatchi; patchi++)
1620 newPatches.set(patchi, patches_[patchi].clone());
1625 for (label patchi = delPatchi + 1; patchi < patches_.size(); patchi++)
1627 newPatches.set(patchi - 1, patches_[patchi].clone());
1632 patches_ = newPatches;
1636 Pout<<
"deletePatch : patches now:" <<
endl;
1640 const boundaryPatch& bp = patches_[patchi];
1643 <<
" size : " << bp.size() <<
endl 1644 <<
" start : " << bp.start() <<
endl 1645 <<
" type : " << bp.physicalType() <<
endl 1654 const word& patchName,
1655 const word& patchType
1658 const label changeI = findPatchID(patchName);
1663 <<
"Can't find patch named " << patchName
1672 PtrList<boundaryPatch> newPatches(patches_.size());
1676 if (patchi == changeI)
1679 const boundaryPatch& oldBp = patches_[patchi];
1681 boundaryPatch* bpPtr =
new boundaryPatch
1690 newPatches.set(patchi, bpPtr);
1695 newPatches.set(patchi, patches_[patchi].clone());
1699 patches_ = newPatches;
1709 if (patchIDs.size() !=
mesh().
size())
1712 <<
"List of patchIDs not equal to number of faces." <<
endl 1713 <<
"PatchIDs size:" << patchIDs.size()
1724 label
patchID = patchIDs[facei];
1726 if (patchID < 0 || patchID >= patches_.size())
1729 <<
"PatchID " <<
patchID <<
" out of range" 1742 for (label patchi = 1; patchi < patches_.size(); patchi++)
1744 startFace[patchi] = startFace[patchi-1] + nFaces[patchi-1];
1748 PtrList<boundaryPatch> newPatches(patches_.size());
1752 const boundaryPatch& bp = patches_[patchi];
1767 patches_ = newPatches;
1771 Pout<<
"changeFaces : patches now:" <<
endl;
1775 const boundaryPatch& bp = patches_[patchi];
1778 <<
" size : " << bp.size() <<
endl 1779 <<
" start : " << bp.start() <<
endl 1780 <<
" type : " << bp.physicalType() <<
endl 1787 oldToNew.setSize(patchIDs.size());
1791 int patchID = patchIDs[facei];
1793 oldToNew[facei] = startFace[
patchID]++;
1803 newFaces[oldToNew[facei]] =
mesh()[facei];
1804 newMeshFace[oldToNew[facei]] = meshFace_[facei];
1809 std::unique_ptr<bMesh> newMeshPtr(
new bMesh(newFaces,
mesh().
points()));
1812 meshFace_.transfer(newMeshFace);
1819 meshPtr_ = std::move(newMeshPtr);
1833 const label startFacei,
1838 label totalNTris = 0;
1842 for (label i = 0; i < nFaces; i++)
1844 label faceNTris = getNTris(startFacei + i);
1846 nTris[i] = faceNTris;
1848 totalNTris += faceNTris;
1858 const label startFacei,
1860 const label totalNTris,
1865 triVerts.
setSize(3*totalNTris);
1869 for (label i = 0; i < nFaces; i++)
1871 label facei = startFacei + i;
1884 forAll(triFaces, triFacei)
1886 const face& triF = triFaces[triFacei];
1888 triVerts[vertI++] = triF[0];
1889 triVerts[vertI++] = triF[1];
1890 triVerts[vertI++] = triF[2];
1899 const label startFacei,
1905 SubList<face>(
mesh(), nFaces, startFacei),
1909 return patch.nPoints();
1916 const label startFacei,
1918 const label totalNTris,
1930 localToGlobal =
patch.meshPoints();
1933 triVerts.
setSize(3*totalNTris);
1937 for (label i = 0; i < nFaces; i++)
1947 f.triangles(
patch.localPoints(), nTri, triFaces);
1951 forAll(triFaces, triFacei)
1953 const face& triF = triFaces[triFacei];
1955 triVerts[vertI++] = triF[0];
1956 triVerts[vertI++] = triF[1];
1957 triVerts[vertI++] = triF[2];
1966 const label seedFacei,
1972 forAll(protectedEdges, i)
1974 protectedEdge[protectedEdges[i]] =
true;
1982 markZone(protectedEdge, seedFacei, 0, currentZone);
1985 visited.setSize(
mesh().size());
1987 forAll(currentZone, facei)
1989 if (currentZone[facei] == 0)
1991 visited[facei] =
true;
1995 visited[facei] =
false;
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
dimensionedScalar sign(const dimensionedScalar &ds)
const labelListList & pointEdges() const
Return point-edge addressing.
virtual const fileName & name() const
Get the name of the output serial stream. (eg, the name of the Fstream file name) ...
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.
List< geometricSurfacePatch > geometricSurfacePatchList
A List of geometricSurfacePatch.
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 the UList is empty (ie, size() is zero)
List< face > faceList
A List of faces.
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)
label size() const noexcept
The number of elements in table.
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.
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".
PtrList< polyPatch > polyPatchList
Store lists of polyPatch as a PtrList.
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 INVALID.
const wordList area
Standard area field types (scalar, vector, tensor, etc)
void clear()
Clear the list, i.e. set size to zero.
A class for handling words, derived from Foam::string.
label size() const noexcept
The number of elements 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()
Shrink the allocated space to the number of elements used.
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.
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
A List of words.
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.
label start() const
Return start label of this patch in the polyMesh face list.
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.
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)
void changeFaces(const labelList &patchIDs, labelList &oldToNew)
Recalculate face ordering and patches. Return old to new.
static constexpr const zero Zero
Global zero (0)