OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

IntegrationScheme.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-2009 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 
00026 Class
00027     Foam::IntegrationScheme
00028 
00029 Description
00030     Top level model for Integration schemes
00031 
00032 SourceFiles
00033     IntegrationScheme.C
00034 
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef IntegrationScheme_H
00038 #define IntegrationScheme_H
00039 
00040 #include "autoPtr.H"
00041 #include "runTimeSelectionTables.H"
00042 #include "dictionary.H"
00043 
00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00045 
00046 namespace Foam
00047 {
00048 
00049 /*---------------------------------------------------------------------------*\
00050                      Class IntegrationScheme Declaration
00051 \*---------------------------------------------------------------------------*/
00052 
00053 template<class Type>
00054 class IntegrationScheme
00055 {
00056 
00057 public:
00058 
00059     //- Helper class to supply results of integration
00060     class integrationResult
00061     {
00062         //- Integration value
00063         Type value_;
00064 
00065         //- Average value across integration step
00066         Type average_;
00067 
00068 
00069     public:
00070 
00071         //- Constructor
00072         integrationResult()
00073         :
00074             value_(pTraits<Type>::zero),
00075             average_(pTraits<Type>::zero)
00076         {}
00077 
00078 
00079         // Member functions
00080 
00081             // Access
00082 
00083                 //- Return const access to the value
00084                 Type value() const
00085                 {
00086                     return value_;
00087                 }
00088 
00089                 //- Return const access to the average
00090                 Type average() const
00091                 {
00092                     return average_;
00093                 }
00094 
00095 
00096             // Edit
00097 
00098                 //- Return access to the value for changing
00099                 Type& value()
00100                 {
00101                     return value_;
00102                 }
00103 
00104                 //- Return access to the average for changing
00105                 Type& average()
00106                 {
00107                     return average_;
00108                 }
00109         };
00110 
00111 
00112 private:
00113 
00114     // Private data
00115 
00116         //- Name of the Integration variable
00117         const word& phiName_;
00118 
00119         //- Reference to the dictionary
00120         const dictionary& dict_;
00121 
00122 
00123     // Private Member Functions
00124 
00125         //- Disallow default bitwise copy construct
00126         IntegrationScheme(const IntegrationScheme&);
00127 
00128         //- Disallow default bitwise assignment
00129         void operator=(const IntegrationScheme&);
00130 
00131 
00132 public:
00133 
00134     //- Runtime type information
00135     TypeName("IntegrationScheme");
00136 
00137 
00138     //- Declare runtime constructor selection table
00139 
00140          declareRunTimeSelectionTable
00141          (
00142              autoPtr,
00143              IntegrationScheme,
00144              dictionary,
00145              (
00146                  const word& phiName,
00147                  const dictionary& dict
00148              ),
00149              (phiName, dict)
00150          );
00151 
00152 
00153     // Constructors
00154 
00155         //- Construct from components
00156         IntegrationScheme(const word& phiName, const dictionary& dict);
00157 
00158 
00159     // Selectors
00160 
00161         //- Return a reference to the selected radiation model
00162         static autoPtr<IntegrationScheme> New
00163         (
00164             const word& phiName,
00165             const dictionary& dict
00166         );
00167 
00168 
00169     //- Destructor
00170     virtual ~IntegrationScheme();
00171 
00172 
00173     // Member Functions
00174 
00175         //- Perform the Integration
00176         virtual integrationResult integrate
00177         (
00178             const Type phi,
00179             const scalar dt,
00180             const Type alpha,
00181             const scalar beta
00182         ) const = 0;
00183 };
00184 
00185 
00186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00187 
00188 } // End namespace Foam
00189 
00190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00191 
00192 #define makeIntegrationScheme(Type)                                           \
00193                                                                               \
00194     defineNamedTemplateTypeNameAndDebug(IntegrationScheme<Type>, 0);          \
00195                                                                               \
00196     defineTemplateRunTimeSelectionTable                                       \
00197     (                                                                         \
00198         IntegrationScheme<Type>,                                               \
00199         dictionary                                                            \
00200     );
00201 
00202 
00203 #define makeIntegrationSchemeType(SS, Type)                                   \
00204                                                                               \
00205     defineNamedTemplateTypeNameAndDebug(SS<Type>, 0);                         \
00206                                                                               \
00207     IntegrationScheme<Type>::adddictionaryConstructorToTable<SS<Type> >       \
00208         add##SS##Type##ConstructorToTable_;
00209 
00210 
00211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00212 
00213 #ifdef NoRepository
00214 #   include "IntegrationScheme.C"
00215 #endif
00216 
00217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00218 
00219 #endif
00220 
00221 // ************************************************************************* //
00222 
Copyright © 2000-2009 OpenCFD Ltd