34 Type Foam::isoSurfaceCell::generatePoint
36 const DynamicList<Type>& snappedPoints,
51 scalar s = (iso_-s0)/d;
53 if (s >= 0.5 && s <= 1 && p1Index != -1)
55 return snappedPoints[p1Index];
57 else if (s >= 0.0 && s <= 0.5 && p0Index != -1)
59 return snappedPoints[p0Index];
63 return s*p1 + (1.0-
s)*p0;
70 return s*p1 + (1.0-
s)*p0;
76 void Foam::isoSurfaceCell::generateTriPoints
78 const DynamicList<Type>& snapped,
96 DynamicList<Type>& pts
129 generatePoint(snapped,s0,p0,p0Index,s1,p1,p1Index)
133 generatePoint(snapped,s0,p0,p0Index,s2,p2,p2Index)
137 generatePoint(snapped,s0,p0,p0Index,s3,p3,p3Index)
139 if (triIndex == 0x0E)
142 label sz = pts.size();
143 Swap(pts[sz-2], pts[sz-1]);
153 generatePoint(snapped,s1,p1,p1Index,s0,p0,p0Index)
157 generatePoint(snapped,s1,p1,p1Index,s3,p3,p3Index)
161 generatePoint(snapped,s1,p1,p1Index,s2,p2,p2Index)
164 if (triIndex == 0x0D)
167 label sz = pts.size();
168 Swap(pts[sz-2], pts[sz-1]);
177 generatePoint(snapped,s0,p0,p0Index,s2,p2,p2Index);
179 generatePoint(snapped,s1,p1,p1Index,s3,p3,p3Index);
183 generatePoint(snapped,s0,p0,p0Index,s3,p3,p3Index)
191 generatePoint(snapped,s1,p1,p1Index,s2,p2,p2Index)
195 if (triIndex == 0x0C)
198 label sz = pts.size();
199 Swap(pts[sz-5], pts[sz-4]);
200 Swap(pts[sz-2], pts[sz-1]);
210 generatePoint(snapped,s2,p2,p2Index,s0,p0,p0Index)
214 generatePoint(snapped,s2,p2,p2Index,s1,p1,p1Index)
218 generatePoint(snapped,s2,p2,p2Index,s3,p3,p3Index)
221 if (triIndex == 0x0B)
224 label sz = pts.size();
225 Swap(pts[sz-2], pts[sz-1]);
234 generatePoint(snapped,s0,p0,p0Index,s1,p1,p1Index);
236 generatePoint(snapped,s2,p2,p2Index,s3,p3,p3Index);
242 generatePoint(snapped,s0,p0,p0Index,s3,p3,p3Index)
248 generatePoint(snapped,s1,p1,p1Index,s2,p2,p2Index)
252 if (triIndex == 0x0A)
255 label sz = pts.size();
256 Swap(pts[sz-5], pts[sz-4]);
257 Swap(pts[sz-2], pts[sz-1]);
266 generatePoint(snapped,s0,p0,p0Index,s1,p1,p1Index);
268 generatePoint(snapped,s2,p2,p2Index,s3,p3,p3Index);
273 generatePoint(snapped,s1,p1,p1Index,s3,p3,p3Index)
281 generatePoint(snapped,s0,p0,p0Index,s2,p2,p2Index)
284 if (triIndex == 0x09)
287 label sz = pts.size();
288 Swap(pts[sz-5], pts[sz-4]);
289 Swap(pts[sz-2], pts[sz-1]);
299 generatePoint(snapped,s3,p3,p3Index,s0,p0,p0Index)
303 generatePoint(snapped,s3,p3,p3Index,s2,p2,p2Index)
307 generatePoint(snapped,s3,p3,p3Index,s1,p1,p1Index)
309 if (triIndex == 0x07)
312 label sz = pts.size();
313 Swap(pts[sz-2], pts[sz-1]);
322 void Foam::isoSurfaceCell::generateTriPoints
327 const Field<Type>& cCoords,
328 const Field<Type>& pCoords,
330 const DynamicList<Type>& snappedPoints,
334 DynamicList<Type>& triPoints,
335 DynamicList<label>& triMeshCells
339 label countNotFoundTets = 0;
343 if (cellCutType_[celli] != NOTCUT)
345 label oldNPoints = triPoints.size();
347 const cell& cFaces = mesh_.
cells()[celli];
349 if (tet.isA(mesh_, celli))
354 const face& f0 = mesh_.
faces()[cFaces[0]];
357 const face& f1 = mesh_.
faces()[cFaces[1]];
358 label oppositeI = -1;
371 if (mesh_.
faceOwner()[cFaces[0]] == celli)
391 snappedPoint[oppositeI],
416 snappedPoint[oppositeI],
426 label facei = cFaces[cFacei];
427 const face& f = mesh_.
faces()[facei];
438 label fp = f.fcIndex(fp0);
439 for (
label i = 2; i < f.size(); i++)
441 label nextFp = f.fcIndex(fp);
442 triFace tri(f[fp0], f[fp], f[nextFp]);
454 snappedPoint[tri[1]],
458 snappedPoint[tri[0]],
462 snappedPoint[tri[2]],
479 snappedPoint[tri[0]],
483 snappedPoint[tri[1]],
487 snappedPoint[tri[2]],
504 label nCells = (triPoints.size()-oldNPoints)/3;
505 for (
label i = 0; i < nCells; i++)
507 triMeshCells.append(celli);
512 if (countNotFoundTets > 0)
514 WarningIn(
"Foam::isoSurfaceCell::generateTriPoints(..)")
515 <<
"Could not find " << countNotFoundTets
516 <<
" tet base points, which may lead to inverted triangles." 521 triMeshCells.shrink();
557 return isoSurface::interpolate
#define WarningIn(functionName)
Report a warning using Foam::Warning.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
tmp< Field< Type > > interpolate(const Field< Type > &cCoords, const Field< Type > &pCoords) const
Interpolates cCoords,pCoords.
const labelIOList & tetBasePtIs() const
Return the tetBasePtIs.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const cellList & cells() const
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))
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Pre-declare SubField and related Field type.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
virtual const labelList & faceOwner() const
Return face owner.
const Field< point > & points() const
Return reference to global points.
List< label > labelList
A List of labels.
virtual const faceList & faces() const
Return raw faces.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurence of given element and return index,.
dimensioned< scalar > mag(const dimensioned< Type > &)
A class for managing temporary objects.
label size() const
Return the number of elements in the UList.