OpenFOAM logo
Open Source CFD Toolkit

divScheme.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     divScheme
00027 
00028 Description
00029     Abstract base class for div schemes.
00030 
00031 SourceFiles
00032     divScheme.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef divScheme_H
00037 #define divScheme_H
00038 
00039 #include "tmp.H"
00040 #include "volFieldsFwd.H"
00041 #include "surfaceFieldsFwd.H"
00042 #include "linear.H"
00043 #include "typeInfo.H"
00044 #include "runTimeSelectionTables.H"
00045 
00046 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00047 
00048 namespace Foam
00049 {
00050 
00051 template<class Type>
00052 class fvMatrix;
00053 
00054 class fvMesh;
00055 
00056 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00057 
00058 namespace fv
00059 {
00060 
00061 /*---------------------------------------------------------------------------*\
00062                            Class divScheme Declaration
00063 \*---------------------------------------------------------------------------*/
00064 
00065 template<class Type>
00066 class divScheme
00067 :
00068     public refCount
00069 {
00070 
00071 protected:
00072 
00073     // Protected data
00074 
00075         const fvMesh& mesh_;
00076         tmp<surfaceInterpolationScheme<Type> > tinterpScheme_;
00077 
00078 
00079     // Private Member Functions
00080 
00081         //- Disallow copy construct
00082         divScheme(const divScheme&);
00083 
00084         //- Disallow default bitwise assignment
00085         void operator=(const divScheme&);
00086 
00087 
00088 public:
00089 
00090     //- Runtime type information
00091     virtual const word& type() const = 0;
00092 
00093 
00094     // Declare run-time constructor selection tables
00095 
00096         declareRunTimeSelectionTable
00097         (
00098             tmp,
00099             divScheme,
00100             Istream,
00101             (const fvMesh& mesh, Istream& schemeData),
00102             (mesh, schemeData)
00103         );
00104 
00105 
00106     // Constructors
00107 
00108         //- Construct from mesh
00109         divScheme(const fvMesh& mesh)
00110         :
00111             mesh_(mesh),
00112             tinterpScheme_(new linear<Type>(mesh))
00113         {}
00114 
00115         //- Construct from mesh and Istream
00116         divScheme(const fvMesh& mesh, Istream& is)
00117         :
00118             mesh_(mesh),
00119             tinterpScheme_(surfaceInterpolationScheme<Type>::New(mesh, is))
00120         {}
00121 
00122 
00123     // Selectors
00124 
00125         //- Return a pointer to a new divScheme created on freestore
00126         static tmp<divScheme<Type> > New
00127         (
00128             const fvMesh& mesh,
00129             Istream& schemeData
00130         );
00131 
00132 
00133     // Destructor
00134 
00135         virtual ~divScheme();
00136 
00137 
00138     // Member Functions
00139 
00140         //- Return mesh reference
00141         const fvMesh& mesh() const
00142         {
00143             return mesh_;
00144         }
00145 
00146         virtual tmp
00147         <
00148             GeometricField
00149             <typename innerProduct<vector, Type>::type, fvPatchField, volMesh>
00150         > fvcDiv
00151         (
00152             const GeometricField<Type, fvPatchField, volMesh>&
00153         ) = 0;
00154 };
00155 
00156 
00157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00158 
00159 } // End namespace fv
00160 
00161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00162 
00163 } // End namespace Foam
00164 
00165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00166 
00167 // Add the patch constructor functions to the hash tables
00168 
00169 #define makeFvDivTypeScheme(SS, Type)                                          \
00170                                                                                \
00171 defineNamedTemplateTypeNameAndDebug(SS<Type>, 0);                              \
00172                                                                                \
00173 divScheme<Type>::addIstreamConstructorToTable<SS<Type> >                       \
00174     add##SS##Type##IstreamConstructorToTable_;
00175 
00176 
00177 #define makeFvDivScheme(SS)                                                    \
00178                                                                                \
00179 makeFvDivTypeScheme(SS, vector)                                                \
00180 makeFvDivTypeScheme(SS, tensor)                                                \
00181 makeFvDivTypeScheme(SS, sphericalTensor)
00182 
00183 
00184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00185 
00186 #ifdef NoRepository
00187 #   include "divScheme.C"
00188 #endif
00189 
00190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00191 
00192 #endif
00193 
00194 // ************************************************************************* //
For further information go to www.openfoam.org