CloudFunctionObject.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
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::CloudFunctionObject
26 
27 Description
28  Templated cloud function object base class
29 
30 SourceFiles
31  CloudFunctionObject.C
32  CloudFunctionObjectNew.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef CloudFunctionObject_H
37 #define CloudFunctionObject_H
38 
39 #include "IOdictionary.H"
40 #include "autoPtr.H"
41 #include "runTimeSelectionTables.H"
42 #include "CloudSubModelBase.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 class polyPatch;
50 class tetIndices;
51 
52 /*---------------------------------------------------------------------------*\
53  Class CloudFunctionObject Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 template<class CloudType>
58 :
59  public CloudSubModelBase<CloudType>
60 {
61  // Private Data
62 
63  //- Output path
64  fileName outputDir_;
65 
66 
67  // Private Member Functions
68 
69  //- Inherite write from CloudSubModelBase
71 
72  //- Write post-processing info
73  virtual void write();
74 
75 
76 public:
77 
78  //- Runtime type information
79  TypeName("cloudFunctionObject");
80 
81  //- Declare runtime constructor selection table
83  (
84  autoPtr,
86  dictionary,
87  (
88  const dictionary& dict,
90  const word& modelName
91  ),
92  (dict, owner, modelName)
93  );
94 
95 
96  // Constructors
97 
98  //- Construct null from owner
100 
101  //- Construct from dictionary
103  (
104  const dictionary& dict,
105  CloudType& owner,
106  const word& objectType,
107  const word& modelName
108  );
109 
110  //- Construct copy
112 
113  //- Construct and return a clone
115  {
117  (
119  );
120  }
121 
122 
123  //- Destructor
124  virtual ~CloudFunctionObject();
125 
126 
127  //- Selector
129  (
130  const dictionary& dict,
131  CloudType& owner,
132  const word& objectType,
133  const word& modelName
134  );
135 
136 
137  // Member Functions
138 
139  // Evaluation
140 
141  //- Pre-evolve hook
142  virtual void preEvolve();
143 
144  //- Post-evolve hook
145  virtual void postEvolve();
146 
147  //- Post-move hook
148  virtual void postMove
149  (
150  typename CloudType::parcelType& p,
151  const scalar dt,
152  const point& position0,
153  bool& keepParticle
154  );
155 
156  //- Post-patch hook
157  virtual void postPatch
158  (
159  const typename CloudType::parcelType& p,
160  const polyPatch& pp,
161  bool& keepParticle
162  );
163 
164  //- Post-face hook
165  virtual void postFace
166  (
167  const typename CloudType::parcelType& p,
168  bool& keepParticle
169  );
170 
171 
172  // Input/output
173 
174  //- Return the output path
175  const fileName& outputDir() const;
176 
177  //- Return the output time path
178  fileName writeTimeDir() const;
179 };
180 
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 } // End namespace Foam
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 #define makeCloudFunctionObject(CloudType) \
189  \
190  typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
191  defineNamedTemplateTypeNameAndDebug \
192  ( \
193  Foam::CloudFunctionObject<kinematicCloudType>, \
194  0 \
195  ); \
196  namespace Foam \
197  { \
198  defineTemplateRunTimeSelectionTable \
199  ( \
200  CloudFunctionObject<kinematicCloudType>, \
201  dictionary \
202  ); \
203  }
204 
206 #define makeCloudFunctionObjectType(SS, CloudType) \
207  \
208  typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
209  defineNamedTemplateTypeNameAndDebug(Foam::SS<kinematicCloudType>, 0); \
210  \
211  Foam::CloudFunctionObject<kinematicCloudType>:: \
212  adddictionaryConstructorToTable<Foam::SS<kinematicCloudType>> \
213  add##SS##CloudType##kinematicCloudType##ConstructorToTable_;
214 
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 #ifdef NoRepository
219  #include "CloudFunctionObject.C"
220 #endif
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 #endif
225 
226 // ************************************************************************* //
A class for handling file names.
Definition: fileName.H:79
virtual void postMove(typename CloudType::parcelType &p, const scalar dt, const point &position0, bool &keepParticle)
Post-move hook.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
static autoPtr< CloudFunctionObject< CloudType > > New(const dictionary &dict, CloudType &owner, const word &objectType, const word &modelName)
Selector.
Base class for cloud sub-models.
virtual void preEvolve()
Pre-evolve hook.
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:104
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
const CloudType & owner() const
Return const access to the owner cloud.
TypeName("cloudFunctionObject")
Runtime type information.
fileName writeTimeDir() const
Return the output time path.
A class for handling words, derived from string.
Definition: word.H:59
virtual void postEvolve()
Post-evolve hook.
virtual void postPatch(const typename CloudType::parcelType &p, const polyPatch &pp, bool &keepParticle)
Post-patch hook.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:215
virtual void postFace(const typename CloudType::parcelType &p, bool &keepParticle)
Post-face hook.
const fileName & outputDir() const
Return the output path.
declareRunTimeSelectionTable(autoPtr, CloudFunctionObject, dictionary,(const dictionary &dict, CloudType &owner, const word &modelName),(dict, owner, modelName))
Declare runtime constructor selection table.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Macros to ease declaration of run-time selection tables.
volScalarField & p
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
CloudFunctionObject(CloudType &owner)
Construct null from owner.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:69
Templated cloud function object base class.
virtual autoPtr< CloudFunctionObject< CloudType > > clone() const
Construct and return a clone.
Namespace for OpenFOAM.
virtual ~CloudFunctionObject()
Destructor.