// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Patch>
template<class Type>
tmp<Field<Type> > CoupledPatchInterpolation<Patch>::faceToPointInterpolate
(
const Field<Type>& ff
) const
{
// Check size of the given field
if (ff.size() != patch_.size())
{
FatalErrorIn
(
"tmp<Field<Type> > CoupledPatchInterpolation::"
"faceToPointInterpolate(const Field<Type> ff)"
) << "given field does not correspond to patch. Patch size: "
<< patch_.size() << " field size: " << ff.size()
<< abort(FatalError);
}
tmp<Field<Type> > tresult
(
new Field<Type>
(
// patch_.nPoints(), pTraits<Type>::zero
patch_.nPoints(), Zero
)
);
Field<Type>& result = tresult.ref();
List<Type> pointValue;
pointValue.setSize( patch_.nPoints() );
const labelListList& pointFaces = patch_.pointFaces();
const scalarListList& weights = faceToPointWeights();
forAll(pointFaces, pointi)
{
const labelList& curFaces = pointFaces[pointi];
const scalarList& w = weights[pointi];
Type tvalue = pTraits<Type>::zero;
forAll(curFaces, facei)
{
tvalue += w[facei]*ff[curFaces[facei]]; // Z成分だけに対してこの計算をしたい
}
pointValue[pointi] = tvalue;
}
syncTools::syncPointList( mesh_, patch_.meshPoints(), pointValue, plusEqOp<Type>(), pTraits<Type>::zero);
// normalization
const scalarList& sumw = faceToPointSumWeights();
forAll(pointFaces, pointi)
{
result[pointi] = pointValue[pointi] / sumw[pointi];
}
return tresult;
}