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

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