73 list.append(std::move(tri));
82 return cpp && cpp->parallel() && !cpp->separated();
96 <<
"Unhandled coupledPolyPatch type " <<
pp.type() <<
nl
110 const coupledPolyPatch&
pp
114 bitSet collocated(
pp.size());
127 <<
"Unhandled coupledPolyPatch type " <<
pp.type()
134void Foam::isoSurfacePoint::syncUnseparatedPoints
137 const point& nullValue
146 const labelList& procPatches = mesh_.globalData().processorPatches();
149 for (
const label patchi : procPatches)
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)
190 const labelList& meshPts = procPatch.meshPoints();
194 const label meshPointi = meshPts[pointi];
197 pointValues[meshPointi],
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]];
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]];
272Foam::scalar Foam::isoSurfacePoint::isoFraction
278 const scalar d = s1-s0;
289bool Foam::isoSurfacePoint::isEdgeOfFaceCut
299 const bool fpLower = (pVals[
f[fp]] < iso_);
304 || fpLower != neiLower
305 || fpLower != (pVals[
f[
f.
fcIndex(fp)]] < iso_)
316void 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();
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];
349void Foam::isoSurfacePoint::calcCutTypes
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;
500 sum +=
s[i].centre(
s.points());
506void Foam::isoSurfacePoint::calcSnappedCc
520 snappedCc.setSize(mesh_.nCells());
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];
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));
666void Foam::isoSurfacePoint::calcSnappedPoint
668 const bitSet& isBoundaryPoint,
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];
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]);
857Foam::triSurface Foam::isoSurfacePoint::stitchTriPoints
859 const bool checkDuplicates,
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()
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);
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];
988 tris.setSize(triMap.size());
992 Pout<<
"isoSurfacePoint : merged from " << nTris
993 <<
" down to " << tris.size() <<
" unique triangles." <<
endl;
1004 const labelList& fFaces = surf.faceFaces()[facei];
1008 label nbrFacei = fFaces[i];
1010 if (nbrFacei <= facei)
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())
1038void Foam::isoSurfacePoint::trimToPlanes
1047 storeOp insideOpA(insideTrisA);
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)
1075 insideTrisA.clear();
1076 for (
const triPoints& tri : insideTrisB)
1087 newTriPoints.
reserve(newTriPoints.size() + 3*newTris.size());
1092 newTriPoints.append(tri[0]);
1093 newTriPoints.append(tri[1]);
1094 newTriPoints.append(tri[2]);
1099void Foam::isoSurfacePoint::trimToBox
1108 Pout<<
"isoSurfacePoint : trimming to " << bb <<
endl;
1116 planes.set(faceI,
new plane(bb.faceCentre(faceI), -
n));
1122 triMap.setCapacity(nTris/16);
1125 for (label triI = 0; triI < nTris; triI++)
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;
1157void Foam::isoSurfacePoint::trimToBox
1178 label sz = oldTriPoints.size()/100;
1187 label oldTriI = triMap[triI];
1190 for (label i = 0; i < 3; i++)
1192 label pointI = 3*triI+i;
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);
1216 {3*oldTriI, 3*oldTriI+1, 3*oldTriI+2}
1218 dynInterpolatedOldPoints.append(oldPoints);
1224 dynInterpolationWeights.append(weights);
1229 interpolatedPoints.transfer(dynInterpolatedPoints);
1230 interpolatedOldPoints.transfer(dynInterpolatedOldPoints);
1235Foam::triSurface Foam::isoSurfacePoint::subsetMesh
1248 newToOldPoints.setSize(
s.points().size());
1249 oldToNewPoints.setSize(
s.points().size());
1250 oldToNewPoints = -1;
1254 forAll(include, oldFacei)
1256 if (include[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]];
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();
1297 return triSurface(newTriangles,
s.patches(), newPoints,
true);
1315 cellValues.primitiveField(),
1321 mergeDistance_(params.mergeTol()*mesh_.
bounds().
mag())
1323 const bool regularise = (params.
filter() != filterType::NONE);
1328 Pout<<
"isoSurfacePoint:" <<
nl
1332 <<
" isoValue : " << iso <<
nl
1333 <<
" filter : " <<
Switch(regularise) <<
nl
1345 cValsPtr_.reset(adaptPatchFields(
cellValues).ptr());
1379 meshC.boundaryField()[patchi]
1389 if (!isCollocated[i])
1399 meshC.boundaryField()
1405 bfld.release(patchi);
1409 new calculatedFvPatchField<vector>
1417 bfld[patchi] =
pp.patchSlice(
mesh_.faceCentres());
1427 SubList<label>(boundaryRegion,
pp.size(),
pp.offset()) =
pp.index();
1432 calcCutTypes(boundaryRegion, meshC, cValsPtr_(),
pVals_);
1440 "isoSurfacePoint.cutType",
1451 auto& debugFld = debugField.primitiveFieldRef();
1453 forAll(cellCutType_, celli)
1455 debugFld[celli] = cellCutType_[celli];
1458 Pout<<
"Writing cut types:"
1459 << debugField.objectPath() <<
endl;
1465 DynamicList<point> snappedPoints(nCutCells_);
1484 snappedCc.setSize(
mesh_.nCells());
1492 Pout<<
"isoSurfacePoint : shifted " << snappedPoints.size()
1493 <<
" cell centres to intersection." <<
endl;
1496 label nCellSnaps = snappedPoints.
size();
1504 bitSet isBoundaryPoint(
mesh_.nPoints());
1513 const coupledPolyPatch& cpp =
1516 bitSet isCollocated(collocatedFaces(cpp));
1520 if (!isCollocated[i])
1522 const face&
f =
mesh_.faces()[cpp.start()+i];
1524 isBoundaryPoint.set(
f);
1532 const face&
f =
mesh_.faces()[
pp.start()+i];
1534 isBoundaryPoint.set(
f);
1553 snappedPoint.setSize(
mesh_.nPoints());
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;
1672 fileName stlFile =
mesh_.time().path() +
".stl";
1673 Pout<<
"Dumping surface to " << stlFile <<
endl;
1674 tmpsurf.
write(stlFile);
1682 tmpsurf.swapPoints(
pts);
1686 tmpsurf.triFaceFaces(faces);
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void reserve(const label len)
Reserve allocation space for at least this size, allocating new space if required and retaining old c...
A 1D vector of objects of type <T> with a fixed length <N>.
static constexpr label size() noexcept
Return the number of elements in the FixedList.
void transfer(FixedList< T, N > &list)
Transfer by swapping using a move assignment for the content of the individual list elements.
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field values.
GeometricBoundaryField< vector, fvPatchField, volMesh > Boundary
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
@ NO_REGISTER
Do not request registration (bool: false).
@ NO_READ
Nothing to be read.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
fileName objectPath() const
The complete path + object name.
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 array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
void setSize(label n)
Alias for resize().
void transfer(pointField &pointLst, List< face > &faceLst)
Output inter-processor communications stream.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
label nPoints() const
Number of points supporting patch faces.
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.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
A non-owning sub-view of a List (allocated or unallocated storage).
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
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...
void size(const label n)
Older name for setAddressableSize.
label find(const T &val) const
Find index of the first occurrence of the value.
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...
@ buffered
"buffered" : (MPI_Bsend, MPI_Recv)
static bool parRun(const bool on) noexcept
Set as parallel run on/off.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
void set(const bitSet &bitset)
Set specified bits from another bitset.
static constexpr label nFaces() noexcept
Number of faces for boundBox and HEX.
static const FixedList< vector, 6 > faceNormals
The unit normal per face.
The boundaryRegion persistent data saved as a Map<dictionary>.
This boundary condition is not designed to be evaluated; it is assumed that the value is assigned via...
The coupledPolyPatch is an abstract base class for patches that couple regions of the computational d...
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
A subset of mesh faces organised as a primitive patch.
A face is a list of labels corresponding to mesh vertices.
A class for handling file names.
Mesh data needed to do the Finite Volume discretisation.
const Time & time() const
Return the top-level database.
const fvBoundaryMesh & boundary() const noexcept
Return reference to boundary mesh.
Various mesh related information for a parallel run. Upon construction, constructs all info using par...
Abstract base class for interpolating in 1D.
Low-level components common to various iso-surface algorithms.
isoSurfaceBase(const isoSurfaceBase &)=delete
No copy construct.
const scalarField & cellValues() const noexcept
The mesh cell values used for creating the iso-surface.
const scalarField & pVals_
Point values.
labelList meshCells_
For every face, the original cell in mesh.
const polyMesh & mesh() const noexcept
The mesh for which the iso-surface is associated.
const scalarField & pointValues() const noexcept
The mesh point values used for creating the iso-surface.
const polyMesh & mesh_
Reference to mesh.
const scalarField & cVals_
Cell values.
Preferences for controlling iso-surface algorithms.
filterType filter() const noexcept
Get current filter type.
const boundBox & getClipBounds() const noexcept
Get optional clipping bounding box.
scalar mergeTol() const noexcept
Get current merge tolerance.
A surface formed by the iso value. After "Regularised Marching Tetrahedra: improved iso-surface extra...
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.
A triFace with additional (region) index.
label region() const noexcept
Return the region index.
Geometric class that creates a 3D plane and can return the intersection point between a line and the ...
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
const fileName & pointsInstance() const
Return the current instance directory for points.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh").
A patch is a list of labels that address the faces in the global face list.
label start() const noexcept
Return start label of this patch in the polyMesh face list.
const vectorField & faceCentres() const
const vectorField & cellCentres() const
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
Standard boundBox with extra functionality for use in octree.
Triangle point storage. Default constructable (triangle is not).
Triangulated surface description with patch information.
void triFaceFaces(List< face > &plainFaceList) const
Create a list of faces from the triFaces.
void write(Ostream &os) const
Write to Ostream in simple OpenFOAM format.
virtual void swapPoints(pointField &pts)
Swap points. Similar to movePoints, but returns the old points.
void sliceWithPlane(const plane &pln, AboveOp &aboveOp, BelowOp &belowOp) const
Decompose triangle into triangles above and below plane.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const volScalarField & p0
const polyBoundaryMesh & patches
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
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))
Convenience macros for instantiating iso-surface interpolate methods.
#define defineIsoSurfaceInterpolateMethods(ThisClass)
Geometric merging of points. See below.
List< T > createWithValue(const label len, const labelUList &locations, const T &val, const T &deflt=T())
Create a List filled with default values and various locations with another specified value.
Namespace for bounding specifications. At the moment, mostly for tables.
Namespace for handling debugging switches.
List< edge > edgeList
List of edge.
void invertManyToMany(const label len, const UList< InputIntListType > &input, List< OutputIntListType > &output)
Invert many-to-many.
Type & refCast(U &obj)
A dynamic_cast (for references) to Type reference.
GeometricField< vector, fvPatchField, volMesh > volVectorField
const dimensionSet dimless
Dimensionless.
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Inplace renumber the values within a list.
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
List< surfZone > surfZoneList
List of surfZone.
Barycentric2D< scalar > barycentric2D
A scalar version of the templated Barycentric2D.
List< face > faceList
List of faces.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
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...
SlicedGeometricField< vector, fvPatchField, slicedFvPatchField, volMesh > slicedVolVectorField
MinMax< label > minMax(const labelHashSet &set)
Find the min/max values of labelHashSet.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
errorManip< error > abort(error &err)
Field< label > labelField
Specialisation of Field<T> for label.
vector point
Point is a vector.
static bool collocatedPatch(const polyPatch &pp)
List< geometricSurfacePatch > geometricSurfacePatchList
List of geometricSurfacePatch.
List< bool > boolList
A List of bools.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
static constexpr const zero Zero
Global zero (0).
triangle< point, const point & > triPointRef
A triangle using referred points.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
vectorField pointField
pointField is a vectorField.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
fvPatchField< vector > fvPatchVectorField
constexpr char nl
The newline '\n' character (0x0a).
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]
#define forAll(list, i)
Loop across all elements in list.
void operator()(triPoints &&tri)
void operator()(const triPoints &tri)
storeOp(DynamicList< triPoints > &tris)
DynamicList< triPoints > & list