Forward compatibility: flex
[foam-extend-3.2.git] / src / finiteArea / interpolation / edgeInterpolation / edgeInterpolationScheme / edgeInterpolationScheme.H
blobd3c0086e0011a5fffc4cc74a021fb2f18392b4f3
1 /*---------------------------------------------------------------------------*\
2   =========                 |
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 -------------------------------------------------------------------------------
8 License
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/>.
24 Class
25     edgeInterpolationScheme
27 Description
28     Abstract base class for edge interpolation schemes.
30 SourceFiles
31     edgeInterpolationScheme.C
33 \*---------------------------------------------------------------------------*/
35 #ifndef edgeInterpolationScheme_H
36 #define edgeInterpolationScheme_H
38 #include "tmp.H"
39 #include "areaFieldsFwd.H"
40 #include "edgeFieldsFwd.H"
41 #include "typeInfo.H"
42 #include "runTimeSelectionTables.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 namespace Foam
49 class faMesh;
51 /*---------------------------------------------------------------------------*\
52                     Class edgeInterpolationScheme Declaration
53 \*---------------------------------------------------------------------------*/
55 template<class Type>
56 class edgeInterpolationScheme
58     public refCount
60     // Private data
62         //- Hold reference to mesh
63         const faMesh& mesh_;
66     // Private Member Functions
68         //- Disallow default bitwise assignment
69         void operator=(const edgeInterpolationScheme&);
72 public:
74     // Declare run-time constructor selection tables
76         declareRunTimeSelectionTable
77         (
78             tmp,
79             edgeInterpolationScheme,
80             Mesh,
81             (
82                 const faMesh& mesh,
83                 Istream& schemeData
84             ),
85             (mesh, schemeData)
86         );
88         declareRunTimeSelectionTable
89         (
90             tmp,
91             edgeInterpolationScheme,
92             MeshFlux,
93             (
94                 const faMesh& mesh,
95                 const edgeScalarField& faceFlux,
96                 Istream& schemeData
97             ),
98             (mesh, faceFlux, schemeData)
99         );
102     // Constructors
104         //- Construct from mesh
105         edgeInterpolationScheme(const faMesh& mesh)
106         :
107             mesh_(mesh)
108         {}
111     // Selectors
113         //- Return new tmp interpolation scheme
114         static tmp<edgeInterpolationScheme<Type> > New
115         (
116             const faMesh& mesh,
117             Istream& schemeData
118         );
120         //- Return new tmp interpolation scheme
121         static tmp<edgeInterpolationScheme<Type> > New
122         (
123             const faMesh& mesh,
124             const edgeScalarField& faceFlux,
125             Istream& schemeData
126         );
129     // Destructor
131         virtual ~edgeInterpolationScheme();
134     // Member Functions
136         //- Return mesh reference
137         const faMesh& mesh() const
138         {
139             return mesh_;
140         }
143         //- Return the face-interpolate of the given cell field
144         //  with the given owner and neighbour weigting factors
145         static tmp<GeometricField<Type, faePatchField, edgeMesh> >
146         interpolate
147         (
148             const GeometricField<Type, faPatchField, areaMesh>&,
149             const tmp<edgeScalarField>&,
150             const tmp<edgeScalarField>&
151         );
153         //- Return the face-interpolate of the given cell field
154         //  with the given weigting factors
155         static tmp<GeometricField<Type, faePatchField, edgeMesh> >
156         interpolate
157         (
158             const GeometricField<Type, faPatchField, areaMesh>&,
159             const tmp<edgeScalarField>&
160         );
163         //- Return the euclidian edge-interpolate of the given area field
164         //  with the given weigting factors
165         static tmp<GeometricField<Type, faePatchField, edgeMesh> >
166         euclidianInterpolate
167         (
168             const GeometricField<Type, faPatchField, areaMesh>&,
169             const tmp<edgeScalarField>&
170         );
173         //- Return the interpolation weighting factors for the given field
174         virtual tmp<edgeScalarField> weights
175         (
176             const GeometricField<Type, faPatchField, areaMesh>&
177         ) const = 0;
179         //- Return true if this scheme uses an explicit correction
180         virtual bool corrected() const
181         {
182             return false;
183         }
185         //- Return the explicit correction to the face-interpolate
186         //  for the given field
187         virtual tmp<GeometricField<Type, faePatchField, edgeMesh> >
188         correction(const GeometricField<Type, faPatchField, areaMesh>&) const
189         {
190             return tmp<GeometricField<Type, faePatchField, edgeMesh> >(NULL);
191         }
193         //- Return the face-interpolate of the given cell field
194         //  with explicit correction
195         virtual tmp<GeometricField<Type, faePatchField, edgeMesh> >
196         interpolate(const GeometricField<Type, faPatchField, areaMesh>&) const;
198         //- Return the euclidian edge-interpolate of the given area field
199         //  without explicit correction
200         virtual tmp<GeometricField<Type, faePatchField, edgeMesh> >
201         euclidianInterpolate
202         (
203             const GeometricField<Type, faPatchField, areaMesh>&
204         ) const;
206         //- Return the face-interpolate of the given tmp cell field
207         //  with explicit correction
208         tmp<GeometricField<Type, faePatchField, edgeMesh> >
209         interpolate
210         (
211             const tmp<GeometricField<Type, faPatchField, areaMesh> >&
212         ) const;
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 } // End namespace Foam
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 // Add the patch constructor functions to the hash tables
224 #define makeEdgeInterpolationTypeScheme(SS, Type)                              \
225                                                                                \
226 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0);                              \
227                                                                                \
228 edgeInterpolationScheme<Type>::addMeshConstructorToTable<SS<Type> >            \
229     add##SS##Type##MeshConstructorToTable_;                                    \
230                                                                                \
231 edgeInterpolationScheme<Type>::addMeshFluxConstructorToTable<SS<Type> >        \
232     add##SS##Type##MeshFluxConstructorToTable_;
234 #define makeEdgeInterpolationScheme(SS)                                        \
235                                                                                \
236 makeEdgeInterpolationTypeScheme(SS, scalar)                                    \
237 makeEdgeInterpolationTypeScheme(SS, vector)                                    \
238 makeEdgeInterpolationTypeScheme(SS, tensor)
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 #ifdef NoRepository
244 #   include "edgeInterpolationScheme.C"
245 #endif
247 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
249 #endif
251 // ************************************************************************* //