ENH: autoLayerDriver: better layering information message
[OpenFOAM-2.0.x.git] / src / finiteVolume / interpolation / surfaceInterpolation / multivariateSchemes / multivariateSurfaceInterpolationScheme / multivariateSurfaceInterpolationScheme.H
blob00bc2b8877969e378b033e00d94ac5ac23c6683a
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
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
13     the Free Software Foundation, either version 3 of the License, or
14     (at your 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, see <http://www.gnu.org/licenses/>.
24 Class
25     Foam::multivariateSurfaceInterpolationScheme
27 Description
28     Abstract base class for multi-variate surface interpolation schemes.
30 SourceFiles
31     multivariateSurfaceInterpolationScheme.C
33 \*---------------------------------------------------------------------------*/
35 #ifndef multivariateSurfaceInterpolationScheme_H
36 #define multivariateSurfaceInterpolationScheme_H
38 #include "surfaceInterpolationScheme.H"
39 #include "HashTable.H"
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 namespace Foam
46 /*---------------------------------------------------------------------------*\
47                  Class multivariateSurfaceInterpolationScheme Declaration
48 \*---------------------------------------------------------------------------*/
50 template<class Type>
51 class multivariateSurfaceInterpolationScheme
53     public refCount
56 public:
58     //- fieldTable
59     class fieldTable
60     :
61         public HashTable<const GeometricField<Type, fvPatchField, volMesh>*>
62     {
63     public:
65         fieldTable()
66         {}
68         void add(const GeometricField<Type, fvPatchField, volMesh>& f)
69         {
70             this->insert(f.name(), &f);
71         }
72     };
75 private:
77     // Private data
79         //- Hold reference to mesh
80         const fvMesh& mesh_;
82         //- HashTable of pointers to the field set
83         const fieldTable& fields_;
86     // Private Member Functions
88         //- Disallow default bitwise copy construct
89         multivariateSurfaceInterpolationScheme
90         (
91             const multivariateSurfaceInterpolationScheme&
92         );
94         //- Disallow default bitwise assignment
95         void operator=(const multivariateSurfaceInterpolationScheme&);
98 public:
100     //- Runtime type information
101     virtual const word& type() const = 0;
104     // Declare run-time constructor selection tables
106         declareRunTimeSelectionTable
107         (
108             tmp,
109             multivariateSurfaceInterpolationScheme,
110             Istream,
111             (
112                 const fvMesh& mesh,
113                 const fieldTable& fields,
114                 const surfaceScalarField& faceFlux,
115                 Istream& is
116             ),
117             (mesh, fields, faceFlux, is)
118         );
121     // Constructors
123         //- Construct for interpolating given field
124         multivariateSurfaceInterpolationScheme
125         (
126             const fvMesh& mesh,
127             const fieldTable& fields,
128             const surfaceScalarField& faceFlux,
129             Istream& schemeData
130         );
133     // Selectors
135         //- Return a pointer to a new gradScheme created on freestore
136         static tmp<multivariateSurfaceInterpolationScheme<Type> > New
137         (
138             const fvMesh& mesh,
139             const fieldTable& fields,
140             const surfaceScalarField& faceFlux,
141             Istream& schemeData
142         );
145     //- Destructor
146     virtual ~multivariateSurfaceInterpolationScheme();
149     // Member Functions
151         //- Return mesh reference
152         const fvMesh& mesh() const
153         {
154             return mesh_;
155         }
157         //- Return fields to be interpolated
158         const fieldTable& fields() const
159         {
160             return fields_;
161         }
164     // Member Operators
166         //- surfaceInterpolationScheme sub-class returned by operator(field)
167         //  which is used as the interpolation scheme for the field
168         class fieldScheme
169         :
170             public surfaceInterpolationScheme<Type>
171         {
173         public:
175             // Constructors
177                 fieldScheme
178                 (
179                     const GeometricField<Type, fvPatchField, volMesh>& field
180                 )
181                 :
182                     surfaceInterpolationScheme<Type>(field.mesh())
183                 {}
186             // Member Functions
188                 //- Return the interpolation weighting factors
189                 virtual tmp<surfaceScalarField> weights
190                 (
191                     const GeometricField<Type, fvPatchField, volMesh>& field
192                 ) const = 0;
193         };
195         virtual tmp<surfaceInterpolationScheme<Type> > operator()
196         (
197             const GeometricField<Type, fvPatchField, volMesh>& field
198         ) const = 0;
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 } // End namespace Foam
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 // Add the patch constructor functions to the hash tables
210 #define makeMultivariateSurfaceInterpolationTypeScheme(SS, Type)               \
211                                                                                \
212 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0);                              \
213                                                                                \
214 multivariateSurfaceInterpolationScheme<Type>::                                 \
215 addIstreamConstructorToTable<SS<Type> >                                        \
216     add##SS##Type##ConstructorToTable_;
219 #define makeMultivariateSurfaceInterpolationScheme(SS)                         \
220                                                                                \
221 makeMultivariateSurfaceInterpolationTypeScheme(SS, scalar)                     \
222 makeMultivariateSurfaceInterpolationTypeScheme(SS, vector)                     \
223 makeMultivariateSurfaceInterpolationTypeScheme(SS, sphericalTensor)            \
224 makeMultivariateSurfaceInterpolationTypeScheme(SS, symmTensor)                 \
225 makeMultivariateSurfaceInterpolationTypeScheme(SS, tensor)
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 #ifdef NoRepository
231 #   include "multivariateSurfaceInterpolationScheme.C"
232 #endif
234 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 #endif
238 // ************************************************************************* //