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

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