OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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-2009 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     Foam::interpolation
00027 
00028 Description
00029     Abstract base class for interpolation
00030 
00031 \*---------------------------------------------------------------------------*/
00032 
00033 #ifndef interpolation_H
00034 #define interpolation_H
00035 
00036 #include "faceList.H"
00037 #include "volFieldsFwd.H"
00038 #include "pointFields.H"
00039 #include "typeInfo.H"
00040 #include "autoPtr.H"
00041 #include "runTimeSelectionTables.H"
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 class polyMesh;
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 GeometricField<Type, fvPatchField, volMesh>& psi
00086             ),
00087             (psi)
00088         );
00089 
00090 
00091     // Selectors
00092 
00093         //- Return a reference to the specified interpolation scheme
00094         static autoPtr<interpolation<Type> > New
00095         (
00096             const word& interpolationType,
00097             const GeometricField<Type, fvPatchField, volMesh>& psi
00098         );
00099 
00100         //- Return a reference to the selected interpolation scheme
00101         static autoPtr<interpolation<Type> > New
00102         (
00103             const dictionary& interpolationSchemes,
00104             const GeometricField<Type, fvPatchField, volMesh>& psi
00105         );
00106 
00107 
00108     // Constructors
00109 
00110         //- Construct from components
00111         interpolation
00112         (
00113             const GeometricField<Type, fvPatchField, volMesh>& psi
00114         );
00115 
00116 
00117     // Destructor
00118 
00119         virtual ~interpolation()
00120         {}
00121 
00122 
00123     // Member Functions
00124 
00125         //- Return the field to be interpolated
00126         const GeometricField<Type, fvPatchField, volMesh>& psi() const
00127         {
00128             return psi_;
00129         }
00130 
00131         //- Interpolate field to the given point in the given cell
00132         virtual Type interpolate
00133         (
00134             const vector& position,
00135             const label nCell,
00136             const label facei = -1
00137         ) const = 0;
00138 };
00139 
00140 
00141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00142 
00143 } // End namespace Foam
00144 
00145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00146 
00147 #define makeInterpolationType(SS, Type)                                        \
00148                                                                                \
00149 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0);                              \
00150                                                                                \
00151 interpolation<Type>::adddictionaryConstructorToTable<SS<Type> >                \
00152     add##SS##Type##ConstructorToTable_;
00153 
00154 
00155 #define makeInterpolation(SS)                                                  \
00156                                                                                \
00157 makeInterpolationType(SS, scalar)                                              \
00158 makeInterpolationType(SS, vector)                                              \
00159 makeInterpolationType(SS, sphericalTensor)                                     \
00160 makeInterpolationType(SS, symmTensor)                                          \
00161 makeInterpolationType(SS, tensor)
00162 
00163 
00164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00165 
00166 #ifdef NoRepository
00167 #   include "interpolation.C"
00168 #endif
00169 
00170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00171 
00172 #endif
00173 
00174 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd