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>
154 faceToPointWeightsPtr_(nullptr),
155 faceToEdgeWeightsPtr_(nullptr)
161 template<
class Patch>
170 if (
ff.size() != patch_.size())
173 <<
"given field does not correspond to patch. Patch size: " 174 << patch_.size() <<
" field size: " <<
ff.size()
179 auto& result = tresult.ref();
184 forAll(pointFaces, pointi)
186 const labelList& curFaces = pointFaces[pointi];
191 result[pointi] += w[facei]*
ff[curFaces[facei]];
199 template<
class Patch>
213 template<
class Patch>
221 if (pf.
size() != patch_.nPoints())
224 <<
"given field does not correspond to patch. Patch size: " 225 << patch_.nPoints() <<
" field size: " << pf.
size()
229 auto tresult = tmp<Field<Type>>
::New(patch_.size(),
Zero);
230 auto& result = tresult.ref();
232 const auto& localFaces = patch_.localFaces();
236 const labelList& curPoints = localFaces[facei];
240 result[facei] += pf[curPoints[pointi]];
243 result[facei] /= curPoints.
size();
250 template<
class Patch>
264 template<
class Patch>
273 if (pf.
size() != patch_.size())
276 <<
"given field does not correspond to patch. Patch size: " 277 << patch_.size() <<
" field size: " << pf.
size()
281 auto tresult = tmp<Field<Type>>
::New(patch_.nEdges(),
Zero);
282 auto& result = tresult.ref();
284 const edgeList& edges = patch_.edges();
287 const scalarList& weights = faceToEdgeWeights();
289 for (label edgei = 0; edgei < patch_.nInternalEdges(); edgei++)
292 weights[edgei]*pf[edgeFaces[edgei][0]]
293 + (1.0 - weights[edgei])*pf[edgeFaces[edgei][1]];
296 for (label edgei = patch_.nInternalEdges(); edgei < edges.size(); edgei++)
298 result[edgei] = pf[edgeFaces[edgei][0]];
305 template<
class Patch>
319 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.
void setSize(const label n)
Alias for resize()
Generic templated field type.
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: [].
const FieldField< fvPatchField, Type > & ff(const FieldField< fvPatchField, Type > &bf)
static constexpr const zero Zero
Global zero (0)