MCPcopy Create free account
hub / github.com/OpenFOAM/OpenFOAM-dev / intersectEdges

Function intersectEdges

src/sampling/cuttingPlane/cuttingPlane.C:103–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101
102
103void Foam::cuttingPlane::intersectEdges
104(
105 const primitiveMesh& mesh,
106 const scalarField& dotProducts,
107 List<label>& edgePoint
108)
109{
110 // Use the dotProducts to find out the cut edges.
111 const edgeList& edges = mesh.edges();
112 const pointField& points = mesh.points();
113
114 // Per edge -1 or the label of the intersection point
115 edgePoint.setSize(edges.size());
116
117 DynamicList<point> dynCuttingPoints(4*cutCells_.size());
118
119 forAll(edges, edgeI)
120 {
121 const edge& e = edges[edgeI];
122
123 if
124 (
125 (dotProducts[e[0]] < zeroish && dotProducts[e[1]] > positive)
126 || (dotProducts[e[1]] < zeroish && dotProducts[e[0]] > positive)
127 )
128 {
129 // Edge is cut
130 edgePoint[edgeI] = dynCuttingPoints.size();
131
132 const point& p0 = points[e[0]];
133 const point& p1 = points[e[1]];
134
135 scalar alpha = lineIntersect(linePointRef(p0, p1));
136
137 if (alpha < zeroish)
138 {
139 dynCuttingPoints.append(p0);
140 }
141 else if (alpha >= 1.0)
142 {
143 dynCuttingPoints.append(p1);
144 }
145 else
146 {
147 dynCuttingPoints.append((1-alpha)*p0 + alpha*p1);
148 }
149 }
150 else
151 {
152 edgePoint[edgeI] = -1;
153 }
154 }
155
156 this->storedPoints().transfer(dynCuttingPoints);
157}
158
159
160bool Foam::cuttingPlane::walkCell

Callers 1

reCutFunction · 0.70

Calls 7

forAllFunction · 0.50
edgesMethod · 0.45
pointsMethod · 0.45
setSizeMethod · 0.45
sizeMethod · 0.45
appendMethod · 0.45
transferMethod · 0.45

Tested by

no test coverage detected