50const Foam::vector Foam::boundaryMesh::splitNormal_(3, 2, 1);
53const Foam::scalar Foam::boundaryMesh::distanceTol_ = 1
e-2;
59Foam::label Foam::boundaryMesh::nFeatureEdges(label pointi)
const
67 label edgeI = pEdges[pEdgeI];
69 if (edgeToFeature_[edgeI] != -1)
79Foam::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);
196void Foam::boundaryMesh::markEdges
198 const label maxDistance,
209 if (minDistance[edgeI] == -1)
212 visited.append(edgeI);
214 else if (minDistance[edgeI] <=
distance)
227 forAll(startEdges, pEdgeI)
257Foam::label Foam::boundaryMesh::findPatchID
260 const word& patchName
281 names[patchi] = patches_[patchi].name();
287Foam::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);
381void Foam::boundaryMesh::markZone
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);
465 patches_.resize(
mesh.boundaryMesh().size());
468 const label nBFaces =
mesh.nBoundaryFaces();
472 meshFace_.setSize(nBFaces);
497 meshFace_[bFacei] =
pp.start() + patchFacei;
499 bFaces[bFacei] =
pp[patchFacei];
508 Pout<<
"read : patches now:" <<
endl;
514 Pout<<
" name : " << bp.name() <<
endl
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();
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)
648 surfPatch.geometricType()
657 patches_.resize(regionToBoundaryPatch.size());
680 const labelList& indices = regions.indices();
684 meshFace_.setSize(surf.
size());
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];
705 if (tri.region() != surfRegion)
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);
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);
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++];
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;
983 scalar area =
mag(
n);
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;
1113 Map<word> indexToName(2*patches_.size());
1116 label nNewPatches = patches_.size();
1118 forAll(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)
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)
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:"
1201 << oldPatch.name() <<
endl;
1209 newMesh.boundaryMesh(),
1216 meshFacei += facesToBeDone;
1226 Pout<<
"Patchify : new polyPatch list:" <<
endl;
1228 forAll(newPatches, patchi)
1230 const polyPatch& newPatch = newPatches[patchi];
1234 Pout<<
"polyPatch:" << newPatch.name() <<
endl
1235 <<
" type :" << newPatch.typeName <<
endl
1236 <<
" size :" << newPatch.size() <<
endl
1237 <<
" start:" << newPatch.start() <<
endl
1238 <<
" index:" << patchi <<
endl;
1245 polyMeshRepatcher.changePatches(newPatches);
1251 if (newPatches.size())
1256 label nAvgFaces = newMesh.nBoundaryFaces() / nNewPatches;
1258 forAll(patchFaces, newPatchi)
1260 patchFaces[newPatchi].setCapacity(nAvgFaces);
1268 forAll(oldPatches, oldPatchi)
1272 forAll(patch, patchFacei)
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;
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;
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);
1524Foam::label Foam::boundaryMesh::whichPatch(
const label facei)
const
1537 <<
"Cannot find face " << facei <<
" in list of boundaryPatches "
1545Foam::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;
1576 patches_.set(patchi, bpPtr);
1580 Pout<<
"addPatch : patches now:" <<
endl;
1586 Pout<<
" name : " << bp.name() <<
endl
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()
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;
1639 Pout<<
" name : " << bp.name() <<
endl
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
1673 if (patchi == changeI)
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
1726 <<
"PatchID " <<
patchID <<
" out of range"
1739 for (label patchi = 1; patchi < patches_.size(); patchi++)
1741 startFace[patchi] = startFace[patchi-1] + nFaces[patchi-1];
1764 patches_ = newPatches;
1768 Pout<<
"changeFaces : patches now:" <<
endl;
1774 Pout<<
" name : " << bp.name() <<
endl
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;
1870 const face&
f =
mesh()[facei];
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,
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++)
1937 const face&
f = patch.localFaces()[i];
1940 faceList triFaces(
f.nTriangles(patch.localPoints()));
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;
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void append(const T &val)
Copy append an element to the end of this list.
DynamicList< T, SizeMin > & shrink()
Calls shrink_to_fit() and returns a reference to the DynamicList.
A HashTable similar to std::unordered_map.
bool found(const Key &key) const
Same as contains().
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.
label size() const noexcept
The number of elements in the list.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
bool set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
void append(const T &val)
Append an element at the end of the list.
void setSize(label n)
Alias for resize().
void clear()
Clear the list, i.e. set size to zero.
A HashTable to objects of type <T> with a label key.
Output to file stream as an OSstream, normally using std::ofstream for the actual output.
label index() const noexcept
Return the hit index.
bool hit() const noexcept
Is there a hit?
const point_type & point() const noexcept
Return point, no checks.
const labelListList & pointEdges() const
Return point-edge addressing.
const Field< point_type > & localPoints() const
Return pointField of points in patch.
const Field< point_type > & points() const noexcept
Return reference to global points.
const List< face_type > & localFaces() const
Return patch faces addressing into local point list.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie,...
A list that is sorted upon construction or when explicitly requested with the sort() method.
const labelList & indices() const noexcept
Return the list of sorted indices. Updated every sort.
void sort()
Forward (stable) sort the list (if changed after construction).
A non-owning sub-view of a List (allocated or unallocated storage).
A List with indirect addressing. Like IndirectList but does not store addressing.
bool empty() const noexcept
True if List is empty (ie, size() is zero).
iterator end() noexcept
Return an iterator to end traversing the UList.
void size(const label n)
Older name for setAddressableSize.
label size() const noexcept
The number of entries in the list.
const Cmpt & x() const noexcept
Access to the vector x component.
scalar dist(const Vector< Cmpt > &v2) const
The L2-norm distance from another vector. The mag() of the difference.
const Cmpt & z() const noexcept
Access to the vector z component.
const Cmpt & y() const noexcept
Access to the vector y component.
const point & max() const noexcept
Maximum describing the bounding box.
const point & min() const noexcept
Minimum describing the bounding box.
scalar avgDim() const
Average length/height/width dimension.
Addressing for all faces on surface of mesh. Can either be read from polyMesh or from triSurface....
void addPatch(const word &patchName)
Add to back of patch list.
void writeTriSurface(const fileName &) const
Write to file.
void setFeatureEdges(const scalar minCos)
Set featureEdges, edgeToFeature, featureSegments according.
label getNTris(const label facei) const
Simple triangulation of face subset. Returns number of triangles.
void setExtraEdges(const label edgeI)
Set extraEdges to edges 'near' to edgeI. Uses point-edge walk.
void readTriSurface(const fileName &)
Read from triSurface.
void triangulate(const label startFacei, const label nFaces, const label totalNTris, labelList &triVerts) const
Simple triangulation of face subset. TotalNTris is total number.
void deletePatch(const word &patchName)
Delete from patch list.
wordList patchNames() const
Get names of patches.
boundaryMesh()
Default construct.
void triangulateLocal(const label startFacei, const label nFaces, const label totalNTris, labelList &triVerts, labelList &localToGlobal) const
Same as triangulate but in local vertex numbering.
labelList getNearest(const primitiveMesh &pMesh, const vector &searchSpan) const
Get bMesh index of nearest face for every boundary face in.
const bMesh & mesh() const
void changeFaces(const labelList &patchIDs, labelList &oldToNew)
Recalculate face ordering and patches. Return old to new.
label getNPoints(const label startFacei, const label nFaces) const
Number of points used in face subset.
void markFaces(const labelList &protectedEdges, const label facei, boolList &visited) const
void read(const polyMesh &)
Read from boundaryMesh of polyMesh.
void patchify(const labelList &nearest, const polyBoundaryMesh &oldPatches, polyMesh &newMesh) const
Take over patches onto polyMesh from nearest face in *this.
void changePatchType(const word &patchName, const word &type)
Change patch.
Like polyPatch but without reference to mesh. Used in boundaryMesh to hold data on patches....
label size() const noexcept
The size of the patch.
label start() const noexcept
The start of the patch.
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
A subset of mesh faces organised as a primitive patch.
A face is a list of labels corresponding to mesh vertices.
A class for handling file names.
Identifies a surface patch/zone by name and index, with geometric type.
const word & geometricType() const noexcept
The geometric type of the patch/zone.
static constexpr const char *const emptyType
The name for an 'empty' type.
const word & name() const noexcept
The patch/zone name.
static word defaultName(const label n=-1)
Default patch name: "patch" or "patchN".
Non-pointer based hierarchical recursive searching.
A triFace with additional (region) index.
label region() const noexcept
Return the region index.
const word & physicalType() const noexcept
The (optional) physical type of the patch.
label index() const noexcept
The index of this patch in the boundaryMesh.
const word & name() const noexcept
The patch name.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
Mesh consisting of general polyhedral cells.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
virtual const pointField & points() const
Return raw points.
A patch is a list of labels that address the faces in the global face list.
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.
virtual autoPtr< polyPatch > clone(const labelList &faceCells) const
Construct and return a clone, setting faceCells.
label start() const noexcept
Return start label of this patch in the polyMesh face list.
Cell-face mesh analysis engine.
label nBoundaryFaces() const noexcept
Number of boundary faces (== nFaces - nInternalFaces).
const labelListList & pointEdges() const
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
const vectorField & faceCentres() const
virtual const faceList & faces() const =0
Return faces.
label nInternalFaces() const noexcept
Number of internal faces.
const labelListList & edgeFaces() const
const labelListList & faceEdges() const
const vectorField & faceAreas() const
virtual const pointField & points() const =0
Return mesh points.
A mesh which allows changes in the patch distribution of the boundary faces. The change in patching i...
void changePatchID(const label faceID, const label patchID)
Change patch ID for a boundary face. Note: patchID should be in new numbering.
void changePatches(polyPatchList &patches)
Change patches.
void repatch()
Re-patch the mesh.
Standard boundBox with extra functionality for use in octree.
Encapsulation of data needed to search on PrimitivePatches.
Triangulated surface description with patch information.
void write(Ostream &os) const
Write to Ostream in simple OpenFOAM format.
const geometricSurfacePatchList & patches() const noexcept
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const polyBoundaryMesh & patches
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Namespace for handling debugging switches.
const std::string patch
OpenFOAM patch number as a std::string.
scalar distance(const vector &p1, const vector &p2)
PtrList< polyPatch > polyPatchList
Store lists of polyPatch as a PtrList.
List< word > wordList
List of word.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensionedScalar sign(const dimensionedScalar &ds)
List< label > labelList
A List of labels.
PrimitivePatch< SubList< face >, const pointField & > primitivePatch
A PrimitivePatch with a SubList addressing for the faces, const reference for the point field.
List< face > faceList
List of faces.
Ostream & endl(Ostream &os)
Add newline and flush stream.
PrimitivePatch< List< face >, const pointField & > primitiveFacePatch
A PrimitivePatch with List storage for the faces, const reference for the point field.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
errorManip< error > abort(error &err)
Field< vector > vectorField
Specialisation of Field<T> for vector.
vector point
Point is a vector.
List< geometricSurfacePatch > geometricSurfacePatchList
List of geometricSurfacePatch.
List< bool > boolList
A List of bools.
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
PrimitivePatch< List< face >, const pointField > bMesh
Holder of faceList and points. (v.s. e.g. primitivePatch which references points).
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
PrimitivePatch< UIndirectList< face >, const pointField & > uindirectPrimitivePatch
A PrimitivePatch with UIndirectList for the faces, const reference for the point field.
PointIndexHit< point > pointIndexHit
A PointIndexHit with a 3D point.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
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];} pointMap[start]=pointMap[end]=Foam::min(start, end);} } 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};constexpr 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< DynamicList< face > > pFaces[nBCs]
#define forAll(list, i)
Loop across all elements in list.