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

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