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};
105 for (
const DynamicList<point>& edgePoints : faceEdges)
107 for (
const point&
p : edgePoints)
115 fCentre /= nEdgePoints;
125 const DynamicList<point>& edgePoints = faceEdges[ei];
126 const label
nPoints = edgePoints.size();
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)
168 const DynamicList<DynamicList<point>>& faceEdges,
169 DynamicList<point>& facePoints
172 if (
mag(faceArea) < VSMALL)
178 vector xhat = faceEdges[0][0] - faceCentre;
179 xhat = (xhat - (xhat & zhat)*zhat);
195 DynamicList<point> unsortedFacePoints(3 * faceEdges.size());
196 DynamicList<scalar> unsortedFacePointAngles(3 * faceEdges.size());
197 for (
const DynamicList<point>& edgePoints : faceEdges)
199 for (
const point&
p : edgePoints)
201 unsortedFacePoints.append(
p);
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]]);
dimensionedScalar sign(const dimensionedScalar &ds)
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &f1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
static void calcCellData(const DynamicList< point > &cutFaceCentres, const DynamicList< vector > &cutFaceAreas, vector &subCellCentre, scalar &subCellVolume)
Calculates volume and centre of the cutted cell.
Vector< Cmpt > & normalise(const scalar tol=ROOTVSMALL)
Inplace normalise the vector by its magnitude.
static void calcIsoFacePointsFromEdges(const vector &faceArea, const vector &faceCentre, const DynamicList< DynamicList< point >> &faceEdges, DynamicList< point > &facePoints)
Calculates the point of the cutting face.
quaternion normalised(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
#define forAll(list, i)
Loop across all elements in list.
const dimensionedScalar e
Elementary charge.
cutCell(const fvMesh &mesh)
Construct from fvMesh.
constexpr scalar pi(M_PI)
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
dimensionedScalar atan2(const dimensionedScalar &x, const dimensionedScalar &y)
vector point
Point is a vector.
Mesh data needed to do the Finite Volume discretisation.
const dimensionedScalar c
Speed of light in a vacuum.
static void calcGeomDataCutFace(const DynamicList< DynamicList< point >> &faceEdges, const vector &subCellCentre, vector &faceArea, vector &faceCentre)
Calculates area and centre of the cutting face.
List< label > labelList
A List of labels.
static constexpr const zero Zero
Global zero (0)