33 Type Foam::isoSurfaceCell::generatePoint
35 const DynamicList<Type>& snappedPoints,
50 scalar s = (iso_-s0)/d;
52 if (s >= 0.5 && s <= 1 && p1Index != -1)
54 return snappedPoints[p1Index];
56 else if (s >= 0.0 && s <= 0.5 && p0Index != -1)
58 return snappedPoints[p0Index];
62 return s*p1 + (1.0-s)*p0;
69 return s*p1 + (1.0-s)*p0;
75 void Foam::isoSurfaceCell::generateTriPoints
77 const DynamicList<Type>& snapped,
125 points.append(generatePoint(snapped,s0,p0,p0Index,s1,p1,p1Index));
126 points.append(generatePoint(snapped,s0,p0,p0Index,s2,p2,p2Index));
127 points.append(generatePoint(snapped,s0,p0,p0Index,s3,p3,p3Index));
132 points.append(generatePoint(snapped,s1,p1,p1Index,s0,p0,p0Index));
133 points.append(generatePoint(snapped,s1,p1,p1Index,s3,p3,p3Index));
134 points.append(generatePoint(snapped,s1,p1,p1Index,s2,p2,p2Index));
140 Type tp1 = generatePoint(snapped,s0,p0,p0Index,s2,p2,p2Index);
141 Type tp2 = generatePoint(snapped,s1,p1,p1Index,s3,p3,p3Index);
143 points.append(generatePoint(snapped,s0,p0,p0Index,s3,p3,p3Index));
147 points.append(generatePoint(snapped,s1,p1,p1Index,s2,p2,p2Index));
155 points.append(generatePoint(snapped,s2,p2,p2Index,s0,p0,p0Index));
156 points.append(generatePoint(snapped,s2,p2,p2Index,s1,p1,p1Index));
157 points.append(generatePoint(snapped,s2,p2,p2Index,s3,p3,p3Index));
164 Type tp0 = generatePoint(snapped,s0,p0,p0Index,s1,p1,p1Index);
165 Type tp1 = generatePoint(snapped,s2,p2,p2Index,s3,p3,p3Index);
169 points.append(generatePoint(snapped,s0,p0,p0Index,s3,p3,p3Index));
171 points.append(generatePoint(snapped,s1,p1,p1Index,s2,p2,p2Index));
179 Type tp0 = generatePoint(snapped,s0,p0,p0Index,s1,p1,p1Index);
180 Type tp1 = generatePoint(snapped,s2,p2,p2Index,s3,p3,p3Index);
183 points.append(generatePoint(snapped,s1,p1,p1Index,s3,p3,p3Index));
186 points.append(generatePoint(snapped,s0,p0,p0Index,s2,p2,p2Index));
193 points.append(generatePoint(snapped,s3,p3,p3Index,s0,p0,p0Index));
194 points.append(generatePoint(snapped,s3,p3,p3Index,s2,p2,p2Index));
195 points.append(generatePoint(snapped,s3,p3,p3Index,s1,p1,p1Index));
202 void Foam::isoSurfaceCell::generateTriPoints
207 const Field<Type>& cCoords,
208 const Field<Type>& pCoords,
210 const DynamicList<Type>& snappedPoints,
214 DynamicList<Type>& triPoints,
215 DynamicList<label>& triMeshCells
220 forAll(mesh_.cells(), cellI)
222 if (cellCutType_[cellI] != NOTCUT)
224 label oldNPoints = triPoints.size();
226 const cell& cFaces = mesh_.cells()[cellI];
228 if (tet.isA(mesh_, cellI))
233 const face& f0 = mesh_.faces()[cFaces[0]];
236 const face& f1 = mesh_.faces()[cFaces[1]];
237 label oppositeI = -1;
265 snappedPoint[oppositeI],
272 const cell& cFaces = mesh_.cells()[cellI];
276 label faceI = cFaces[cFaceI];
277 const face&
f = mesh_.faces()[faceI];
279 for (label fp = 1; fp < f.size() - 1; fp++)
281 triFace tri(f[0], f[fp], f[f.fcIndex(fp)]);
294 snappedPoint[tri[0]],
298 snappedPoint[tri[1]],
302 snappedPoint[tri[2]],
316 label nCells = (triPoints.size()-oldNPoints)/3;
317 for (label i = 0; i < nCells; i++)
319 triMeshCells.append(cellI);
325 triMeshCells.shrink();
329 template <
class Type>
345 labelList snappedPoint(mesh_.nPoints(), -1);
371 label mergedPointI = triPointMergeMap_[i];
373 if (mergedPointI >= 0)
375 values[mergedPointI] = triPoints[i];