FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::interpolation
00026 
00027 Description
00028     Abstract base class for interpolation
00029 
00030 \*---------------------------------------------------------------------------*/
00031 
00032 #ifndef interpolation_H
00033 #define interpolation_H
00034 
00035 #include <OpenFOAM/faceList.H>
00036 #include <finiteVolume/volFieldsFwd.H>
00037 #include <OpenFOAM/pointFields.H>
00038 #include <OpenFOAM/typeInfo.H>
00039 #include <OpenFOAM/autoPtr.H>
00040 #include <OpenFOAM/runTimeSelectionTables.H>
00041 
00042 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00043 
00044 namespace Foam
00045 {
00046 
00047 class polyMesh;
00048 
00049 /*---------------------------------------------------------------------------*\
00050                            Class interpolation Declaration
00051 \*---------------------------------------------------------------------------*/
00052 
00053 template<class Type>
00054 class interpolation
00055 {
00056 
00057 protected:
00058 
00059     // Protected data
00060 
00061         const GeometricField<Type, fvPatchField, volMesh>& psi_;
00062 
00063         const polyMesh& pMesh_;
00064         const vectorField& pMeshPoints_;
00065         const faceList& pMeshFaces_;
00066         const vectorField& pMeshFaceCentres_;
00067         const vectorField& pMeshFaceAreas_;
00068 
00069 
00070 public:
00071 
00072     //- Runtime type information
00073     virtual const word& type() const = 0;
00074 
00075 
00076     // Declare run-time constructor selection table
00077 
00078         declareRunTimeSelectionTable
00079         (
00080             autoPtr,
00081             interpolation,
00082             dictionary,
00083             (
00084                 const GeometricField<Type, fvPatchField, volMesh>& psi
00085             ),
00086             (psi)
00087         );
00088 
00089 
00090     // Selectors
00091 
00092         //- Return a reference to the specified interpolation scheme
00093         static autoPtr<interpolation<Type> > New
00094         (
00095             const word& interpolationType,
00096             const GeometricField<Type, fvPatchField, volMesh>& psi
00097         );
00098 
00099         //- Return a reference to the selected interpolation scheme
00100         static autoPtr<interpolation<Type> > New
00101         (
00102             const dictionary& interpolationSchemes,
00103             const GeometricField<Type, fvPatchField, volMesh>& psi
00104         );
00105 
00106 
00107     // Constructors
00108 
00109         //- Construct from components
00110         interpolation
00111         (
00112             const GeometricField<Type, fvPatchField, volMesh>& psi
00113         );
00114 
00115 
00116     // Destructor
00117 
00118         virtual ~interpolation()
00119         {}
00120 
00121 
00122     // Member Functions
00123 
00124         //- Return the field to be interpolated
00125         const GeometricField<Type, fvPatchField, volMesh>& psi() const
00126         {
00127             return psi_;
00128         }
00129 
00130         //- Interpolate field to the given point in the given cell
00131         virtual Type interpolate
00132         (
00133             const vector& position,
00134             const label nCell,
00135             const label facei = -1
00136         ) const = 0;
00137 };
00138 
00139 
00140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00141 
00142 } // End namespace Foam
00143 
00144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00145 
00146 #define makeInterpolationType(SS, Type)                                        \
00147                                                                                \
00148 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0);                              \
00149                                                                                \
00150 interpolation<Type>::adddictionaryConstructorToTable<SS<Type> >                \
00151     add##SS##Type##ConstructorToTable_;
00152 
00153 
00154 #define makeInterpolation(SS)                                                  \
00155                                                                                \
00156 makeInterpolationType(SS, scalar)                                              \
00157 makeInterpolationType(SS, vector)                                              \
00158 makeInterpolationType(SS, sphericalTensor)                                     \
00159 makeInterpolationType(SS, symmTensor)                                          \
00160 makeInterpolationType(SS, tensor)
00161 
00162 
00163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00164 
00165 #ifdef NoRepository
00166 #   include <finiteVolume/interpolation.C>
00167 #endif
00168 
00169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00170 
00171 #endif
00172 
00173 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines