39 PrimitivePatchInterpolation<Patch>::faceToPointWeights()
const
41 if (!faceToPointWeightsPtr_)
43 makeFaceToPointWeights();
46 return *faceToPointWeightsPtr_;
51 void PrimitivePatchInterpolation<Patch>::makeFaceToPointWeights()
const
53 if (faceToPointWeightsPtr_)
57 "PrimitivePatchInterpolation<Patch>::makeFaceToPointWeights() const"
58 ) <<
"Face-to-edge weights already calculated"
63 const faceList& faces = patch_.localFaces();
73 const labelList& curFaces = pointFaces[pointi];
83 1.0/
mag(faces[curFaces[facei]].centre(points) - points[pointi]);
97 PrimitivePatchInterpolation<Patch>::faceToEdgeWeights()
const
99 if (!faceToEdgeWeightsPtr_)
101 makeFaceToEdgeWeights();
104 return *faceToEdgeWeightsPtr_;
108 template<
class Patch>
109 void PrimitivePatchInterpolation<Patch>::makeFaceToEdgeWeights()
const
111 if (faceToEdgeWeightsPtr_)
115 "PrimitivePatchInterpolation<Patch>::makeFaceToEdgeWeights() const"
116 ) <<
"Face-to-edge weights already calculated"
120 const pointField& points = patch_.localPoints();
121 const faceList& faces = patch_.localFaces();
122 const edgeList& edges = patch_.edges();
125 faceToEdgeWeightsPtr_ =
new scalarList(patch_.nInternalEdges());
128 for (label edgei = 0; edgei < weights.size(); edgei++)
132 vector S = points[edges[edgei].start()];
133 vector e = edges[edgei].vec(points);
136 -(((N - P)^(S - P))&((N - P)^
e))/(((N - P)^e )&((N - P)^e));
140 weights[edgei] =
mag(N - E)/(
mag(N - E) +
mag(E - P));
145 template<
class Patch>
146 void PrimitivePatchInterpolation<Patch>::clearWeights()
155 template<
class Patch>
159 faceToPointWeightsPtr_(NULL),
160 faceToEdgeWeightsPtr_(NULL)
166 template<
class Patch>
175 template<
class Patch>
183 if (ff.
size() != patch_.size())
187 "tmp<Field<Type> > PrimitivePatchInterpolation::"
188 "faceToPointInterpolate(const Field<Type> ff)"
189 ) <<
"given field does not correspond to patch. Patch size: "
190 << patch_.size() <<
" field size: " << ff.
size()
207 forAll(pointFaces, pointi)
209 const labelList& curFaces = pointFaces[pointi];
214 result[pointi] += w[facei]*ff[curFaces[facei]];
222 template<
class Patch>
235 template<
class Patch>
242 if (pf.
size() != patch_.nPoints())
246 "tmp<Field<Type> > PrimitivePatchInterpolation::"
247 "pointToFaceInterpolate(const Field<Type> pf)"
248 ) <<
"given field does not correspond to patch. Patch size: "
249 << patch_.nPoints() <<
" field size: " << pf.
size()
264 const faceList& localFaces = patch_.localFaces();
268 const labelList& curPoints = localFaces[facei];
272 result[facei] += pf[curPoints[pointi]];
275 result[facei] /= curPoints.
size();
282 template<
class Patch>
295 template<
class Patch>
303 if (pf.
size() != patch_.size())
307 "tmp<Field<Type> > PrimitivePatchInterpolation::"
308 "faceToEdgeInterpolate(const Field<Type> ff)"
309 ) <<
"given field does not correspond to patch. Patch size: "
310 << patch_.size() <<
" field size: " << pf.
size()
321 const pointField& points = patch_.localPoints();
322 const faceList& faces = patch_.localFaces();
323 const edgeList& edges = patch_.edges();
326 const scalarList& weights = faceToEdgeWeights();
328 for (label edgei = 0; edgei < patch_.nInternalEdges(); edgei++)
331 weights[edgei]*pf[edgeFaces[edgei][0]]
332 + (1.0 - weights[edgei])*pf[edgeFaces[edgei][1]];
335 for (label edgei = patch_.nInternalEdges(); edgei < edges.
size(); edgei++)
337 result[edgei] = pf[edgeFaces[edgei][0]];
344 template<
class Patch>
357 template<
class Patch>