52 auto& result = tResult.ref();
61 forAll(cellTetIs, cellTetI)
63 const triFace triIs = cellTetIs[cellTetI].faceTriIs(
mesh);
68 mesh.cellCentres()[cI],
69 mesh.points()[triIs[0]],
70 mesh.points()[triIs[1]],
71 mesh.points()[triIs[2]]
103 const fvPatch& patch,
104 const scalarField& levelF,
105 const scalarField& levelP,
109 auto tResult = tmp<scalarField>::New(
patch.size(), Zero);
110 auto& result = tResult.ref();
114 const face&
f =
patch.patch().localFaces()[fI];
119 for (label edgei = 0; edgei <
f.nEdges(); ++edgei)
121 const edge
e =
f.edge(edgei);
123 const FixedList<point, 3>
126 patch.patch().faceCentres()[fI],
127 patch.patch().localPoints()[
e[0]],
128 patch.patch().localPoints()[
e[1]]
130 const FixedList<scalar, 3>
138 a += cut::areaOp()(tri);
142 r +=
triCut(tri, level, cut::areaOp(), cut::noOp());
146 r +=
triCut(tri, level, cut::noOp(), cut::areaOp());
150 result[fI] = a/
magSqr(a) & r;
static tmp< DimensionedField< Type, GeoMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const Field< Type > &iField)
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions, copy of internal field....
A 1D vector of objects of type <T> with a fixed length <N>.
@ NO_REGISTER
Do not request registration (bool: false).
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
A face is a list of labels corresponding to mesh vertices.
Mesh data needed to do the Finite Volume discretisation.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
static List< tetIndices > cellTetIndices(const polyMesh &mesh, label cI)
Return the tet decomposition of the given cell, see.
A class for managing temporary objects.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
A triangular face using a FixedList of labels corresponding to mesh vertices.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
const std::string patch
OpenFOAM patch number as a std::string.
const dimensionSet dimless
Dimensionless.
tmp< DimensionedField< scalar, volMesh > > levelSetFraction(const fvMesh &mesh, const scalarField &levelC, const scalarField &levelP, const bool above)
Calculate the volume-fraction that a level set occupies. This gives the the.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
cut::opAddResult< AboveOp, BelowOp >::type triCut(const FixedList< point, 3 > &tri, const FixedList< scalar, 3 > &level, const AboveOp &aboveOp, const BelowOp &belowOp)
Cut a triangle along the zero plane defined by the given levels.
static constexpr const zero Zero
Global zero (0).
cut::opAddResult< AboveOp, BelowOp >::type tetCut(const FixedList< point, 4 > &tet, const FixedList< scalar, 4 > &level, const AboveOp &aboveOp, const BelowOp &belowOp)
As triCut, but for a tetrahedron.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
#define forAll(list, i)
Loop across all elements in list.