39 const Field<Type>& positiveC,
40 const Field<Type>& positiveP,
41 const Field<Type>& negativeC,
42 const Field<Type>& negativeP
45 tmp<Field<Type>> tResult(
new Field<Type>(mesh.nCells(),
Zero));
46 Field<Type>& result = tResult.ref();
50 const List<tetIndices> cellTetIs =
51 polyMeshTetDecomposition::cellTetIndices(mesh, cI);
56 forAll(cellTetIs, cellTetI)
58 const triFace triIs = cellTetIs[cellTetI].faceTriIs(mesh);
60 const FixedList<point, 4>
63 mesh.cellCentres()[cI],
64 mesh.points()[triIs[0]],
65 mesh.points()[triIs[1]],
66 mesh.points()[triIs[2]]
68 const FixedList<scalar, 4>
76 const cut::volumeIntegrateOp<Type>
77 positive = FixedList<Type, 4>
84 const cut::volumeIntegrateOp<Type>
85 negative = FixedList<Type, 4>
93 v += cut::volumeOp()(tet);
95 r +=
tetCut(tet, level, positive, negative);
108 const fvPatch& patch,
111 const Field<Type>& positiveF,
112 const Field<Type>& positiveP,
113 const Field<Type>& negativeF,
114 const Field<Type>& negativeP
119 tmp<Field<Type>> tResult(
new Field<Type>(patch.size(),
Zero));
120 Field<Type>& result = tResult.ref();
124 const face& f = patch.patch().localFaces()[fI];
129 for(
label eI = 0; eI < f.size(); ++ eI)
131 const edge e = f.faceEdge(eI);
133 const FixedList<point, 3>
136 patch.patch().faceCentres()[fI],
137 patch.patch().localPoints()[e[0]],
138 patch.patch().localPoints()[e[1]]
140 const FixedList<scalar, 3>
147 const cut::areaIntegrateOp<Type>
148 positive = FixedList<Type, 3>
154 const cut::areaIntegrateOp<Type>
155 negative = FixedList<Type, 3>
162 a += cut::areaOp()(tri);
164 r +=
triCut(tri, level, positive, negative);
167 result[fI] = a/
magSqr(a) & r;
180 const GeometricField<Type, fvPatchField, volMesh>& positiveC,
181 const GeometricField<Type, pointPatchField, pointMesh>& positiveP,
182 const GeometricField<Type, fvPatchField, volMesh>& negativeC,
183 const GeometricField<Type, pointPatchField, pointMesh>& negativeP
186 const fvMesh& mesh = levelC.mesh();
188 tmp<GeometricField<Type, fvPatchField, volMesh>> tResult
190 new GeometricField<Type, fvPatchField, volMesh>
194 positiveC.name() +
":levelSetAverage",
195 mesh.time().timeName(),
199 dimensioned<Type>(
"0", positiveC.dimensions(),
Zero)
202 GeometricField<Type, fvPatchField, volMesh>& result = tResult.ref();
204 result.primitiveFieldRef() =
208 levelC.primitiveField(),
209 levelP.primitiveField(),
210 positiveC.primitiveField(),
211 positiveP.primitiveField(),
212 negativeC.primitiveField(),
213 negativeP.primitiveField()
218 result.boundaryFieldRef()[
patchi] =
222 levelC.boundaryField()[
patchi],
223 levelP.boundaryField()[
patchi].patchInternalField()(),
224 positiveC.boundaryField()[
patchi],
225 negativeP.boundaryField()[
patchi].patchInternalField()(),
226 positiveC.boundaryField()[
patchi],
227 negativeP.boundaryField()[
patchi].patchInternalField()()
GeometricField< scalar, pointPatchField, pointMesh > pointScalarField
#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.
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.
Vector< scalar > vector
A scalar version of the templated Vector.
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. Templated.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
dimensioned< scalar > magSqr(const dimensioned< Type > &)
volScalarField scalarField(fieldObject, mesh)
tmp< Field< Type > > levelSetAverage(const fvMesh &mesh, const scalarField &levelC, const scalarField &levelP, const Field< Type > &positiveC, const Field< Type > &positiveP, const Field< Type > &negativeC, const Field< Type > &negativeP)
Calculate the average value of two fields, one on each side of a level set.
A class for managing temporary objects.