73 forAll(cutFaceCentres, facei)
77 mag(cutFaceAreas[facei] & (cutFaceCentres[facei] - cEst)), VSMALL);
80 vector pc = 0.75 * cutFaceCentres[facei] + 0.25 * cEst;
83 subCellCentre += pyr3Vol * pc;
86 subCellVolume += pyr3Vol;
89 subCellCentre /= subCellVolume;
97 const vector& subCellCentre,
104 label nEdgePoints{0};
107 for (
const point&
p : edgePoints)
115 fCentre /= nEdgePoints;
127 for (label pi = 0; pi <
nPoints - 1; pi++)
129 const point& nextPoint = edgePoints[pi + 1];
131 vector c = edgePoints[pi] + nextPoint + fCentre;
133 (nextPoint - edgePoints[pi]) ^ (fCentre - edgePoints[pi]);
145 if (sumA < ROOTVSMALL)
147 faceCentre = fCentre;
152 faceCentre = (1.0/3.0)*sumAc/sumA;
157 if ((faceArea & (faceCentre - subCellCentre)) >= 0)
172 if (
mag(faceArea) < VSMALL)
178 vector xhat = faceEdges[0][0] - faceCentre;
179 xhat = (xhat - (xhat & zhat)*zhat);
199 for (
const point&
p : edgePoints)
202 unsortedFacePointAngles.
append
206 ((
p - faceCentre) & yhat),
207 ((
p - faceCentre) & xhat)
215 facePoints.
append(unsortedFacePoints[order[0]]);
216 for (label pi = 1; pi < order.
size(); ++pi)
222 unsortedFacePointAngles[order[pi]]
223 - unsortedFacePointAngles[order[pi - 1]]
226 facePoints.
append(unsortedFacePoints[order[pi]]);
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
void append(const T &val)
Copy append an element to the end of this list.
void size(const label n)
Older name for setAddressableSize.
Vector< Cmpt > & normalise(const scalar tol=ROOTVSMALL)
Inplace normalise the vector by its magnitude.
Service routines for cutting a cell, celli, of an fvMesh, mesh_, at its intersection with a surface.
static void calcCellData(const DynamicList< point > &cutFaceCentres, const DynamicList< vector > &cutFaceAreas, vector &subCellCentre, scalar &subCellVolume)
Calculates volume and centre of the cutted cell.
static void calcIsoFacePointsFromEdges(const vector &faceArea, const vector &faceCentre, const DynamicList< DynamicList< point > > &faceEdges, DynamicList< point > &facePoints)
Calculates the point of the cutting face.
static void calcGeomDataCutFace(const DynamicList< DynamicList< point > > &faceEdges, const vector &subCellCentre, vector &faceArea, vector &faceCentre)
Calculates area and centre of the cutting face.
Mesh data needed to do the Finite Volume discretisation.
const volVectorField & C() const
Return cell centres as volVectorField.
const DimensionedField< scalar, volMesh > & V() const
Return cell volumes.
const surfaceVectorField & Cf() const
Return face centres as surfaceVectorField.
const surfaceScalarField & magSf() const
Return cell face area magnitudes.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensionedScalar sign(const dimensionedScalar &ds)
quaternion normalised(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
dimensionedScalar atan2(const dimensionedScalar &x, const dimensionedScalar &y)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
static constexpr const zero Zero
Global zero (0)
#define forAll(list, i)
Loop across all elements in list.