fixed writing out entries in advective bc
[OpenFOAM-1.6-ext.git] / src / finiteVolume / interpolation / surfaceInterpolation / surfaceInterpolationScheme / surfaceInterpolationScheme.H
blob706d321a8b585d317b89cb1cfbbc8121b01ba6c5
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright held by original author
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM 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 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::surfaceInterpolationScheme
28 Description
29     Abstract base class for surface interpolation schemes.
31 SourceFiles
32     surfaceInterpolationScheme.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef surfaceInterpolationScheme_H
37 #define surfaceInterpolationScheme_H
39 #include "tmp.H"
40 #include "volFieldsFwd.H"
41 #include "surfaceFieldsFwd.H"
42 #include "typeInfo.H"
43 #include "runTimeSelectionTables.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 namespace Foam
50 class fvMesh;
52 /*---------------------------------------------------------------------------*\
53                  Class surfaceInterpolationScheme Declaration
54 \*---------------------------------------------------------------------------*/
56 template<class Type>
57 class surfaceInterpolationScheme
59     public refCount
61     // Private data
63         //- Hold reference to mesh
64         const fvMesh& mesh_;
67     // Private Member Functions
69         //- Disallow copy construct
70         surfaceInterpolationScheme(const surfaceInterpolationScheme&);
72         //- Disallow default bitwise assignment
73         void operator=(const surfaceInterpolationScheme&);
76 public:
78     //- Runtime type information
79     TypeName("surfaceInterpolationScheme");
82     // Declare run-time constructor selection tables
84         declareRunTimeSelectionTable
85         (
86             tmp,
87             surfaceInterpolationScheme,
88             Mesh,
89             (
90                 const fvMesh& mesh,
91                 Istream& schemeData
92             ),
93             (mesh, schemeData)
94         );
96         declareRunTimeSelectionTable
97         (
98             tmp,
99             surfaceInterpolationScheme,
100             MeshFlux,
101             (
102                 const fvMesh& mesh,
103                 const surfaceScalarField& faceFlux,
104                 Istream& schemeData
105             ),
106             (mesh, faceFlux, schemeData)
107         );
110     // Constructors
112         //- Construct from mesh
113         surfaceInterpolationScheme(const fvMesh& mesh)
114         :
115             mesh_(mesh)
116         {}
119     // Selectors
121         //- Return new tmp interpolation scheme
122         static tmp<surfaceInterpolationScheme<Type> > New
123         (
124             const fvMesh& mesh,
125             Istream& schemeData
126         );
128         //- Return new tmp interpolation scheme
129         static tmp<surfaceInterpolationScheme<Type> > New
130         (
131             const fvMesh& mesh,
132             const surfaceScalarField& faceFlux,
133             Istream& schemeData
134         );
137     // Destructor
139         virtual ~surfaceInterpolationScheme();
142     // Member Functions
144         //- Return mesh reference
145         const fvMesh& mesh() const
146         {
147             return mesh_;
148         }
151         //- Return the face-interpolate of the given cell field
152         //  with the given owner and neighbour weigting factors
153         static tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
154         interpolate
155         (
156             const GeometricField<Type, fvPatchField, volMesh>&,
157             const tmp<surfaceScalarField>&,
158             const tmp<surfaceScalarField>&
159         );
161         //- Return the face-interpolate of the given cell field
162         //  with the given weighting factors
163         static tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
164         interpolate
165         (
166             const GeometricField<Type, fvPatchField, volMesh>&,
167             const tmp<surfaceScalarField>&
168         );
171         //- Return the interpolation weighting factors for the given field
172         virtual tmp<surfaceScalarField> weights
173         (
174             const GeometricField<Type, fvPatchField, volMesh>&
175         ) const = 0;
177         //- Return true if this scheme uses an explicit correction
178         virtual bool corrected() const
179         {
180             return false;
181         }
183         //- Return the explicit correction to the face-interpolate
184         //  for the given field
185         virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
186         correction(const GeometricField<Type, fvPatchField, volMesh>&) const
187         {
188             return tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >(NULL);
189         }
191         //- Return the face-interpolate of the given cell field
192         //  with explicit correction
193         virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
194         interpolate(const GeometricField<Type, fvPatchField, volMesh>&) const;
196         //- Return the face-interpolate of the given tmp cell field
197         //  with explicit correction
198         tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
199         interpolate
200         (
201             const tmp<GeometricField<Type, fvPatchField, volMesh> >&
202         ) const;
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 } // End namespace Foam
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 // Add the patch constructor functions to the hash tables
214 #define makeSurfaceInterpolationTypeScheme(SS, Type)                           \
215                                                                                \
216 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0);                              \
217                                                                                \
218 surfaceInterpolationScheme<Type>::addMeshConstructorToTable<SS<Type> >         \
219     add##SS##Type##MeshConstructorToTable_;                                    \
220                                                                                \
221 surfaceInterpolationScheme<Type>::addMeshFluxConstructorToTable<SS<Type> >     \
222     add##SS##Type##MeshFluxConstructorToTable_;
224 #define makeSurfaceInterpolationScheme(SS)                                     \
225                                                                                \
226 makeSurfaceInterpolationTypeScheme(SS, scalar)                                 \
227 makeSurfaceInterpolationTypeScheme(SS, vector)                                 \
228 makeSurfaceInterpolationTypeScheme(SS, sphericalTensor)                        \
229 makeSurfaceInterpolationTypeScheme(SS, symmTensor)                             \
230 makeSurfaceInterpolationTypeScheme(SS, tensor)
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 #ifdef NoRepository
236 #   include "surfaceInterpolationScheme.C"
237 #endif
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 #endif
243 // ************************************************************************* //