52 void Foam::triSurfaceTools::calcRefineStatus
54 const triSurface& surf,
56 List<refineType>& refine
59 if (refine[facei] == RED)
68 const labelList& myNeighbours = surf.faceFaces()[facei];
70 forAll(myNeighbours, myNeighbourI)
72 label neighbourFacei = myNeighbours[myNeighbourI];
74 if (refine[neighbourFacei] == GREEN)
77 calcRefineStatus(surf, neighbourFacei, refine);
79 else if (refine[neighbourFacei] == NONE)
81 refine[neighbourFacei] = GREEN;
89 void Foam::triSurfaceTools::greenRefine
91 const triSurface& surf,
94 const label newPointi,
95 DynamicList<labelledTri>& newFaces
98 const labelledTri& f = surf.localFaces()[facei];
99 const edge& e = surf.edges()[edgeI];
104 label fp1 = f.fcIndex(fp0);
105 label fp2 = f.fcIndex(fp1);
160 const triSurface& surf,
161 const List<refineType>& refineStatus
165 DynamicList<point> newPoints(surf.nPoints());
166 forAll(surf.localPoints(), pointi)
168 newPoints.append(surf.localPoints()[pointi]);
170 label newVertI = surf.nPoints();
173 DynamicList<labelledTri> newFaces(surf.size());
179 forAll(refineStatus, facei)
181 if (refineStatus[facei] == RED)
184 const labelList& fEdges = surf.faceEdges()[facei];
188 label edgeI = fEdges[i];
190 if (edgeMid[edgeI] == -1)
192 const edge& e = surf.edges()[edgeI];
199 surf.localPoints()[e.start()]
200 + surf.localPoints()[e.end()]
203 edgeMid[edgeI] = newVertI++;
210 const edgeList& edges = surf.edges();
218 edges[fEdges[0]].commonVertex(edges[fEdges[1]]),
229 edges[fEdges[1]].commonVertex(edges[fEdges[2]]),
240 edges[fEdges[2]].commonVertex(edges[fEdges[0]]),
262 const label edgeI = fEdges[i];
266 if ((otherFacei != -1) && (refineStatus[otherFacei] == GREEN))
282 forAll(refineStatus, facei)
284 if (refineStatus[facei] == NONE)
286 newFaces.append(surf.localFaces()[facei]);
296 allPoints.transfer(newPoints);
299 return triSurface(newFaces, surf.patches(),
allPoints,
true);
305 Foam::scalar Foam::triSurfaceTools::faceCosAngle
313 const vector common(pEnd - pStart);
314 const vector base0(pLeft - pStart);
315 const vector base1(pRight - pStart);
317 vector n0(common ^ base0);
320 vector n1(base1 ^ common);
331 void Foam::triSurfaceTools::protectNeighbours
333 const triSurface& surf,
349 const labelList& myEdges = surf.pointEdges()[vertI];
352 const labelList& myFaces = surf.edgeFaces()[myEdges[i]];
356 label facei = myFaces[myFacei];
358 if ((faceStatus[facei] ==
ANYEDGE) || (faceStatus[facei] >= 0))
360 faceStatus[facei] =
NOEDGE;
374 const triSurface& surf,
378 const edge& e = surf.edges()[edgeI];
379 label v1 = e.start();
383 const labelList& myFaces = surf.edgeFaces()[edgeI];
389 facesToBeCollapsed.insert(myFaces[myFacei]);
396 const labelList& v1Faces = surf.pointFaces()[v1];
400 label face1I = v1Faces[v1Facei];
414 facesToBeCollapsed.insert(face1I);
415 facesToBeCollapsed.insert(face2I);
420 return facesToBeCollapsed;
427 const triSurface& surf,
432 const labelList& myFaces = surf.pointFaces()[vertI];
436 label face1I = myFaces[myFacei];
438 if (faceUsed.found(face1I))
448 void Foam::triSurfaceTools::getMergedEdges
450 const triSurface& surf,
453 HashTable<
label,
label, Hash<label>>& edgeToEdge,
454 HashTable<
label,
label, Hash<label>>& edgeToFace
457 const edge& e = surf.edges()[edgeI];
458 label v1 = e.start();
461 const labelList& v1Faces = surf.pointFaces()[v1];
462 const labelList& v2Faces = surf.pointFaces()[v2];
469 if (!collapsedFaces.found(v2Faces[v2Facei]))
471 v2FacesHash.insert(v2Faces[v2Facei]);
478 label face1I = v1Faces[v1Facei];
480 if (collapsedFaces.found(face1I))
504 label commonVert = vert1I;
505 label face2I = vertexUsesFace(surf, v2FacesHash, commonVert);
509 face2I = vertexUsesFace(surf, v2FacesHash, commonVert);
518 edgeToEdge.insert(edge1I, edge2I);
519 edgeToEdge.insert(edge2I, edge1I);
521 edgeToFace.insert(edge1I, face2I);
522 edgeToFace.insert(edge2I, face1I);
530 Foam::scalar Foam::triSurfaceTools::edgeCosAngle
532 const triSurface& surf,
536 const HashTable<
label,
label, Hash<label>>& edgeToEdge,
537 const HashTable<
label,
label, Hash<label>>& edgeToFace,
542 const pointField& localPoints = surf.localPoints();
544 label A = surf.edges()[edgeI].start();
545 label B = surf.edges()[edgeI].end();
552 if (edgeToEdge.found(edgeI))
555 label edge2I = edgeToEdge[edgeI];
556 face2I = edgeToFace[edgeI];
565 if ((face2I != -1) && !collapsedFaces.found(face2I))
577 cosAngle = faceCosAngle
587 cosAngle = faceCosAngle
597 cosAngle = faceCosAngle
607 cosAngle = faceCosAngle
618 <<
"face " << facei <<
" does not use vertex " 626 Foam::scalar Foam::triSurfaceTools::collapseMinCosAngle
628 const triSurface& surf,
632 const HashTable<
label,
label, Hash<label>>& edgeToEdge,
633 const HashTable<
label,
label, Hash<label>>& edgeToFace
636 const labelList& v1Faces = surf.pointFaces()[v1];
642 label facei = v1Faces[v1Facei];
644 if (collapsedFaces.found(facei))
649 const labelList& myEdges = surf.faceEdges()[facei];
653 label edgeI = myEdges[myEdgeI];
680 bool Foam::triSurfaceTools::collapseCreatesFold
682 const triSurface& surf,
686 const HashTable<
label,
label, Hash<label>>& edgeToEdge,
687 const HashTable<
label,
label, Hash<label>>& edgeToFace,
691 const labelList& v1Faces = surf.pointFaces()[v1];
695 label facei = v1Faces[v1Facei];
697 if (collapsedFaces.found(facei))
702 const labelList& myEdges = surf.faceEdges()[facei];
706 label edgeI = myEdges[myEdgeI];
843 const label excludeEdgeI,
844 const label excludePointi,
846 const point& triPoint,
847 const plane& cutPlane,
852 const labelledTri& f = s[triI];
853 const labelList& fEdges = s.faceEdges()[triI];
856 FixedList<scalar, 3> d;
861 d[fp] = (points[f[fp]]-cutPlane.refPoint()) & cutPlane.normal();
870 if (
mag(d[i]) < 1e-6)
879 if (excludePointi != -1)
891 label fp1 = f.fcIndex(fp0);
892 label fp2 = f.fcIndex(fp1);
898 cut.setPoint(points[f[fp1]]);
900 cut.setIndex(s.localFaces()[triI][fp1]);
902 else if (d[fp2] == 0.0)
905 cut.setPoint(points[f[fp2]]);
907 cut.setIndex(s.localFaces()[triI][fp2]);
911 (d[fp1] < 0 && d[fp2] < 0)
912 || (d[fp1] > 0 && d[fp2] > 0)
923 (d[fp2]*points[f[fp1]] - d[fp1]*points[f[fp2]])
927 cut.setIndex(fEdges[fp1]);
933 FixedList<surfaceLocation, 2> inters;
938 label fp1 = f.fcIndex(fp0);
945 <<
"problem : triangle has three intersections." <<
nl 946 <<
"triangle:" << f.tri(points)
949 inters[interI].setHit();
950 inters[interI].setPoint(points[f[fp0]]);
952 inters[interI].setIndex(s.localFaces()[triI][fp0]);
957 (d[fp0] < 0 && d[fp1] > 0)
958 || (d[fp0] > 0 && d[fp1] < 0)
964 <<
"problem : triangle has three intersections." <<
nl 965 <<
"triangle:" << f.tri(points)
968 inters[interI].setHit();
969 inters[interI].setPoint
971 (d[fp0]*points[f[fp1]] - d[fp1]*points[f[fp0]])
975 inters[interI].setIndex(fEdges[fp0]);
985 else if (interI == 1)
990 else if (interI == 2)
996 && inters[0].index() == excludeEdgeI
1004 && inters[1].index() == excludeEdgeI
1014 magSqr(inters[0].rawPoint() - toPoint)
1015 <
magSqr(inters[1].rawPoint() - toPoint)
1032 void Foam::triSurfaceTools::snapToEnd
1034 const triSurface& s,
1035 const surfaceLocation& end,
1036 surfaceLocation& current
1044 if (current.index() == end.index())
1062 const labelList& fEdges = s.faceEdges()[current.index()];
1064 if (
findIndex(fEdges, end.index()) != -1)
1078 if (current.index() == end.index())
1092 const edge& e = s.edges()[end.index()];
1094 if (current.index() == e[0] || current.index() == e[1])
1127 const edge& e = s.edges()[current.index()];
1129 if (end.index() == e[0] || end.index() == e[1])
1143 if (current.index() == end.index())
1164 const triSurface& s,
1166 const surfaceLocation& start,
1167 const label excludeEdgeI,
1168 const label excludePointi,
1169 const surfaceLocation& end,
1170 const plane& cutPlane
1173 surfaceLocation nearest;
1179 label triI = eFaces[i];
1182 if (triI != start.triangle())
1189 nearest.triangle() = triI;
1196 surfaceLocation cutInfo = cutEdge
1208 if (excludeEdgeI != -1 && !cutInfo.hit())
1211 <<
"Triangle:" << triI
1212 <<
" excludeEdge:" << excludeEdgeI
1213 <<
" point:" << start.rawPoint()
1214 <<
" plane:" << cutPlane
1220 scalar distSqr =
magSqr(cutInfo.rawPoint()-end.rawPoint());
1222 if (distSqr < minDistSqr)
1224 minDistSqr = distSqr;
1226 nearest.triangle() = triI;
1234 if (nearest.triangle() == -1)
1259 const point& pt = pts[pointi];
1261 outFile<<
"v " << pt.
x() <<
' ' << pt.
y() <<
' ' << pt.
z() <<
endl;
1263 Pout<<
"Written " << pts.
size() <<
" vertices to file " << fName <<
endl;
1278 forAll(markedVerts, vertI)
1280 if (markedVerts[vertI])
1284 outFile<<
"v " << pt.
x() <<
' ' << pt.
y() <<
' ' << pt.
z() <<
endl;
1289 Pout<<
"Written " << nVerts <<
" vertices to file " << fName <<
endl;
1308 label face1I = myFaces[0];
1310 if (myFaces.
size() == 2)
1312 face2I = myFaces[1];
1323 forAll(startFaces, startFacei)
1325 edgeTris[nTris++] = startFaces[startFacei];
1328 forAll(endFaces, endFacei)
1330 label facei = endFaces[endFacei];
1332 if ((facei != face1I) && (facei != face2I))
1334 edgeTris[nTris++] = facei;
1359 const edge& e = edges[v1Edges[v1EdgeI]];
1367 const edge& e = edges[v2Edges[v2EdgeI]];
1371 vertexNeighbours.
insert(vertI);
1373 return vertexNeighbours.
toc();
1435 if (myFaces.
size() != 2)
1441 if (facei == myFaces[0])
1470 <<
"Edge " << surf.
edges()[edgeI] <<
" not in face " 1499 else if (vertI == f[1])
1504 else if (vertI == f[2])
1529 label edgeI = myEdges[myEdgeI];
1533 if ((e.
start() != vertI) && (e.
end() != vertI))
1540 <<
"Cannot find vertex " << vertI <<
" in edges of face " << facei
1560 label vertI = f[fp];
1562 if (vertI != e.
start() && vertI != e.
end())
1569 <<
"Cannot find vertex opposite edge " << edgeI <<
" vertices " << e
1588 label edgeI = v1Edges[v1EdgeI];
1591 if ((e.
start() == v2) || (e.
end() == v2))
1609 if ((e0I == e1I) || (e0I == e2I) || (e1I == e2I))
1612 <<
"Duplicate edge labels : e0:" << e0I <<
" e1:" << e1I
1621 label facei = eFaces[eFacei];
1628 || (myEdges[1] == e1I)
1629 || (myEdges[2] == e1I)
1635 || (myEdges[1] == e2I)
1636 || (myEdges[2] == e2I)
1696 return collapseEdges(surf, collapsableEdges, edgeMids, faceStatus);
1718 forAll(localPoints, pointi)
1720 pointMap[pointi] = pointi;
1726 forAll(collapseEdgeLabels, collapseEdgeI)
1728 const label edgeI = collapseEdgeLabels[collapseEdgeI];
1730 if ((edgeI < 0) || (edgeI >= surf.
nEdges()))
1733 <<
"Edge label outside valid range." <<
endl 1734 <<
"edge label:" << edgeI <<
endl 1735 <<
"total number of edges:" << surf.
nEdges() <<
endl 1739 const labelList& neighbours = edgeFaces[edgeI];
1741 if (neighbours.
size() == 2)
1743 const label stat0 = faceStatus[neighbours[0]];
1744 const label stat1 = faceStatus[neighbours[1]];
1749 ((stat0 ==
ANYEDGE) || (stat0 == edgeI))
1750 && ((stat1 ==
ANYEDGE) || (stat1 == edgeI))
1753 const edge& e = edges[edgeI];
1759 || (pointMap[e.
end()] != e.
end())
1763 <<
"points already mapped. Double collapse." <<
endl 1764 <<
"edgeI:" << edgeI
1765 <<
" start:" << e.
start()
1766 <<
" end:" << e.
end()
1767 <<
" pointMap[start]:" << pointMap[e.
start()]
1768 <<
" pointMap[end]:" << pointMap[e.
end()]
1773 pointMap[e.
start()] = minVert;
1774 pointMap[e.
end()] = minVert;
1777 newPoints[minVert] = edgeMids[edgeI];
1780 protectNeighbours(surf, e.
start(), faceStatus);
1781 protectNeighbours(surf, e.
end(), faceStatus);
1803 forAll(collapseFaces, collapseI)
1805 faceStatus[collapseFaces[collapseI]] =
COLLAPSED;
1820 forAll(localFaces, facei)
1824 const label a = pointMap[f[0]];
1825 const label b = pointMap[f[1]];
1826 const label c = pointMap[f[2]];
1830 (a != b) && (a != c) && (b != c)
1835 newTris[newTriI++] =
labelledTri(a, b, c, f.region());
1854 tempSurf.localFaces(),
1856 tempSurf.localPoints()
1872 forAll(refineFaces, refineFacei)
1874 calcRefineStatus(surf, refineFaces[refineFacei], refineStatus);
1878 return doRefine(surf, refineStatus);
1900 forAll(refineEdges, refineEdgeI)
1902 label edgeI = refineEdges[refineEdgeI];
1906 bool neighbourIsRefined=
false;
1910 if (refineStatus[myFaces[myFacei]] != NONE)
1912 neighbourIsRefined =
true;
1917 if (!neighbourIsRefined)
1945 refineStatus[myFaces[myFacei]] = GREEN;
1955 if (refineStatus[facei] == NONE)
1980 scalar minLength = great;
1981 label minIndex = -1;
1984 const edge& e = surf.
edges()[edgeIndices[i]];
1993 if (length < minLength)
1999 return edgeIndices[minIndex];
2010 scalar maxLength = -great;
2011 label maxIndex = -1;
2014 const edge& e = surf.
edges()[edgeIndices[i]];
2023 if (length > maxLength)
2029 return edgeIndices[maxIndex];
2037 const scalar mergeTol
2059 label newTriangleI = 0;
2065 label newA = pointMap[f[0]];
2066 label newB = pointMap[f[1]];
2067 label newC = pointMap[f[2]];
2069 if ((newA != newB) && (newA != newC) && (newB != newC))
2071 newTriangles[newTriangleI++] =
2075 newTriangles.
setSize(newTriangleI);
2096 const label nearestFacei,
2097 const point& nearestPt
2103 label nearType, nearLabel;
2105 f.nearestPointClassify(nearestPt, points, nearType, nearLabel);
2126 return edgeNormal/(
mag(edgeNormal) + vSmall);
2140 const point& sample,
2141 const point& nearestPoint,
2147 if (eFaces.
size() != 2)
2159 vector n = 0.5*(faceNormals[eFaces[0]] + faceNormals[eFaces[1]]);
2161 if (((sample - nearestPoint) & n) > 0)
2177 const point& sample,
2178 const label nearestFacei
2185 label nearType, nearLabel;
2187 pointHit pHit = f.nearestPointClassify(sample, points, nearType, nearLabel);
2193 vector sampleNearestVec = (sample - nearestPoint);
2196 scalar
c = sampleNearestVec & surf.
faceNormals()[nearestFacei];
2268 return edgeSide(surf, sample, nearestPoint, edgeI);
2278 label nearPointi = localF[nearLabel];
2282 const point& base = localPoints[nearPointi];
2287 label minEdgeI = -1;
2291 label edgeI = pEdges[i];
2293 const edge& e = edges[edgeI];
2298 vector eVec(localPoints[otherPointi] - base);
2299 scalar magEVec =
mag(eVec);
2301 if (magEVec > vSmall)
2306 const point perturbPoint = base + eVec;
2310 if (distSqr < minDistSqr)
2312 minDistSqr = distSqr;
2321 <<
"Problem: did not find edge closer than " << minDistSqr
2325 return edgeSide(surf, sample, nearestPoint, minEdgeI);
2345 label newPatchi = 0;
2353 label nTriTotal = 0;
2355 forAll(patch, patchFacei)
2357 const face& f = patch[patchFacei];
2365 forAll(triFaces, triFacei)
2367 const face& f = triFaces[triFacei];
2377 Pout<< patch.
name() <<
" : generated " << nTriTotal
2378 <<
" triangles from " << patch.size() <<
" faces with" 2379 <<
" new patchid " << newPatchi <<
endl;
2392 rawSurface.localFaces(),
2393 rawSurface.localPoints()
2406 surface.patches()[newPatchi].
name() = patch.
name();
2407 surface.patches()[newPatchi].geometricType() = patch.type();
2432 label newPatchi = 0;
2440 label nTriTotal = 0;
2442 forAll(patch, patchFacei)
2444 const face& f = patch[patchFacei];
2454 forAll(triFaces, triFacei)
2456 const face& f = triFaces[triFacei];
2467 Pout<< patch.
name() <<
" : generated " << nTriTotal
2468 <<
" triangles from " << patch.size() <<
" faces with" 2469 <<
" new patchid " << newPatchi <<
endl;
2482 rawSurface.localFaces(),
2483 rawSurface.localPoints()
2496 surface.patches()[newPatchi].
name() = patch.
name();
2497 surface.patches()[newPatchi].geometricType() = patch.type();
2522 label newPointi = 0;
2526 newPoints[newPointi++] = points[pointi];
2528 forAll(faceCentres, facei)
2530 newPoints[newPointi++] = faceCentres[facei];
2540 label newPatchi = 0;
2547 label nTriTotal = 0;
2549 forAll(patch, patchFacei)
2552 const face& f = patch[patchFacei];
2561 triangles.append(
labelledTri(f[fp], f[fp1], fc, newPatchi));
2569 Pout<< patch.
name() <<
" : generated " << nTriTotal
2570 <<
" triangles from " << patch.size() <<
" faces with" 2571 <<
" new patchid " << newPatchi <<
endl;
2599 surface.patches()[newPatchi].
name() = patch.
name();
2600 surface.patches()[newPatchi].geometricType() = patch.type();
2617 geompackVertices[doubleI++] = pts[i][0];
2618 geompackVertices[doubleI++] = pts[i][1];
2631 geompackVertices.begin(),
2633 triangle_node.
begin(),
2634 triangle_neighbor.begin()
2640 <<
"Failed dtris2 with vertices:" << pts.
size()
2645 triangle_node.setSize(3*nTris);
2646 triangle_neighbor.setSize(3*nTris);
2655 triangle_node[3*i]-1,
2656 triangle_node[3*i+1]-1,
2657 triangle_node[3*i+2]-1,
2665 points[i][0] = pts[i][0];
2666 points[i][1] = pts[i][1];
2684 edge[0] = tri.
c()-tri.
b();
2685 edge[1] = tri.
a()-tri.
c();
2686 edge[2] = tri.
b()-tri.
a();
2688 vector triangleFaceNormal = edge[1] ^ edge[2];
2692 for (
label i=0; i<3; i++)
2694 normal[i] = triangleFaceNormal ^ edge[i];
2695 normal[i] /=
mag(normal[i]) + vSmall;
2698 weights[0] = ((p-tri.
b()) & normal[0]) /
max(vSmall, normal[0] & edge[1]);
2699 weights[1] = ((p-tri.
c()) & normal[1]) /
max(vSmall, normal[1] & edge[2]);
2700 weights[2] = ((p-tri.
a()) & normal[2]) /
max(vSmall, normal[2] & edge[0]);
2714 allVerts.setSize(samplePts.
size());
2715 allWeights.setSize(samplePts.
size());
2721 const point& samplePt = samplePts[i];
2727 scalar minDistance = great;
2735 label nearType, nearLabel;
2761 else if (nearest.
distance() < minDistance)
2769 verts[0] = f[nearLabel];
2772 weights[1] = -great;
2774 weights[2] = -great;
2783 verts[0] = f[nearLabel];
2784 verts[1] = f[f.
fcIndex(nearLabel)];
2787 const point& p0 = points[verts[0]];
2788 const point& p1 = points[verts[1]];
2803 weights[2] = -great;
2842 const point& trianglePoint
2848 label index, elemType;
2887 const plane& cutPlane
2895 snapToEnd(s, end, nearest);
2928 nearest = visitFaces
2943 nearest = visitFaces
2954 snapToEnd(s, end, nearest);
2964 const plane& cutPlane,
const labelListList & pointEdges() const
Return point-edge addressing.
label nPoints() const
Return number of points supporting patch faces.
A HashTable with keys but without contents.
#define forAll(list, i)
Loop across all elements in list.
A triangle primitive used to calculate face areas and swept volumes.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const word & name() const
Return name.
const word & name() const
Return name.
A class for handling file names.
const Point & c() const
Return third vertex.
A face is a list of labels corresponding to mesh vertices.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label nInternalFaces() const
dimensionedSymmTensor sqr(const dimensionedVector &dv)
void size(const label)
Override size to be inconsistent with allocated storage.
void setIndex(const label index)
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
Ostream & endl(Ostream &os)
Add newline and flush stream.
pointHit nearestPointClassify(const point &p, label &nearType, label &nearLabel) const
Find the nearest point to p on the triangle and classify it:
A bounding box defined in terms of the points at its extremities.
Vector< scalar > vector
A scalar version of the templated Vector.
label otherVertex(const label a) const
Given one vertex, return the other.
Geometric class that creates a 2D plane and can return the intersection point between a line and the ...
const Field< PointType > & localPoints() const
Return pointField of points in patch.
const dimensionedScalar & c
Speed of light in a vacuum.
bool insert(const Key &key)
Insert a new entry.
label triangles(const pointField &points, label &triI, faceList &triFaces) const
Split into triangles using existing points.
void setPoint(const Point &p)
virtual const pointField & points() const
Return raw points.
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
vectorField pointField
pointField is a vectorField.
triPointRef::proxType & elementType()
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
const dimensionedScalar & b
Wien displacement law constant: default SI units: [m K].
void append(const T &)
Append an element at the end of the list.
iterator begin()
Return an iterator to begin traversing the UList.
bool hit() const
Is there a hit.
const Field< PointType > & points() const
Return reference to global points.
const polyMesh & mesh() const
Return the mesh reference.
const labelListList & edgeFaces() const
Return edge-face addressing.
bool hit() const
Is there a hit.
const edgeList & edges() const
Return list of edges, address into LOCAL point list.
List< label > labelList
A List of labels.
Triangle with additional region number.
triPointRef tri(const pointField &) const
Return the triangle.
const Field< PointType > & faceNormals() const
Return face normals for patch.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
errorManip< error > abort(error &err)
label fcIndex(const label i) const
Return the forward circular index, i.e. the next index.
const Point & rawPoint() const
Return point with no checking.
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, &mergedCyclicPolyPatch::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 labelListList & pointFaces() const
Return point-face addressing.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
const Point & rawPoint() const
Return point with no checking.
label nEdges() const
Return number of edges in patch.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & shrink()
Shrink the allocated space to the number of elements used.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
const Point & a() const
Return first vertex.
const Field< PointType > & pointNormals() const
Return point normals for patch.
const vectorField & faceCentres() const
void setSize(const label)
Reset size of List.
const geometricSurfacePatchList & patches() const
int dtris2(int point_num, double point_xy[], int *tri_num, int tri_vert[], int tri_nabe[])
const Point & b() const
Return second vertex.
std::remove_reference< ::Foam::List< labelledTri > >::type::value_type FaceType
vector point
Point is a vector.
label end() const
Return end vertex label.
prefixOSstream Pout(cout, "Pout")
const List< FaceType > & localFaces() const
Return patch faces addressing into local point list.
label start() const
Return start label of this patch in the polyMesh face list.
label mergePoints(const UList< Type > &points, const scalar mergeTol, const bool verbose, labelList &pointMap, const Type &origin=Type::zero)
Sorts and merges points. All points closer than/equal mergeTol get merged.
triangle< point, const point & > triPointRef
const labelListList & faceEdges() const
Return face-edge addressing.
dimensioned< scalar > mag(const dimensioned< Type > &)
void setSize(const label)
Dummy setSize function.
Mesh consisting of general polyhedral cells.
scalar distance() const
Return distance to hit.
Contains information about location on a triSurface.
label nTriangles() const
Number of triangles after splitting.
List< Key > toc() const
Return the table of contents.
A patch is a list of labels that address the faces in the global face list.
Triangulated surface description with patch information.
label index() const
Return index.
label start() const
Return start vertex label.
bool containsAny(const UList< point > &) const
Contains any of the points? (inside or on edge)