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

PostProcessingModel.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) 2008-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::PostProcessingModel
00026 
00027 Description
00028     Templated post-processing model class
00029 
00030 SourceFiles
00031     PostProcessingModel.C
00032     NewPostProcessingModel.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef PostProcessingModel_H
00037 #define PostProcessingModel_H
00038 
00039 #include <OpenFOAM/IOdictionary.H>
00040 #include <OpenFOAM/autoPtr.H>
00041 #include <OpenFOAM/runTimeSelectionTables.H>
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 /*---------------------------------------------------------------------------*\
00049                     Class PostProcessingModel Declaration
00050 \*---------------------------------------------------------------------------*/
00051 
00052 template<class CloudType>
00053 class PostProcessingModel
00054 {
00055     // Private data
00056 
00057         //- The cloud dictionary
00058         const dictionary& dict_;
00059 
00060         //- Reference to the owner cloud class
00061         CloudType& owner_;
00062 
00063         //- The coefficients dictionary
00064         const dictionary coeffDict_;
00065 
00066 
00067 protected:
00068 
00069     // Protected member functions
00070 
00071         //- Write post-processing info
00072         virtual void write() = 0;
00073 
00074 
00075 public:
00076 
00077     //- Runtime type information
00078     TypeName("PostProcessingModel");
00079 
00080     //- Declare runtime constructor selection table
00081     declareRunTimeSelectionTable
00082     (
00083         autoPtr,
00084         PostProcessingModel,
00085         dictionary,
00086         (
00087             const dictionary& dict,
00088             CloudType& owner
00089         ),
00090         (dict, owner)
00091     );
00092 
00093 
00094     // Constructors
00095 
00096         //- Construct null from owner
00097         PostProcessingModel(CloudType& owner);
00098 
00099         //- Construct from dictionary
00100         PostProcessingModel
00101         (
00102             const dictionary& dict,
00103             CloudType& owner,
00104             const word& type
00105         );
00106 
00107 
00108     //- Destructor
00109     virtual ~PostProcessingModel();
00110 
00111 
00112     //- Selector
00113     static autoPtr<PostProcessingModel<CloudType> > New
00114     (
00115         const dictionary& dict,
00116         CloudType& owner
00117     );
00118 
00119 
00120     // Member Functions
00121 
00122         // Access
00123 
00124             //- Return the owner cloud dictionary
00125             inline const dictionary& dict() const;
00126 
00127             //- Return const access the owner cloud object
00128             inline const CloudType& owner() const;
00129 
00130             //- Return non-const access the owner cloud object for manipulation
00131             inline CloudType& owner();
00132 
00133             //- Return the coefficients dictionary
00134             inline const dictionary& coeffDict() const;
00135 
00136 
00137         // Evaluation
00138 
00139             //- Main post-processing function
00140             virtual void post();
00141 
00142             //- Flag to indicate whether model activates post-processing model
00143             virtual bool active() const = 0;
00144 
00145             //- Gather post-processing info on patch
00146             virtual void postPatch
00147             (
00148                 const typename CloudType::parcelType& p,
00149                 const label patchI
00150             ) = 0;
00151 };
00152 
00153 
00154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00155 
00156 } // End namespace Foam
00157 
00158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00159 
00160 #define makePostProcessingModel(CloudType)                                    \
00161                                                                               \
00162     defineNamedTemplateTypeNameAndDebug(PostProcessingModel<CloudType>, 0);   \
00163                                                                               \
00164     defineTemplateRunTimeSelectionTable                                       \
00165     (                                                                         \
00166         PostProcessingModel<CloudType>,                                       \
00167         dictionary                                                            \
00168     );
00169 
00170 
00171 #define makePostProcessingModelType(SS, CloudType, ParcelType)                \
00172                                                                               \
00173     defineNamedTemplateTypeNameAndDebug(SS<CloudType<ParcelType> >, 0);       \
00174                                                                               \
00175     PostProcessingModel<CloudType<ParcelType> >::                             \
00176         adddictionaryConstructorToTable<SS<CloudType<ParcelType> > >          \
00177             add##SS##CloudType##ParcelType##ConstructorToTable_;
00178 
00179 
00180 #define makePostProcessingModelThermoType(SS, CloudType, ParcelType, ThermoType)\
00181                                                                               \
00182     defineNamedTemplateTypeNameAndDebug                                       \
00183     (                                                                         \
00184         SS<CloudType<ParcelType<ThermoType> > >,                              \
00185         0                                                                     \
00186     );                                                                        \
00187                                                                               \
00188     PostProcessingModel<CloudType<ParcelType<ThermoType> > >::                \
00189         adddictionaryConstructorToTable                                       \
00190             <SS<CloudType<ParcelType<ThermoType> > > >                        \
00191             add##SS##CloudType##ParcelType##ThermoType##ConstructorToTable_;
00192 
00193 
00194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00195 
00196 #include "PostProcessingModelI.H"
00197 
00198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00199 
00200 #ifdef NoRepository
00201 #   include "PostProcessingModel.C"
00202 #endif
00203 
00204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00205 
00206 #endif
00207 
00208 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines