39 PrimitivePatchInterpolation<Patch>::faceToPointWeights()
const
41 if (!faceToPointWeightsPtr_)
43 makeFaceToPointWeights();
46 return *faceToPointWeightsPtr_;
51 void PrimitivePatchInterpolation<Patch>::makeFaceToPointWeights()
const
53 if (faceToPointWeightsPtr_)
56 <<
"Face-to-edge weights already calculated"
61 const List<typename Patch::FaceType>& faces = patch_.localFaces();
71 const labelList& curFaces = pointFaces[pointi];
95 PrimitivePatchInterpolation<Patch>::faceToEdgeWeights()
const
97 if (!faceToEdgeWeightsPtr_)
99 makeFaceToEdgeWeights();
102 return *faceToEdgeWeightsPtr_;
106 template<
class Patch>
107 void PrimitivePatchInterpolation<Patch>::makeFaceToEdgeWeights()
const
109 if (faceToEdgeWeightsPtr_)
112 <<
"Face-to-edge weights already calculated"
117 const List<typename Patch::FaceType>& faces = patch_.localFaces();
118 const edgeList& edges = patch_.edges();
121 faceToEdgeWeightsPtr_ =
new scalarList(patch_.nInternalEdges());
132 -(((N - P)^(
S - P))&((N - P)^
e))/(((N - P)^
e )&((N - P)^
e));
136 weights[edgei] =
mag(N - E)/(
mag(N - E) +
mag(E - P));
141 template<
class Patch>
142 void PrimitivePatchInterpolation<Patch>::clearWeights()
151 template<
class Patch>
155 faceToPointWeightsPtr_(nullptr),
156 faceToEdgeWeightsPtr_(nullptr)
162 template<
class Patch>
171 template<
class Patch>
179 if (
ff.size() != patch_.size())
182 <<
"given field does not correspond to patch. Patch size: "
183 << patch_.size() <<
" field size: " <<
ff.size()
191 patch_.nPoints(),
Zero
200 forAll(pointFaces, pointi)
202 const labelList& curFaces = pointFaces[pointi];
207 result[pointi] += w[facei]*
ff[curFaces[facei]];
215 template<
class Patch>
228 template<
class Patch>
235 if (pf.
size() != patch_.nPoints())
238 <<
"given field does not correspond to patch. Patch size: "
239 << patch_.nPoints() <<
" field size: " << pf.
size()
258 const labelList& curPoints = localFaces[facei];
262 result[facei] += pf[curPoints[pointi]];
265 result[facei] /= curPoints.
size();
272 template<
class Patch>
285 template<
class Patch>
293 if (pf.
size() != patch_.size())
296 <<
"given field does not correspond to patch. Patch size: "
297 << patch_.size() <<
" field size: " << pf.
size()
308 const edgeList& edges = patch_.edges();
311 const scalarList& weights = faceToEdgeWeights();
313 for (
label edgei = 0; edgei < patch_.nInternalEdges(); edgei++)
316 weights[edgei]*pf[edgeFaces[edgei][0]]
317 + (1.0 - weights[edgei])*pf[edgeFaces[edgei][1]];
320 for (
label edgei = patch_.nInternalEdges(); edgei < edges.
size(); edgei++)
322 result[edgei] = pf[edgeFaces[edgei][0]];
329 template<
class Patch>
342 template<
class Patch>
#define forAll(list, i)
Loop across all elements in list.
Pre-declare SubField and related Field type.
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
bool movePoints()
Do what is necessary if the mesh has moved.
PrimitivePatchInterpolation(const Patch &p)
Construct from PrimitivePatch.
tmp< Field< Type > > faceToPointInterpolate(const Field< Type > &ff) const
Interpolate from faces to points.
~PrimitivePatchInterpolation()
Destructor.
tmp< Field< Type > > faceToEdgeInterpolate(const Field< Type > &ff) const
Interpolate from faces to edges.
tmp< Field< Type > > pointToFaceInterpolate(const Field< Type > &pf) const
Interpolate from points to faces.
const Vector< Cmpt > & centre(const Foam::List< Vector< Cmpt >> &) const
Return *this (used for point which is a typedef to Vector<scalar>.
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
Template functions to aid in the implementation of demand driven data.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
const FieldField< fvPatchField, Type > & ff(const FieldField< fvPatchField, Type > &bf)
tmp< fvMatrix< Type > > S(const Pair< tmp< volScalarField::Internal >> &, const VolField< Type > &)
List< scalarList > scalarListList
List< label > labelList
A List of labels.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void deleteDemandDrivenData(DataType *&dataPtr)
errorManip< error > abort(error &err)
vectorField pointField
pointField is a vectorField.
List< scalar > scalarList
A List of scalars.
Vector< scalar > vector
A scalar version of the templated Vector.
List< labelList > labelListList
A List of labelList.
dimensioned< scalar > mag(const dimensioned< Type > &)