OpenFOAM logo
Open Source CFD Toolkit

edgeInterpolationScheme.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     edgeInterpolationScheme
00027 
00028 Description
00029     Abstract base class for edge interpolation schemes.
00030 
00031 SourceFiles
00032     edgeInterpolationScheme.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef edgeInterpolationScheme_H
00037 #define edgeInterpolationScheme_H
00038 
00039 #include "tmp.H"
00040 #include "areaFieldsFwd.H"
00041 #include "edgeFieldsFwd.H"
00042 #include "typeInfo.H"
00043 #include "runTimeSelectionTables.H"
00044 
00045 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00046 
00047 namespace Foam
00048 {
00049 
00050 class faMesh;
00051 
00052 /*---------------------------------------------------------------------------*\
00053                  Class edgeInterpolationScheme Declaration
00054 \*---------------------------------------------------------------------------*/
00055 
00056 template<class Type>
00057 class edgeInterpolationScheme
00058 :
00059     public refCount
00060 {
00061     // Private data
00062 
00063         //- Hold reference to mesh
00064         const faMesh& mesh_;
00065 
00066 
00067     // Private Member Functions
00068 
00069         //- Disallow default bitwise assignment
00070         void operator=(const edgeInterpolationScheme&);
00071 
00072 
00073 public:
00074 
00075     // Declare run-time constructor selection tables
00076 
00077         declareRunTimeSelectionTable
00078         (
00079             tmp,
00080             edgeInterpolationScheme,
00081             Mesh,
00082             (
00083                 const faMesh& mesh,
00084                 Istream& schemeData
00085             ),
00086             (mesh, schemeData)
00087         );
00088 
00089         declareRunTimeSelectionTable
00090         (
00091             tmp,
00092             edgeInterpolationScheme,
00093             MeshFlux,
00094             (
00095                 const faMesh& mesh,
00096                 const edgeScalarField& faceFlux,
00097                 Istream& schemeData
00098             ),
00099             (mesh, faceFlux, schemeData)
00100         );
00101 
00102 
00103     // Constructors
00104 
00105         //- Construct from mesh
00106         edgeInterpolationScheme(const faMesh& mesh)
00107         :
00108             mesh_(mesh)
00109         {}
00110 
00111 
00112     // Selectors
00113 
00114         //- Return new tmp interpolation scheme
00115         static tmp<edgeInterpolationScheme<Type> > New
00116         (
00117             const faMesh& mesh,
00118             Istream& schemeData
00119         );
00120 
00121         //- Return new tmp interpolation scheme
00122         static tmp<edgeInterpolationScheme<Type> > New
00123         (
00124             const faMesh& mesh,
00125             const edgeScalarField& faceFlux,
00126             Istream& schemeData
00127         );
00128 
00129 
00130     // Destructor
00131 
00132         virtual ~edgeInterpolationScheme();
00133 
00134 
00135     // Member Functions
00136 
00137         //- Return mesh reference
00138         const faMesh& mesh() const
00139         {
00140             return mesh_;
00141         }
00142 
00143 
00144         //- Return the face-interpolate of the given cell field
00145         //  with the given owner and neighbour weigting factors
00146         static tmp<GeometricField<Type, faPatchField, edgeMesh> >
00147         interpolate
00148         (
00149             const GeometricField<Type, faPatchField, areaMesh>&,
00150             const tmp<edgeScalarField>&,
00151             const tmp<edgeScalarField>&
00152         );
00153 
00154         //- Return the face-interpolate of the given cell field
00155         //  with the given weigting factors
00156         static tmp<GeometricField<Type, faPatchField, edgeMesh> >
00157         interpolate
00158         (
00159             const GeometricField<Type, faPatchField, areaMesh>&,
00160             const tmp<edgeScalarField>&
00161         );
00162 
00163 
00164         //- Return the interpolation weighting factors for the given field
00165         virtual tmp<edgeScalarField> weights
00166         (
00167             const GeometricField<Type, faPatchField, areaMesh>&
00168         ) const = 0;
00169 
00170         //- Return true if this scheme uses an explicit correction
00171         virtual bool corrected() const
00172         {
00173             return false;
00174         }
00175 
00176         //- Return the explicit correction to the face-interpolate
00177         //  for the given field
00178         virtual tmp<GeometricField<Type, faPatchField, edgeMesh> >
00179         correction(const GeometricField<Type, faPatchField, areaMesh>&) const
00180         {
00181             return tmp<GeometricField<Type, faPatchField, edgeMesh> >(NULL);
00182         }
00183 
00184         //- Return the face-interpolate of the given cell field
00185         //  with explicit correction
00186         virtual tmp<GeometricField<Type, faPatchField, edgeMesh> >
00187         interpolate(const GeometricField<Type, faPatchField, areaMesh>&) const;
00188 
00189         //- Return the face-interpolate of the given tmp cell field
00190         //  with explicit correction
00191         tmp<GeometricField<Type, faPatchField, edgeMesh> >
00192         interpolate
00193         (
00194             const tmp<GeometricField<Type, faPatchField, areaMesh> >&
00195         ) const;
00196 };
00197 
00198 
00199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00200 
00201 } // End namespace Foam
00202 
00203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00204 
00205 // Add the patch constructor functions to the hash tables
00206 
00207 #define makeEdgeInterpolationTypeScheme(SS, Type)                              \
00208                                                                                \
00209 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0);                              \
00210                                                                                \
00211 edgeInterpolationScheme<Type>::addMeshConstructorToTable<SS<Type> >            \
00212     add##SS##Type##MeshConstructorToTable_;                                    \
00213                                                                                \
00214 edgeInterpolationScheme<Type>::addMeshFluxConstructorToTable<SS<Type> >        \
00215     add##SS##Type##MeshFluxConstructorToTable_;
00216 
00217 #define makeEdgeInterpolationScheme(SS)                                        \
00218                                                                                \
00219 makeEdgeInterpolationTypeScheme(SS, scalar)                                    \
00220 makeEdgeInterpolationTypeScheme(SS, vector)                                    \
00221 makeEdgeInterpolationTypeScheme(SS, tensor)
00222 
00223 
00224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00225 
00226 #ifdef NoRepository
00227 #   include "edgeInterpolationScheme.C"
00228 #endif
00229 
00230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00231 
00232 #endif
00233 
00234 // ************************************************************************* //
For further information go to www.openfoam.org