42PrimitivePatchInterpolation<Patch>::faceToPointWeights()
const
44 if (!faceToPointWeightsPtr_)
46 makeFaceToPointWeights();
49 return *faceToPointWeightsPtr_;
54void PrimitivePatchInterpolation<Patch>::makeFaceToPointWeights()
const
56 if (faceToPointWeightsPtr_)
59 <<
"Face-to-edge weights already calculated"
64 const List<typename Patch::face_type>& faces = patch_.localFaces();
67 auto& weights = *faceToPointWeightsPtr_;
74 const labelList& curFaces = pointFaces[pointi];
98PrimitivePatchInterpolation<Patch>::faceToEdgeWeights()
const
100 if (!faceToEdgeWeightsPtr_)
102 makeFaceToEdgeWeights();
105 return *faceToEdgeWeightsPtr_;
112 if (faceToEdgeWeightsPtr_)
115 <<
"Face-to-edge weights already calculated"
121 const edgeList& edges = patch_.edges();
124 faceToEdgeWeightsPtr_ =
new scalarList(patch_.nInternalEdges());
125 auto& weights = *faceToEdgeWeightsPtr_;
135 -(((
N - P)^(S - P))&((
N - P)^
e))/(((
N - P)^
e )&((
N - P)^
e));
139 weights[edgei] =
mag(
N - E)/(
mag(
N - E) +
mag(E - P));
145void PrimitivePatchInterpolation<Patch>::clearWeights()
158 faceToPointWeightsPtr_(nullptr),
159 faceToEdgeWeightsPtr_(nullptr)
182 if (ff.size() != patch_.size())
185 <<
"given field does not correspond to patch. Patch size: "
186 << patch_.size() <<
" field size: " << ff.size()
194 patch_.nPoints(),
Zero
203 forAll(pointFaces, pointi)
205 const labelList& curFaces = pointFaces[pointi];
210 result[pointi] += w[facei]*ff[curFaces[facei]];
238 if (pf.
size() != patch_.nPoints())
241 <<
"given field does not correspond to patch. Patch size: "
242 << patch_.nPoints() <<
" field size: " << pf.
size()
261 const labelList& curPoints = localFaces[facei];
265 result[facei] += pf[curPoints[pointi]];
268 result[facei] /= curPoints.
size();
296 if (pf.
size() != patch_.size())
299 <<
"given field does not correspond to patch. Patch size: "
300 << patch_.size() <<
" field size: " << pf.
size()
305 auto& result = tresult.ref();
307 const edgeList& edges = patch_.edges();
310 const scalarList& weights = faceToEdgeWeights();
312 for (label edgei = 0; edgei < patch_.nInternalEdges(); edgei++)
315 weights[edgei]*pf[edgeFaces[edgei][0]]
316 + (1.0 - weights[edgei])*pf[edgeFaces[edgei][1]];
319 for (label edgei = patch_.nInternalEdges(); edgei < edges.
size(); edgei++)
321 result[edgei] = pf[edgeFaces[edgei][0]];
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void setSize(const label n)
Alias for resize()
Interpolation class within a primitive patch. Allows interpolation from points to faces and vice vers...
bool movePoints()
Do what is necessary if the mesh has moved.
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.
void size(const label n)
Older name for setAddressableSize.
A class for managing temporary objects.
Template functions to aid in the implementation of demand driven data.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
List< label > labelList
A List of labels.
vectorField pointField
pointField is a vectorField.
List< scalar > scalarList
A List of scalars.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
List< labelList > labelListList
A List of labelList.
errorManip< error > abort(error &err)
static constexpr const zero Zero
Global zero (0)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh > > &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
List< scalarList > scalarListList
A List of scalarList.
void deleteDemandDrivenData(DataPtr &dataPtr)
#define forAll(list, i)
Loop across all elements in list.
const Vector< label > N(dict.get< Vector< label > >("N"))