OpenFOAM logo
Open Source CFD Toolkit

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