30 inline void Foam::MPLICcell::calcAddressing
32 const MPLICcellStorage& cellInfo
35 localEdgeFaces_.setSize(cellInfo.cellEdges().size());
36 localFaceEdges_.setSize(cellInfo.size());
40 forAll(cellInfo.cellEdges(), edgei)
42 edgeMap.set(cellInfo.cellEdges()[edgei], edgei);
43 localEdgeFaces_[edgei].clear();
49 localFaceEdges_[i].clear();
52 forAll(cellInfo.cellFaces(), facei)
54 const label faceN = cellInfo.cellFaces()[facei];
55 const labelList& faceEdges = cellInfo.faceEdges()[faceN];
58 const label edg = faceEdges[edgei];
59 const label localEdgeIndex = edgeMap[edg];
60 localEdgeFaces_[localEdgeIndex].append(facei);
61 localFaceEdges_[facei].append(localEdgeIndex);
64 addressingCalculated_ =
true;
68 inline bool Foam::MPLICcell::cutStatusCalcSf()
70 bool cutOrientationDiffers =
false;
71 const point pAvg =
sum(cutPoints_)/cutPoints_.size();
72 for (
label i=0; i<cutPoints_.size(); i+=2)
74 const vector area = (cutPoints_[i] - pAvg)^(cutPoints_[i+1] - pAvg);
78 sign(area.x()*cutSf_.x()) == -1
79 ||
sign(area.y()*cutSf_.y()) == -1
80 ||
sign(area.z()*cutSf_.z()) == -1
83 cutOrientationDiffers =
true;
88 return cutOrientationDiffers;
95 const point pAvg =
sum(cutPoints_)/cutPoints_.size();
96 for (
label i=0; i<cutPoints_.size(); i+=2)
98 cutArea += (cutPoints_[i] - pAvg)^(cutPoints_[i+1] - pAvg);
109 const point pAvg =
sum(cutPoints_)/cutPoints_.size();
114 for (
label i=0; i < cutPoints_.size(); i+=2)
116 const vector a = (cutPoints_[i] - pAvg) ^ (cutPoints_[i+1] - pAvg);
117 const vector c = cutPoints_[i] + cutPoints_[i+1] + pAvg;
118 const scalar an = a & sumAHat;
125 return (1.0/3.0)*sumAnc/sumAn;
134 inline void Foam::MPLICcell::appendSfCf
146 subFaceAreas_.append(Sf);
150 subFaceAreas_.append(-Sf);
152 subFaceCentres_.append(Cf);
157 inline void Foam::MPLICcell::phiU
165 const label nFaces = cFaces.size();
168 alphaPhiU_.setSize(nFaces);
172 phiU_.setSize(nFaces);
178 MPLICface().alphaPhiU(pointsU,
points, faces[cFaces[facei]]);
183 inline void Foam::MPLICcell::resetFaceFields(
const label nFaces)
185 alphaf_.setSize(nFaces);
189 subFaceMagSf_.setSize(nFaces);
194 alphaPhiU_.setSize(nFaces);
200 inline void Foam::MPLICcell::calcAlphaf
202 const UIndirectList<scalar>& magSfs
205 const label nFaces = magSfs.size();
206 alphaf_.setSize(nFaces);
209 if (magSfs[facei] > vSmall)
211 alphaf_[facei] = subFaceMagSf_[facei]/magSfs[facei];
214 alphaf_[facei] = (alphaf_[facei] > 1) ? 1 : alphaf_[facei];
224 inline void Foam::MPLICcell::calcAlphaUf()
226 const label nFaces = alphaPhiU_.size();
227 alphaf_.setSize(nFaces);
230 if (
mag(phiU_[facei]) > vSmall)
232 alphaf_[facei] = alphaPhiU_[facei]/phiU_[facei];
235 alphaf_[facei] = (alphaf_[facei] > 1) ? 1 : alphaf_[facei];
236 alphaf_[facei] = (alphaf_[facei] < 0) ? 0 : alphaf_[facei];
246 inline void Foam::MPLICcell::clearOneCut()
250 subFaceAreas_.clear();
251 subFaceCentres_.clear();
255 inline void Foam::MPLICcell::clear()
259 subFaceMagSf_.clear();
283 return subCellVolume_;
#define forAll(list, i)
Loop across all elements in list.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
scalar cutAlpha() const
Return volume fraction corresponding to the cut.
const DynamicList< scalar > & alphaf() const
Return face volume fraction.
const vector & cutNormal() const
Return cut normal.
scalar subCellVolume() const
Return sub-cell volume.
const dimensionedScalar c
Speed of light in a vacuum.
List< label > labelList
A List of labels.
dimensionedScalar sign(const dimensionedScalar &ds)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
vectorField pointField
pointField is a vectorField.
vector point
Point is a vector.
Vector< scalar > vector
A scalar version of the templated Vector.
dimensionSet normalised(const dimensionSet &)
dimensioned< scalar > mag(const dimensioned< Type > &)
Field< vector > vectorField
Specialisation of Field<T> for vector.