FreeFOAM The Cross-Platform CFD Toolkit
PostProcessingModel.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2008-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::PostProcessingModel
26 
27 Description
28  Templated post-processing model class
29 
30 SourceFiles
31  PostProcessingModel.C
32  NewPostProcessingModel.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef PostProcessingModel_H
37 #define PostProcessingModel_H
38 
39 #include <OpenFOAM/IOdictionary.H>
40 #include <OpenFOAM/autoPtr.H>
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class PostProcessingModel Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 template<class CloudType>
54 {
55  // Private data
56 
57  //- The cloud dictionary
58  const dictionary& dict_;
59 
60  //- Reference to the owner cloud class
61  CloudType& owner_;
62 
63  //- The coefficients dictionary
64  const dictionary coeffDict_;
65 
66 
67 protected:
68 
69  // Protected member functions
70 
71  //- Write post-processing info
72  virtual void write() = 0;
73 
74 
75 public:
76 
77  //- Runtime type information
78  TypeName("PostProcessingModel");
79 
80  //- Declare runtime constructor selection table
82  (
83  autoPtr,
85  dictionary,
86  (
87  const dictionary& dict,
88  CloudType& owner
89  ),
90  (dict, owner)
91  );
92 
93 
94  // Constructors
95 
96  //- Construct null from owner
97  PostProcessingModel(CloudType& owner);
98 
99  //- Construct from dictionary
101  (
102  const dictionary& dict,
103  CloudType& owner,
104  const word& type
105  );
106 
107 
108  //- Destructor
109  virtual ~PostProcessingModel();
110 
111 
112  //- Selector
114  (
115  const dictionary& dict,
116  CloudType& owner
117  );
118 
119 
120  // Member Functions
121 
122  // Access
123 
124  //- Return the owner cloud dictionary
125  inline const dictionary& dict() const;
126 
127  //- Return const access the owner cloud object
128  inline const CloudType& owner() const;
129 
130  //- Return non-const access the owner cloud object for manipulation
131  inline CloudType& owner();
132 
133  //- Return the coefficients dictionary
134  inline const dictionary& coeffDict() const;
135 
136 
137  // Evaluation
138 
139  //- Main post-processing function
140  virtual void post();
141 
142  //- Flag to indicate whether model activates post-processing model
143  virtual bool active() const = 0;
144 
145  //- Gather post-processing info on patch
146  virtual void postPatch
147  (
148  const typename CloudType::parcelType& p,
149  const label patchI
150  ) = 0;
151 };
152 
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 } // End namespace Foam
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 #define makePostProcessingModel(CloudType) \
161  \
162  defineNamedTemplateTypeNameAndDebug(PostProcessingModel<CloudType>, 0); \
163  \
164  defineTemplateRunTimeSelectionTable \
165  ( \
166  PostProcessingModel<CloudType>, \
167  dictionary \
168  );
169 
170 
171 #define makePostProcessingModelType(SS, CloudType, ParcelType) \
172  \
173  defineNamedTemplateTypeNameAndDebug(SS<CloudType<ParcelType> >, 0); \
174  \
175  PostProcessingModel<CloudType<ParcelType> >:: \
176  adddictionaryConstructorToTable<SS<CloudType<ParcelType> > > \
177  add##SS##CloudType##ParcelType##ConstructorToTable_;
178 
179 
180 #define makePostProcessingModelThermoType(SS, CloudType, ParcelType, ThermoType)\
181  \
182  defineNamedTemplateTypeNameAndDebug \
183  ( \
184  SS<CloudType<ParcelType<ThermoType> > >, \
185  0 \
186  ); \
187  \
188  PostProcessingModel<CloudType<ParcelType<ThermoType> > >:: \
189  adddictionaryConstructorToTable \
190  <SS<CloudType<ParcelType<ThermoType> > > > \
191  add##SS##CloudType##ParcelType##ThermoType##ConstructorToTable_;
192 
193 
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 
196 #include "PostProcessingModelI.H"
197 
198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
199 
200 #ifdef NoRepository
201 # include "PostProcessingModel.C"
202 #endif
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #endif
207 
208 // ************************ vim: set sw=4 sts=4 et: ************************ //