73 list.append(std::move(tri));
81 const auto* cpp = isA<coupledPolyPatch>(
pp);
82 return cpp && cpp->parallel() && !cpp->separated();
88 static bool isCollocatedPatch(
const coupledPolyPatch&
pp)
90 if (isA<processorPolyPatch>(
pp) || isA<cyclicPolyPatch>(
pp))
96 <<
"Unhandled coupledPolyPatch type " <<
pp.type() <<
nl 110 const coupledPolyPatch&
pp 114 bitSet collocated(
pp.size());
116 if (isA<processorPolyPatch>(
pp) || isA<cyclicPolyPatch>(
pp))
127 <<
"Unhandled coupledPolyPatch type " <<
pp.type()
134 void Foam::isoSurfacePoint::syncUnseparatedPoints
137 const point& nullValue
142 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
146 const labelList& procPatches = mesh_.globalData().processorPatches();
149 for (
const label patchi : procPatches)
152 const auto& procPatch = refCast<const processorPolyPatch>(
pp);
156 const labelList& meshPts = procPatch.meshPoints();
157 const labelList& nbrPts = procPatch.neighbPoints();
163 const label nbrPointi = nbrPts[pointi];
164 patchInfo[nbrPointi] = pointValues[meshPts[pointi]];
170 procPatch.neighbProcNo()
177 for (
const label patchi : procPatches)
180 const auto& procPatch = refCast<const processorPolyPatch>(
pp);
190 const labelList& meshPts = procPatch.meshPoints();
194 const label meshPointi = meshPts[pointi];
197 pointValues[meshPointi],
208 const cyclicPolyPatch* cpp = isA<cyclicPolyPatch>(
pp);
214 const auto& cycPatch = *cpp;
215 const auto& nbrPatch = cycPatch.neighbPatch();
217 const edgeList& coupledPoints = cycPatch.coupledPoints();
218 const labelList& meshPts = cycPatch.meshPoints();
219 const labelList& nbrMeshPoints = nbrPatch.meshPoints();
226 const edge&
e = coupledPoints[i];
227 half0Values[i] = pointValues[meshPts[
e[0]]];
228 half1Values[i] = pointValues[nbrMeshPoints[
e[1]]];
233 const edge&
e = coupledPoints[i];
234 const label
p0 = meshPts[
e[0]];
235 const label p1 = nbrMeshPoints[
e[1]];
237 minEqOp<point>()(pointValues[
p0], half1Values[i]);
238 minEqOp<point>()(pointValues[p1], half0Values[i]);
244 const globalMeshData& pd = mesh_.globalData();
246 if (pd.nGlobalPoints() > 0)
249 pointField sharedPts(pd.nGlobalPoints(), nullValue);
251 forAll(pd.sharedPointLabels(), i)
253 const label meshPointi = pd.sharedPointLabels()[i];
255 sharedPts[pd.sharedPointAddr()[i]] = pointValues[meshPointi];
263 forAll(pd.sharedPointLabels(), i)
265 const label meshPointi = pd.sharedPointLabels()[i];
266 pointValues[meshPointi] = sharedPts[pd.sharedPointAddr()[i]];
272 Foam::scalar Foam::isoSurfacePoint::isoFraction
278 const scalar d = s1-s0;
289 bool Foam::isoSurfacePoint::isEdgeOfFaceCut
299 const bool fpLower = (pVals[
f[fp]] < iso_);
304 || fpLower != neiLower
305 || fpLower != (pVals[
f[
f.
fcIndex(fp)]] < iso_)
316 void Foam::isoSurfacePoint::getNeighbour
327 const labelList& own = mesh_.faceOwner();
328 const labelList& nei = mesh_.faceNeighbour();
330 if (mesh_.isInternalFace(facei))
332 const label nbr = (own[facei] == celli ? nei[facei] : own[facei]);
333 nbrValue = cVals[nbr];
334 nbrPoint = meshC[nbr];
338 const label bFacei = facei-mesh_.nInternalFaces();
339 const label patchi = boundaryRegion[bFacei];
340 const polyPatch&
pp = mesh_.boundaryMesh()[patchi];
341 const label patchFacei = facei-
pp.start();
343 nbrValue = cVals.boundaryField()[patchi][patchFacei];
344 nbrPoint = meshC.boundaryField()[patchi][patchFacei];
349 void Foam::isoSurfacePoint::calcCutTypes
357 const polyBoundaryMesh&
patches = mesh_.boundaryMesh();
358 const labelList& own = mesh_.faceOwner();
359 const labelList& nei = mesh_.faceNeighbour();
361 faceCutType_.
resize(mesh_.nFaces());
362 faceCutType_ = cutType::NOTCUT;
364 for (label facei = 0; facei < mesh_.nInternalFaces(); ++facei)
366 const scalar ownValue = cVals[own[facei]];
367 const bool ownLower = (ownValue < iso_);
382 const bool neiLower = (nbrValue < iso_);
384 if (ownLower != neiLower)
386 faceCutType_[facei] = cutType::CUT;
392 const face&
f = mesh_.faces()[facei];
394 if (isEdgeOfFaceCut(pVals,
f, ownLower, neiLower))
396 faceCutType_[facei] = cutType::CUT;
403 for (
const label facei :
pp.range())
405 const scalar ownValue = cVals[own[facei]];
406 const bool ownLower = (ownValue < iso_);
421 const bool neiLower = (nbrValue < iso_);
423 if (ownLower != neiLower)
425 faceCutType_[facei] = cutType::CUT;
431 const face&
f = mesh_.faces()[facei];
433 if (isEdgeOfFaceCut(pVals,
f, ownLower, neiLower))
435 faceCutType_[facei] = cutType::CUT;
442 cellCutType_.
resize(mesh_.nCells());
443 cellCutType_ = cutType::NOTCUT;
448 for (label facei = 0; facei < mesh_.nInternalFaces(); ++facei)
450 if (faceCutType_[facei] == cutType::NOTCUT)
455 if (cellCutType_[own[facei]] == cutType::NOTCUT)
457 cellCutType_[own[facei]] = cutType::CUT;
460 if (cellCutType_[nei[facei]] == cutType::NOTCUT)
462 cellCutType_[nei[facei]] = cutType::CUT;
470 for (label facei = mesh_.nInternalFaces(); facei < mesh_.nFaces(); ++facei)
472 if (faceCutType_[facei] == cutType::NOTCUT)
477 if (cellCutType_[own[facei]] == cutType::NOTCUT)
479 cellCutType_[own[facei]] = cutType::CUT;
486 Pout<<
"isoSurfacePoint : candidate cut cells " 487 << nCutCells_ <<
" / " << mesh_.nCells() <<
endl;
492 Foam::point Foam::isoSurfacePoint::calcCentre(
const triSurface&
s)
500 sum +=
s[i].centre(
s.points());
506 void Foam::isoSurfacePoint::calcSnappedCc
513 DynamicList<point>& snappedPoints,
520 snappedCc.
setSize(mesh_.nCells());
524 DynamicList<point, 64> localTriPoints(64);
526 forAll(mesh_.cells(), celli)
528 if (cellCutType_[celli] == cutType::CUT)
530 const scalar cVal = cVals[celli];
532 localTriPoints.clear();
539 for (
const label facei : mesh_.cells()[celli])
541 const face&
f = mesh_.faces()[facei];
557 FixedList<scalar, 3>
s;
558 FixedList<point, 3> pt;
561 s[2] = isoFraction(cVal, nbrValue);
562 pt[2] = (1.0-
s[2])*cc[celli] +
s[2]*nbrPoint;
568 s[0] = isoFraction(cVal, pVals[
p0]);
569 pt[0] = (1.0-
s[0])*cc[celli] +
s[0]*
pts[
p0];
573 s[1] = isoFraction(cVal, pVals[p1]);
574 pt[1] = (1.0-
s[1])*cc[celli] +
s[1]*
pts[p1];
578 (
s[0] >= 0.0 &&
s[0] <= 0.5)
579 && (
s[1] >= 0.0 &&
s[1] <= 0.5)
580 && (
s[2] >= 0.0 &&
s[2] <= 0.5)
583 localTriPoints.
append(pt[0]);
584 localTriPoints.append(pt[1]);
585 localTriPoints.append(pt[2]);
592 if (
s[i] >= 0.0 &&
s[i] <= 0.5)
594 otherPointSum += pt[i];
602 if (localTriPoints.size() == 0)
608 snappedCc[celli] = snappedPoints.size();
609 snappedPoints.append(otherPointSum/nOther);
616 else if (localTriPoints.size() == 3)
619 snappedCc[celli] = snappedPoints.size();
620 snappedPoints.append(
sum(localTriPoints)/3);
621 localTriPoints.clear();
646 label nZones = surf.markZones
654 snappedCc[celli] = snappedPoints.
size();
655 snappedPoints.append(calcCentre(surf));
666 void Foam::isoSurfacePoint::calcSnappedPoint
668 const bitSet& isBoundaryPoint,
674 DynamicList<point>& snappedPoints,
684 DynamicList<point, 64> localTriPoints(100);
686 forAll(mesh_.pointFaces(), pointi)
688 if (isBoundaryPoint.test(pointi))
697 for (
const label facei :
pFaces)
699 if (faceCutType_[facei] == cutType::CUT)
712 localTriPoints.clear();
716 for (
const label facei :
pFaces)
720 const face&
f = mesh_.faces()[facei];
721 const label own = mesh_.faceOwner()[facei];
738 FixedList<scalar, 4>
s;
739 FixedList<point, 4> pt;
741 label fp =
f.
find(pointi);
742 s[0] = isoFraction(pVals[pointi], cVals[own]);
743 pt[0] = (1.0-
s[0])*
pts[pointi] +
s[0]*cc[own];
745 s[1] = isoFraction(pVals[pointi], nbrValue);
746 pt[1] = (1.0-
s[1])*
pts[pointi] +
s[1]*nbrPoint;
749 s[2] = isoFraction(pVals[pointi], pVals[nextPointi]);
750 pt[2] = (1.0-
s[2])*
pts[pointi] +
s[2]*
pts[nextPointi];
753 s[3] = isoFraction(pVals[pointi], pVals[prevPointi]);
754 pt[3] = (1.0-
s[3])*
pts[pointi] +
s[3]*
pts[prevPointi];
758 (
s[0] >= 0.0 &&
s[0] <= 0.5)
759 && (
s[1] >= 0.0 &&
s[1] <= 0.5)
760 && (
s[2] >= 0.0 &&
s[2] <= 0.5)
763 localTriPoints.
append(pt[0]);
764 localTriPoints.append(pt[1]);
765 localTriPoints.append(pt[2]);
769 (
s[0] >= 0.0 &&
s[0] <= 0.5)
770 && (
s[1] >= 0.0 &&
s[1] <= 0.5)
771 && (
s[3] >= 0.0 &&
s[3] <= 0.5)
774 localTriPoints.append(pt[3]);
775 localTriPoints.append(pt[0]);
776 localTriPoints.append(pt[1]);
782 if (
s[i] >= 0.0 &&
s[i] <= 0.5)
784 otherPointSum += pt[i];
790 if (localTriPoints.size() == 0)
796 collapsedPoint[pointi] = otherPointSum/nOther;
799 else if (localTriPoints.size() == 3)
825 label nZones = surf.markZones
833 collapsedPoint[pointi] = calcCentre(surf);
840 syncUnseparatedPoints(collapsedPoint,
point::max);
843 snappedPoint.setSize(mesh_.nPoints());
846 forAll(collapsedPoint, pointi)
850 snappedPoint[pointi] = snappedPoints.size();
851 snappedPoints.append(collapsedPoint[pointi]);
859 const bool checkDuplicates,
860 const List<point>& triPoints,
865 label nTris = triPoints.
size()/3;
867 if ((triPoints.size() % 3) != 0)
870 <<
"Problem: number of points " << triPoints.size()
887 Pout<<
"isoSurfacePoint : merged from " << triPointReverseMap.size()
888 <<
" down to " << newPoints.size() <<
" unique points." <<
endl;
904 <<
"Merged points contain duplicates" 905 <<
" when merging with distance " << mergeDistance_ <<
endl 906 <<
"merged:" << oldToNew.size() <<
" re-merged:" 907 << newNewPoints.size()
913 List<labelledTri> tris;
915 DynamicList<labelledTri> dynTris(nTris);
917 DynamicList<label> newToOldTri(nTris);
919 for (label oldTriI = 0; oldTriI < nTris; oldTriI++)
923 triPointReverseMap[rawPointi],
924 triPointReverseMap[rawPointi+1],
925 triPointReverseMap[rawPointi+2],
932 newToOldTri.append(oldTriI);
937 triMap.transfer(newToOldTri);
938 tris.transfer(dynTris);
953 DynamicList<label> newToOldTri(tris.size());
957 const labelledTri& tri = tris[triI];
966 label nbrTriI =
pFaces[i];
968 if (nbrTriI > triI && (tris[nbrTriI] == tri))
981 label newTriI = newToOldTri.size();
982 newToOldTri.append(triMap[triI]);
983 tris[newTriI] = tris[triI];
987 triMap.transfer(newToOldTri);
988 tris.setSize(triMap.size());
992 Pout<<
"isoSurfacePoint : merged from " << nTris
993 <<
" down to " << tris.size() <<
" unique triangles." <<
endl;
1003 const labelledTri&
f = surf[facei];
1004 const labelList& fFaces = surf.faceFaces()[facei];
1008 label nbrFacei = fFaces[i];
1010 if (nbrFacei <= facei)
1016 const labelledTri& nbrF = surf[nbrFacei];
1022 <<
" triangle " << facei <<
" vertices " <<
f 1023 <<
" fc:" <<
f.centre(surf.points())
1024 <<
" has the same vertices as triangle " << nbrFacei
1025 <<
" vertices " << nbrF
1026 <<
" fc:" << nbrF.centre(surf.points())
1038 void Foam::isoSurfacePoint::trimToPlanes
1040 const PtrList<plane>& planes,
1042 DynamicList<point>& newTriPoints
1046 DynamicList<triPoints> insideTrisA;
1047 storeOp insideOpA(insideTrisA);
1050 DynamicList<triPoints> insideTrisB;
1051 storeOp insideOpB(insideTrisB);
1053 triPointRef::dummyOp dop;
1056 insideOpA(triPoints(tri.a(), tri.b(), tri.c()));
1063 const plane& pln = planes[faceI];
1067 insideTrisB.clear();
1068 for (
const triPoints& tri : insideTrisA)
1070 triPointRef(tri).sliceWithPlane(pln, insideOpB, dop);
1075 insideTrisA.clear();
1076 for (
const triPoints& tri : insideTrisB)
1078 triPointRef(tri).sliceWithPlane(pln, insideOpA, dop);
1085 DynamicList<triPoints>& newTris = (useA ? insideTrisA : insideTrisB);
1087 newTriPoints.reserve(newTriPoints.size() + 3*newTris.size());
1090 for (
const triPoints& tri : newTris)
1092 newTriPoints.append(tri[0]);
1093 newTriPoints.append(tri[1]);
1094 newTriPoints.append(tri[2]);
1099 void Foam::isoSurfacePoint::trimToBox
1101 const treeBoundBox& bb,
1102 DynamicList<point>& triPoints,
1103 DynamicList<label>& triMap
1108 Pout<<
"isoSurfacePoint : trimming to " << bb <<
endl;
1116 planes.set(faceI,
new plane(bb.faceCentre(faceI), -
n));
1119 label nTris = triPoints.size()/3;
1121 DynamicList<point> newTriPoints(triPoints.size()/16);
1122 triMap.setCapacity(nTris/16);
1125 for (label triI = 0; triI < nTris; triI++)
1127 const point&
p0 = triPoints[vertI++];
1128 const point& p1 = triPoints[vertI++];
1129 const point& p2 = triPoints[vertI++];
1131 label oldNPoints = newTriPoints.size();
1139 label nCells = (newTriPoints.size()-oldNPoints)/3;
1140 for (label i = 0; i < nCells; i++)
1142 triMap.append(triI);
1148 Pout<<
"isoSurfacePoint : trimmed from " << nTris
1149 <<
" down to " << triMap.size()
1150 <<
" triangles." <<
endl;
1153 triPoints.transfer(newTriPoints);
1157 void Foam::isoSurfacePoint::trimToBox
1159 const treeBoundBox& bb,
1160 DynamicList<point>& triPoints,
1161 DynamicList<label>& triMap,
1164 List<FixedList<label, 3>>& interpolatedOldPoints,
1165 List<FixedList<scalar, 3>>& interpolationWeights
1168 const List<point> oldTriPoints(triPoints);
1171 trimToBox(bb, triPoints, triMap);
1178 label sz = oldTriPoints.size()/100;
1179 DynamicList<label> dynInterpolatedPoints(sz);
1180 DynamicList<FixedList<label, 3>> dynInterpolatedOldPoints(sz);
1181 DynamicList<FixedList<scalar, 3>> dynInterpolationWeights(sz);
1184 triPointMap.setSize(triPoints.size());
1187 label oldTriI = triMap[triI];
1190 for (label i = 0; i < 3; i++)
1192 label pointI = 3*triI+i;
1193 const point& pt = triPoints[pointI];
1196 label matchPointI = -1;
1197 for (label j = 0; j < 3; j++)
1199 label oldPointI = 3*oldTriI+j;
1200 if (pt == oldTriPoints[oldPointI])
1202 matchPointI = oldPointI;
1207 triPointMap[pointI] = matchPointI;
1210 if (matchPointI == -1)
1212 dynInterpolatedPoints.append(pointI);
1214 FixedList<label, 3> oldPoints
1216 {3*oldTriI, 3*oldTriI+1, 3*oldTriI+2}
1218 dynInterpolatedOldPoints.append(oldPoints);
1222 FixedList<scalar, 3> weights({bary.a(), bary.b(), bary.c()});
1224 dynInterpolationWeights.append(weights);
1229 interpolatedPoints.transfer(dynInterpolatedPoints);
1230 interpolatedOldPoints.transfer(dynInterpolatedOldPoints);
1231 interpolationWeights.transfer(dynInterpolationWeights);
1237 const triSurface&
s,
1245 ListOps::createWithValue<bool>(
s.size(), newToOldFaces,
true,
false)
1248 newToOldPoints.setSize(
s.points().size());
1249 oldToNewPoints.setSize(
s.points().size());
1250 oldToNewPoints = -1;
1254 forAll(include, oldFacei)
1256 if (include[oldFacei])
1259 const labelledTri& tri =
s[oldFacei];
1263 label oldPointi = tri[fp];
1265 if (oldToNewPoints[oldPointi] == -1)
1267 oldToNewPoints[oldPointi] = pointi;
1268 newToOldPoints[pointi++] = oldPointi;
1273 newToOldPoints.setSize(pointi);
1278 forAll(newToOldPoints, i)
1280 newPoints[i] =
s.points()[newToOldPoints[i]];
1283 List<labelledTri> newTriangles(newToOldFaces.size());
1288 const labelledTri& tri =
s[newToOldFaces[i]];
1290 newTriangles[i][0] = oldToNewPoints[tri[0]];
1291 newTriangles[i][1] = oldToNewPoints[tri[1]];
1292 newTriangles[i][2] = oldToNewPoints[tri[2]];
1293 newTriangles[i].region() = tri.region();
1315 cellValues.primitiveField(),
1321 mergeDistance_(params.mergeTol()*mesh_.bounds().
mag())
1328 Pout<<
"isoSurfacePoint:" <<
nl 1332 <<
" isoValue : " << iso <<
nl 1333 <<
" filter : " <<
Switch(regularise) <<
nl 1345 cValsPtr_.reset(adaptPatchFields(
cellValues).ptr());
1367 fvmesh.cellCentres(),
1368 fvmesh.faceCentres()
1379 meshC.boundaryField()[patchi]
1384 collocatedFaces(refCast<const coupledPolyPatch>(
pp))
1389 if (!isCollocated[i])
1395 else if (isA<emptyPolyPatch>(
pp))
1399 meshC.boundaryField()
1405 bfld.release(patchi);
1409 new calculatedFvPatchField<vector>
1411 fvmesh.boundary()[patchi],
1427 SubList<label>(boundaryRegion,
pp.size(),
pp.offset()) =
pp.index();
1432 calcCutTypes(boundaryRegion, meshC, cValsPtr_(),
pVals_);
1440 "isoSurfacePoint.cutType",
1441 fvmesh.time().timeName(),
1453 forAll(cellCutType_, celli)
1455 debugFld[celli] = cellCutType_[celli];
1458 Pout<<
"Writing cut types:" 1459 << debugField.objectPath() <<
endl;
1465 DynamicList<point> snappedPoints(nCutCells_);
1492 Pout<<
"isoSurfacePoint : shifted " << snappedPoints.size()
1493 <<
" cell centres to intersection." <<
endl;
1496 label nCellSnaps = snappedPoints.size();
1513 const coupledPolyPatch& cpp =
1514 refCast<const coupledPolyPatch>(
pp);
1516 bitSet isCollocated(collocatedFaces(cpp));
1520 if (!isCollocated[i])
1524 isBoundaryPoint.
set(
f);
1534 isBoundaryPoint.
set(
f);
1559 Pout<<
"isoSurfacePoint : shifted " << snappedPoints.size()-nCellSnaps
1560 <<
" vertices to intersection." <<
endl;
1568 DynamicList<point> triPoints(3*nCutCells_);
1569 DynamicList<label> triMeshCells(nCutCells_);
1589 Pout<<
"isoSurfacePoint : generated " << triMeshCells.size()
1590 <<
" unmerged triangles from " << triPoints.size()
1591 <<
" unmerged points." <<
endl;
1594 label nOldPoints = triPoints.size();
1597 DynamicList<label> trimTriMap;
1608 interpolatedPoints_,
1609 interpolatedOldPoints_,
1610 interpolationWeights_
1612 triMeshCells =
labelField(triMeshCells, trimTriMap);
1618 tmpsurf = stitchTriPoints
1628 Pout<<
"isoSurfacePoint : generated " << triMap.size()
1629 <<
" merged triangles." <<
endl;
1639 labelList newTriPointMergeMap(nOldPoints, -1);
1640 forAll(trimTriPointMap, trimPointI)
1642 label oldPointI = trimTriPointMap[trimPointI];
1645 label pointI = triPointMergeMap_[trimPointI];
1648 newTriPointMergeMap[oldPointI] = pointI;
1652 triPointMergeMap_.
transfer(newTriPointMergeMap);
1664 Pout<<
"isoSurfacePoint : checking " << tmpsurf.size()
1665 <<
" triangles for validity." <<
endl;
1673 Pout<<
"Dumping surface to " << stlFile <<
endl;
1674 tmpsurf.
write(stlFile);
1682 tmpsurf.swapPoints(
pts);
1686 tmpsurf.triFaceFaces(faces);
label nPoints() const
Number of points supporting patch faces.
Field< label > labelField
Specialisation of Field<T> for label.
void size(const label n)
Older name for setAddressableSize.
fileName path() const
Return path = rootPath/caseName. Same as TimePaths::path()
fvPatchField< vector > fvPatchVectorField
Barycentric2D< scalar > barycentric2D
A scalar version of the templated Barycentric2D.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void resize(const label len)
Adjust allocated size of list.
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
label nPoints() const noexcept
Number of mesh points.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
const scalarField & cVals_
Cell values.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void append(const T &val)
Append an element at the end of the list.
List< edge > edgeList
List of edge.
Preferences for controlling iso-surface algorithms.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
constexpr char nl
The newline '\n' character (0x0a)
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool & parRun() noexcept
Test if this a parallel run.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, any/none. Also accepts 0/1 as a string and shortcuts t/f, y/n.
static const FixedList< vector, 6 > faceNormals
The unit normal per face.
GeometricBoundaryField< Type, PatchField, GeoMesh > Boundary
Type of boundary fields.
Ignore writing from objectRegistry::writeObject()
const dimensionSet dimless
Dimensionless.
GeometricField< vector, fvPatchField, volMesh > volVectorField
List< labelList > labelListList
List of labelList.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
isoSurfacePoint(const volScalarField &cellValues, const scalarField &pointValues, const scalar iso, const isoSurfaceParams ¶ms=isoSurfaceParams(), const bitSet &ignoreCells=bitSet())
Construct from cell values and point values.
Low-level components common to various iso-surface algorithms.
MinMax< label > minMax(const labelHashSet &set)
Find the min/max values of labelHashSet.
virtual const pointField & points() const
Return raw points.
#define forAll(list, i)
Loop across all elements in list.
label fcIndex(const label i) const noexcept
The forward circular index. The next index in the list which returns to the first at the end of the l...
label mergePoints(const PointList &points, labelList &pointToUnique, labelList &uniquePoints, const scalar mergeTol=SMALL, const bool verbose=false)
Calculate merge mapping, preserving the original point order. All points closer/equal mergeTol are to...
GeometricField< scalar, fvPatchField, volMesh > volScalarField
List< face > faceList
List of faces.
#define defineIsoSurfaceInterpolateMethods(ThisClass)
const boundBox & getClipBounds() const noexcept
Get optional clipping bounding box.
vectorField pointField
pointField is a vectorField.
const dimensionedScalar e
Elementary charge.
const fileName & pointsInstance() const
Return the current instance directory for points.
void setSize(const label n)
Alias for resize()
static void recv(Type &value, const int fromProcNo, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm, IOstreamOption::streamFormat fmt=IOstreamOption::BINARY)
Receive and deserialize a value. Uses operator>> for de-serialization.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
const polyMesh & mesh_
Reference to mesh.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const Time & time() const noexcept
Return time registry.
A surface formed by the iso value. After "Regularised Marching Tetrahedra: improved iso-surface extra...
Triangle point storage. Default constructable (triangle is not)
labelList meshCells_
For every face, the original cell in mesh.
const scalarField & cellValues() const noexcept
The mesh cell values used for creating the iso-surface.
DynamicList< triPoints > & list
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
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]
virtual const faceList & faces() const
Return raw faces.
SlicedGeometricField< vector, fvPatchField, slicedFvPatchField, volMesh > slicedVolVectorField
errorManip< error > abort(error &err)
label find(const T &val) const
Find index of the first occurrence of the value.
void operator()(const triPoints &tri)
const scalarField & pVals_
Point values.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
int debug
Static debugging option.
static constexpr label nFaces() noexcept
Number of faces for boundBox and HEX.
List< geometricSurfacePatch > geometricSurfacePatchList
List of geometricSurfacePatch.
defineTypeNameAndDebug(combustionModel, 0)
Geometric merging of points. See below.
const vectorField & faceCentres() const
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Inplace renumber the values within a list.
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field values.
vector point
Point is a vector.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
label nCells() const noexcept
Number of mesh cells.
Mesh data needed to do the Finite Volume discretisation.
const polyBoundaryMesh & patches
List< surfZone > surfZoneList
List of surfZone.
triangle< point, const point & > triPointRef
A triangle using referred points.
void transfer(pointField &pointLst, List< face > &faceLst)
Transfer the components.
std::enable_if_t< std::is_same_v< bool, TypeT >, bool > set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
List< label > labelList
A List of labels.
"buffered" : (MPI_Bsend, MPI_Recv)
Triangulated surface description with patch information.
label rcIndex(const label i) const noexcept
The reverse circular index. The previous index in the list which returns to the last at the beginning...
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.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))
void invertManyToMany(const label len, const UList< InputIntListType > &input, List< OutputIntListType > &output)
Invert many-to-many.
label nBoundaryFaces() const noexcept
Number of boundary faces (== nFaces - nInternalFaces)
Convenience macros for instantiating iso-surface interpolate methods.
filterType filter() const noexcept
Get current filter type.
static bool collocatedPatch(const polyPatch &pp)
static void listReduce(UList< T > &values, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce list elements (list must be equal size on all ranks), applying bop to each list element...
List< bool > boolList
A List of bools.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Do not request registration (bool: false)
const volScalarField & p0
scalar mergeTol() const noexcept
Get current merge tolerance.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
storeOp(DynamicList< triPoints > &tris)
static constexpr const zero Zero
Global zero (0)