initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / finiteVolume / interpolation / interpolation / interpolation / interpolation.H
blob3e3a4dc46aaa4027507e8b2608e0e660f14f5d34
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
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::interpolation
28 Description
29     Abstract base class for interpolation
31 \*---------------------------------------------------------------------------*/
33 #ifndef interpolation_H
34 #define interpolation_H
36 #include "faceList.H"
37 #include "volFieldsFwd.H"
38 #include "pointFields.H"
39 #include "typeInfo.H"
40 #include "autoPtr.H"
41 #include "runTimeSelectionTables.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 namespace Foam
48 class polyMesh;
50 /*---------------------------------------------------------------------------*\
51                            Class interpolation Declaration
52 \*---------------------------------------------------------------------------*/
54 template<class Type>
55 class interpolation
58 protected:
60     // Protected data
62         const GeometricField<Type, fvPatchField, volMesh>& psi_;
64         const polyMesh& pMesh_;
65         const vectorField& pMeshPoints_;
66         const faceList& pMeshFaces_;
67         const vectorField& pMeshFaceCentres_;
68         const vectorField& pMeshFaceAreas_;
71 public:
73     //- Runtime type information
74     virtual const word& type() const = 0;
77     // Declare run-time constructor selection table
79         declareRunTimeSelectionTable
80         (
81             autoPtr,
82             interpolation,
83             dictionary,
84             (
85                 const GeometricField<Type, fvPatchField, volMesh>& psi
86             ),
87             (psi)
88         );
91     // Selectors
93         //- Return a reference to the specified interpolation scheme
94         static autoPtr<interpolation<Type> > New
95         (
96             const word& interpolationType,
97             const GeometricField<Type, fvPatchField, volMesh>& psi
98         );
100         //- Return a reference to the selected interpolation scheme
101         static autoPtr<interpolation<Type> > New
102         (
103             const dictionary& interpolationSchemes,
104             const GeometricField<Type, fvPatchField, volMesh>& psi
105         );
108     // Constructors
110         //- Construct from components
111         interpolation
112         (
113             const GeometricField<Type, fvPatchField, volMesh>& psi
114         );
117     // Destructor
119         virtual ~interpolation()
120         {}
123     // Member Functions
125         //- Return the field to be interpolated
126         const GeometricField<Type, fvPatchField, volMesh>& psi() const
127         {
128             return psi_;
129         }
131         //- Interpolate field to the given point in the given cell
132         virtual Type interpolate
133         (
134             const vector& position,
135             const label nCell,
136             const label facei = -1
137         ) const = 0;
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 } // End namespace Foam
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 #define makeInterpolationType(SS, Type)                                        \
148                                                                                \
149 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0);                              \
150                                                                                \
151 interpolation<Type>::adddictionaryConstructorToTable<SS<Type> >                \
152     add##SS##Type##ConstructorToTable_;
155 #define makeInterpolation(SS)                                                  \
156                                                                                \
157 makeInterpolationType(SS, scalar)                                              \
158 makeInterpolationType(SS, vector)                                              \
159 makeInterpolationType(SS, sphericalTensor)                                     \
160 makeInterpolationType(SS, symmTensor)                                          \
161 makeInterpolationType(SS, tensor)
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 #ifdef NoRepository
167 #   include "interpolation.C"
168 #endif
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 #endif
174 // ************************************************************************* //