37 if (!faceToPointWeightsPtr_)
39 makeFaceToPointWeights();
42 return *faceToPointWeightsPtr_;
49 if (faceToPointWeightsPtr_)
52 <<
"Face-to-edge weights already calculated" 56 const auto&
points = patch_.localPoints();
57 const auto& faces = patch_.localFaces();
60 auto& weights = *faceToPointWeightsPtr_;
67 const labelList& curFaces = pointFaces[pointi];
93 if (!faceToEdgeWeightsPtr_)
95 makeFaceToEdgeWeights();
98 return *faceToEdgeWeightsPtr_;
102 template<
class Patch>
105 if (faceToEdgeWeightsPtr_)
108 <<
"Face-to-edge weights already calculated" 112 const auto&
points = patch_.localPoints();
113 const auto& faces = patch_.localFaces();
114 const edgeList& edges = patch_.edges();
117 faceToEdgeWeightsPtr_.reset(
new scalarList(patch_.nInternalEdges()));
118 auto& weights = *faceToEdgeWeightsPtr_;
128 -(((
N - P)^(S - P))&((
N - P)^
e))/(((
N - P)^
e )&((
N - P)^
e));
132 weights[edgei] =
mag(
N - E)/(
mag(
N - E) +
mag(E - P));
137 template<
class Patch>
140 faceToPointWeightsPtr_.reset(
nullptr);
141 faceToEdgeWeightsPtr_.reset(
nullptr);
147 template<
class Patch>
159 template<
class Patch>
168 if (
ff.size() != patch_.size())
171 <<
"given field does not correspond to patch. Patch size: " 172 << patch_.size() <<
" field size: " <<
ff.size()
177 auto& result = tresult.ref();
182 forAll(pointFaces, pointi)
184 const labelList& curFaces = pointFaces[pointi];
189 result[pointi] += w[facei]*
ff[curFaces[facei]];
197 template<
class Patch>
211 template<
class Patch>
219 if (pf.
size() != patch_.nPoints())
222 <<
"given field does not correspond to patch. Patch size: " 223 << patch_.nPoints() <<
" field size: " << pf.
size()
227 auto tresult = tmp<Field<Type>>
::New(patch_.size(),
Zero);
228 auto& result = tresult.ref();
230 const auto& localFaces = patch_.localFaces();
234 const labelList& curPoints = localFaces[facei];
238 result[facei] += pf[curPoints[pointi]];
241 result[facei] /= curPoints.
size();
248 template<
class Patch>
262 template<
class Patch>
271 if (pf.
size() != patch_.size())
274 <<
"given field does not correspond to patch. Patch size: " 275 << patch_.size() <<
" field size: " << pf.
size()
279 auto tresult = tmp<Field<Type>>
::New(patch_.nEdges(),
Zero);
280 auto& result = tresult.ref();
282 const edgeList& edges = patch_.edges();
285 const scalarList& weights = faceToEdgeWeights();
287 for (label edgei = 0; edgei < patch_.nInternalEdges(); edgei++)
290 weights[edgei]*pf[edgeFaces[edgei][0]]
291 + (1.0 - weights[edgei])*pf[edgeFaces[edgei][1]];
294 for (label edgei = patch_.nInternalEdges(); edgei < edges.size(); edgei++)
296 result[edgei] = pf[edgeFaces[edgei][0]];
303 template<
class Patch>
317 template<
class Patch>
List< scalar > scalarList
List of scalar.
Interpolation class within a primitive patch. Allows interpolation from points to faces and vice vers...
void size(const label n)
Older name for setAddressableSize.
tmp< Field< Type > > pointToFaceInterpolate(const Field< Type > &pf) const
Interpolate from points to faces.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
List< edge > edgeList
List of edge.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
tmp< Field< Type > > faceToEdgeInterpolate(const Field< Type > &ff) const
Interpolate from faces to edges.
List< labelList > labelListList
List of labelList.
#define forAll(list, i)
Loop across all elements in list.
const dimensionedScalar e
Elementary charge.
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
List< scalarList > scalarListList
List of scalarList.
bool movePoints()
Do what is necessary if the mesh has moved.
errorManip< error > abort(error &err)
const Vector< Cmpt > & centre(const Foam::UList< Vector< Cmpt >> &) const noexcept
Return this (for point which is a typedef to Vector<scalar>)
const Vector< label > N(dict.get< Vector< label >>("N"))
tmp< Field< Type > > faceToPointInterpolate(const Field< Type > &ff) const
Interpolate from faces to points.
List< label > labelList
A List of labels.
A class for managing temporary objects.
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
void setSize(label n)
Alias for resize()
const FieldField< fvPatchField, Type > & ff(const FieldField< fvPatchField, Type > &bf)
static constexpr const zero Zero
Global zero (0)