OpenFOAM logo
Open Source CFD Toolkit

interpolation.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2005 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     interpolation
00027 
00028 Description
00029 
00030 \*---------------------------------------------------------------------------*/
00031 
00032 #ifndef interpolation_H
00033 #define interpolation_H
00034 
00035 #include "faceList.H"
00036 #include "volFieldsFwd.H"
00037 #include "pointFields.H"
00038 #include "typeInfo.H"
00039 #include "autoPtr.H"
00040 #include "runTimeSelectionTables.H"
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 namespace Foam
00045 {
00046 
00047 class polyMesh;
00048 class volPointInterpolation;
00049 
00050 /*---------------------------------------------------------------------------*\
00051                            Class interpolation Declaration
00052 \*---------------------------------------------------------------------------*/
00053 
00054 template<class Type>
00055 class interpolation
00056 {
00057 
00058 protected:
00059 
00060     // Protected data
00061 
00062         const GeometricField<Type, fvPatchField, volMesh>& psi_;
00063 
00064         const polyMesh& pMesh_;
00065         const vectorField& pMeshPoints_;
00066         const faceList& pMeshFaces_;
00067         const vectorField& pMeshFaceCentres_;
00068         const vectorField& pMeshFaceAreas_;
00069 
00070 
00071 public:
00072 
00073     //- Runtime type information
00074     virtual const word& type() const = 0;
00075 
00076 
00077     // Declare run-time constructor selection table
00078 
00079         declareRunTimeSelectionTable
00080         (
00081             autoPtr,
00082             interpolation,
00083             dictionary,
00084             (
00085                 const volPointInterpolation& pInterp,
00086                 const GeometricField<Type, fvPatchField, volMesh>& psi
00087             ),
00088             (pInterp, psi)
00089         );
00090 
00091 
00092     // Selectors
00093 
00094         //- Return a reference to the selected interpolation scheme
00095         static autoPtr<interpolation<Type> > New
00096         (
00097             const dictionary& interpolationSchemes,
00098             const volPointInterpolation& pInterp,
00099             const GeometricField<Type, fvPatchField, volMesh>& psi
00100         );
00101 
00102 
00103     // Constructors
00104 
00105         //- Construct from components
00106         interpolation
00107         (
00108             const GeometricField<Type, fvPatchField, volMesh>& psi
00109         );
00110 
00111 
00112     // Destructor
00113 
00114         virtual ~interpolation()
00115         {}
00116 
00117 
00118     // Member Functions
00119 
00120         //- Interpolate field to the given point in the given cell
00121         virtual Type interpolate
00122         (
00123             const vector& position,
00124             const label nCell,
00125             const label facei = -1
00126         ) const = 0;
00127 };
00128 
00129 
00130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00131 
00132 } // End namespace Foam
00133 
00134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00135 
00136 #define makeInterpolationType(SS, Type)                                        \
00137                                                                                \
00138 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0);                              \
00139                                                                                \
00140 interpolation<Type>::adddictionaryConstructorToTable<SS<Type> >                \
00141     add##SS##Type##ConstructorToTable_;
00142 
00143 
00144 #define makeInterpolation(SS)                                                  \
00145                                                                                \
00146 makeInterpolationType(SS, scalar)                                              \
00147 makeInterpolationType(SS, vector)                                              \
00148 makeInterpolationType(SS, tensor)
00149 
00150 
00151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00152 
00153 #ifdef NoRepository
00154 #   include "interpolation.C"
00155 #endif
00156 
00157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00158 
00159 #endif
00160 
00161 // ************************************************************************* //
For further information go to www.openfoam.org