39 const DimensionedField<Type, volMesh>& positiveC,
40 const DimensionedField<Type, pointMesh>& positiveP,
41 const DimensionedField<Type, volMesh>& negativeC,
42 const DimensionedField<Type, pointMesh>& negativeP
45 tmp<DimensionedField<Type, volMesh>> tResult
47 new DimensionedField<Type, volMesh>
51 positiveC.name() +
":levelSetAverage",
52 mesh.time().timeName(),
56 dimensioned<Type>(
"0", positiveC.dimensions(),
Zero)
59 DimensionedField<Type, volMesh>& result = tResult.ref();
63 const List<tetIndices> cellTetIs =
64 polyMeshTetDecomposition::cellTetIndices(mesh, cI);
69 forAll(cellTetIs, cellTetI)
71 const triFace triIs = cellTetIs[cellTetI].faceTriIs(mesh);
73 const FixedList<point, 4>
76 mesh.cellCentres()[cI],
77 mesh.points()[triIs[0]],
78 mesh.points()[triIs[1]],
79 mesh.points()[triIs[2]]
81 const FixedList<scalar, 4>
89 const cut::volumeIntegrateOp<Type>
90 positive = FixedList<Type, 4>
97 const cut::volumeIntegrateOp<Type>
98 negative = FixedList<Type, 4>
106 v += cut::volumeOp()(tet);
108 r +=
tetCut(tet, level, positive, negative);
121 const fvPatch& patch,
124 const Field<Type>& positiveF,
125 const Field<Type>& positiveP,
126 const Field<Type>& negativeF,
127 const Field<Type>& negativeP
132 tmp<Field<Type>> tResult(
new Field<Type>(patch.size(),
Zero));
133 Field<Type>& result = tResult.ref();
137 const face& f = patch.patch().localFaces()[fI];
142 for(
label eI = 0; eI < f.size(); ++ eI)
144 const edge e = f.faceEdge(eI);
146 const FixedList<point, 3>
149 patch.patch().faceCentres()[fI],
150 patch.patch().localPoints()[e[0]],
151 patch.patch().localPoints()[e[1]]
153 const FixedList<scalar, 3>
160 const cut::areaIntegrateOp<Type>
161 positive = FixedList<Type, 3>
167 const cut::areaIntegrateOp<Type>
168 negative = FixedList<Type, 3>
175 a += cut::areaOp()(tri);
177 r +=
triCut(tri, level, positive, negative);
180 result[fI] = a/
magSqr(a) & r;
#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.
tmp< DimensionedField< Type, volMesh > > levelSetAverage(const fvMesh &mesh, const scalarField &levelC, const scalarField &levelP, const DimensionedField< Type, volMesh > &positiveC, const DimensionedField< Type, pointMesh > &positiveP, const DimensionedField< Type, volMesh > &negativeC, const DimensionedField< Type, pointMesh > &negativeP)
Calculate the average value of two fields, one on each side of a level set.
dimensioned< scalar > magSqr(const dimensioned< Type > &)
volScalarField scalarField(fieldObject, mesh)
A class for managing temporary objects.