Go to the documentation of this file.
43 Pout<<
"primitiveMesh::calcFaceCentresAndAreas() : "
44 <<
"Calculating face centres and face areas"
50 if (faceCentresPtr_ || faceAreasPtr_)
53 <<
"Face centres or face areas already calculated"
67 Pout<<
"primitiveMesh::calcFaceCentresAndAreas() : "
68 <<
"Finished calculating face centres and face areas"
92 fCtrs[facei] = (1.0/3.0)*(
p[
f[0]] +
p[
f[1]] +
p[
f[2]]);
93 fAreas[facei] = 0.5*((
p[
f[1]] -
p[
f[0]])^(
p[
f[2]] -
p[
f[0]]));
99 solveVector sumN =
Zero;
100 solveScalar sumA = 0.0;
101 solveVector sumAc =
Zero;
103 solveVector fCentre =
p[
f[0]];
106 fCentre += solveVector(
p[
f[
pi]]);
114 const solveVector nextPoint(
p[
f[nextPi]]);
115 const solveVector thisPoint(
p[
f[
pi]]);
117 solveVector
c = thisPoint + nextPoint + fCentre;
118 solveVector
n = (nextPoint - thisPoint)^(fCentre - thisPoint);
119 solveScalar a =
mag(
n);
127 if (sumA < ROOTVSMALL)
129 fCtrs[facei] = fCentre;
130 fAreas[facei] =
Zero;
134 fCtrs[facei] = (1.0/3.0)*sumAc/sumA;
135 fAreas[facei] = 0.5*sumN;
146 if (!faceCentresPtr_)
148 calcFaceCentresAndAreas();
151 return *faceCentresPtr_;
159 calcFaceCentresAndAreas();
162 return *faceAreasPtr_;
int debug
Static debugging option.
void makeFaceCentresAndAreas(const pointField &p, vectorField &fCtrs, vectorField &fAreas) const
virtual const pointField & points() const =0
Return mesh points.
static constexpr const zero Zero
Global zero (0)
label nFaces() const
Number of mesh faces.
Ostream & endl(Ostream &os)
Add newline and flush stream.
prefixOSstream Pout
An Ostream wrapper for parallel output to std::cout.
#define forAll(list, i)
Loop across all elements in list.
Field< vector > vectorField
Specialisation of Field<T> for vector.
void calcFaceCentresAndAreas() const
Calculate face centres and areas.
errorManip< error > abort(error &err)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
constexpr scalar pi(M_PI)
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const vectorField & faceCentres() const
const dimensionedScalar c
Speed of light in a vacuum.
const vectorField & faceAreas() const