1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
26 \*---------------------------------------------------------------------------*/
28 #include "tetPolyPatchInterpolation.H"
29 #include "faceTetPolyPatch.H"
31 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
35 Foam::tmp<Foam::Field<Type> >
36 Foam::tetPolyPatchInterpolation::faceToPointInterpolate
41 if (ff.size() != patch_.patch().size())
45 "tmp<Foam::Field<Type> >\n"
46 "tetPolyPatchInterpolation::faceToPointInterpolate\n"
48 " const Field<Type>& ff\n"
50 ) << "Field size: " << ff.size() << " does not match number of faces: "
51 << patch_.patch().size()
55 tmp<Field<Type> > tresult
57 new Field<Type>(patch_.size())
59 Field<Type>& result = tresult();
61 // Insert the point values first
64 const Field<Type> pointRes = interpolator_.faceToPointInterpolate(ff);
66 forAll (pointRes, pointI)
68 result[i] = pointRes[pointI];
72 // Insert the face centre values; no interpolation necessary
75 result[i] = ff[faceI];
84 Foam::tmp<Foam::Field<Type> >
85 Foam::tetPolyPatchInterpolation::faceToPointInterpolate
87 const tmp<Field<Type> >& tff
90 tmp<Field<Type> > tint = this->faceToPointInterpolate(tff());
97 Foam::tmp<Foam::Field<Type> >
98 Foam::tetPolyPatchInterpolation::pointToPointInterpolate
100 const Field<Type>& ff
103 if (ff.size() != patch_.patch().nPoints())
107 "tmp<Foam::Field<Type> >\n"
108 "tetPolyPatchInterpolation::pointToPointInterpolate\n"
110 " const Field<Type>& ff\n"
112 ) << "Field size: " << ff.size()
113 << " does not match number of points: "
114 << patch_.patch().nPoints()
115 << abort(FatalError);
118 tmp<Field<Type> > tresult
120 new Field<Type>(patch_.size())
122 Field<Type>& result = tresult();
124 // Insert the point values first; no interpolation necessary
129 result[i] = ff[pointI];
133 // Insert the face centre values
134 const Field<Type> faceRes = interpolator_.pointToFaceInterpolate(ff);
136 forAll (faceRes, faceI)
138 result[i] = faceRes[faceI];
147 Foam::tmp<Foam::Field<Type> >
148 Foam::tetPolyPatchInterpolation::pointToPointInterpolate
150 const tmp<Field<Type> >& tff
153 tmp<Field<Type> > tint = this->pointToPointInterpolate(tff());
159 // ************************************************************************* //