fix consistancy of gradient on coupled patches
[OpenFOAM-1.6-ext.git] / src / finiteVolume / interpolation / surfaceInterpolation / multivariateSchemes / multivariateSurfaceInterpolationScheme / multivariateSurfaceInterpolationScheme.H
blob912f3b9e89f650ae60b9411b687db2a35d8561be
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::multivariateSurfaceInterpolationScheme
28 Description
29     Abstract base class for multi-variate surface interpolation schemes.
31 SourceFiles
32     multivariateSurfaceInterpolationScheme.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef multivariateSurfaceInterpolationScheme_H
37 #define multivariateSurfaceInterpolationScheme_H
39 #include "surfaceInterpolationScheme.H"
40 #include "HashTable.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 namespace Foam
47 /*---------------------------------------------------------------------------*\
48                  Class multivariateSurfaceInterpolationScheme Declaration
49 \*---------------------------------------------------------------------------*/
51 template<class Type>
52 class multivariateSurfaceInterpolationScheme
54     public refCount
57 public:
59     //- fieldTable
60     class fieldTable
61     :
62         public HashTable<const GeometricField<Type, fvPatchField, volMesh>*>
63     {
64     public:
66         fieldTable()
67         {}
69         void add(const GeometricField<Type, fvPatchField, volMesh>& f)
70         {
71             insert(f.name(), &f);
72         }
73     };
76 private:
78     // Private data
80         //- Hold reference to mesh
81         const fvMesh& mesh_;
83         //- HashTable of pointers to the field set
84         const fieldTable& fields_;
87     // Private Member Functions
89         //- Disallow default bitwise copy construct
90         multivariateSurfaceInterpolationScheme
91         (
92             const multivariateSurfaceInterpolationScheme&
93         );
95         //- Disallow default bitwise assignment
96         void operator=(const multivariateSurfaceInterpolationScheme&);
99 public:
101     //- Runtime type information
102     virtual const word& type() const = 0;
105     // Declare run-time constructor selection tables
107         declareRunTimeSelectionTable
108         (
109             tmp,
110             multivariateSurfaceInterpolationScheme,
111             Istream,
112             (
113                 const fvMesh& mesh,
114                 const fieldTable& fields,
115                 const surfaceScalarField& faceFlux,
116                 Istream& is
117             ),
118             (mesh, fields, faceFlux, is)
119         );
122     // Constructors
124         //- Construct for interpolating given field
125         multivariateSurfaceInterpolationScheme
126         (
127             const fvMesh& mesh,
128             const fieldTable& fields,
129             const surfaceScalarField& faceFlux,
130             Istream& schemeData
131         );
134     // Selectors
136         //- Return a pointer to a new gradScheme created on freestore
137         static tmp<multivariateSurfaceInterpolationScheme<Type> > New
138         (
139             const fvMesh& mesh,
140             const fieldTable& fields,
141             const surfaceScalarField& faceFlux,
142             Istream& schemeData
143         );
146     // Destructor
148         virtual ~multivariateSurfaceInterpolationScheme();
151     // Member Functions
153         //- Return mesh reference
154         const fvMesh& mesh() const
155         {
156             return mesh_;
157         }
159         //- Return fields to be interpolated
160         const fieldTable& fields() const
161         {
162             return fields_;
163         }
166     // Member Operators
168         //- surfaceInterpolationScheme sub-class returned by operator(field)
169         //  which is used as the interpolation scheme for the field
170         class fieldScheme
171         :
172             public surfaceInterpolationScheme<Type>
173         {
175         public:
177             // Constructors
179                 fieldScheme
180                 (
181                     const GeometricField<Type, fvPatchField, volMesh>& field
182                 )
183                 :
184                     surfaceInterpolationScheme<Type>(field.mesh())
185                 {}
188             // Member Functions
190                 //- Return the interpolation weighting factors
191                 virtual tmp<surfaceScalarField> weights
192                 (
193                     const GeometricField<Type, fvPatchField, volMesh>& field
194                 ) const = 0;
195         };
197         virtual tmp<surfaceInterpolationScheme<Type> > operator()
198         (
199             const GeometricField<Type, fvPatchField, volMesh>& field
200         ) const = 0;
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 } // End namespace Foam
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 // Add the patch constructor functions to the hash tables
212 #define makeMultivariateSurfaceInterpolationTypeScheme(SS, Type)               \
213                                                                                \
214 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0);                              \
215                                                                                \
216 multivariateSurfaceInterpolationScheme<Type>::                                 \
217 addIstreamConstructorToTable<SS<Type> >                                        \
218     add##SS##Type##ConstructorToTable_;
221 #define makeMultivariateSurfaceInterpolationScheme(SS)                         \
222                                                                                \
223 makeMultivariateSurfaceInterpolationTypeScheme(SS, scalar)                     \
224 makeMultivariateSurfaceInterpolationTypeScheme(SS, vector)                     \
225 makeMultivariateSurfaceInterpolationTypeScheme(SS, sphericalTensor)            \
226 makeMultivariateSurfaceInterpolationTypeScheme(SS, symmTensor)                 \
227 makeMultivariateSurfaceInterpolationTypeScheme(SS, tensor)
230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 #ifdef NoRepository
233 #   include "multivariateSurfaceInterpolationScheme.C"
234 #endif
236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 #endif
240 // ************************************************************************* //