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-2022 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  //- Inherit 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  );
162 
163  //- Pre-face hook
164  virtual void preFace(const typename CloudType::parcelType& p);
165 
166  //- Post-face hook
167  virtual void postFace(const typename CloudType::parcelType& p);
168 
169 
170  // Input/output
171 
172  //- Return the output path
173  const fileName& outputDir() const;
174 
175  //- Return the output time path
176  fileName writeTimeDir() const;
177 };
178 
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 } // End namespace Foam
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 #define makeCloudFunctionObject(CloudType) \
187  \
188  typedef Foam::CloudType::momentumCloudType momentumCloudType; \
189  defineNamedTemplateTypeNameAndDebug \
190  ( \
191  Foam::CloudFunctionObject<momentumCloudType>, \
192  0 \
193  ); \
194  namespace Foam \
195  { \
196  defineTemplateRunTimeSelectionTable \
197  ( \
198  CloudFunctionObject<momentumCloudType>, \
199  dictionary \
200  ); \
201  }
202 
203 
204 #define makeCloudFunctionObjectType(SS, CloudType) \
205  \
206  typedef Foam::CloudType::momentumCloudType momentumCloudType; \
207  defineNamedTemplateTypeNameAndDebug(Foam::SS<momentumCloudType>, 0); \
208  \
209  Foam::CloudFunctionObject<momentumCloudType>:: \
210  adddictionaryConstructorToTable<Foam::SS<momentumCloudType>> \
211  add##SS##CloudType##momentumCloudType##ConstructorToTable_;
212 
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 #ifdef NoRepository
217  #include "CloudFunctionObject.C"
218 #endif
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 #endif
223 
224 // ************************************************************************* //
Templated cloud function object base class.
virtual void postEvolve()
Post-evolve hook.
fileName writeTimeDir() const
Return the output time path.
declareRunTimeSelectionTable(autoPtr, CloudFunctionObject, dictionary,(const dictionary &dict, CloudType &owner, const word &modelName),(dict, owner, modelName))
Declare runtime constructor selection table.
virtual void postMove(typename CloudType::parcelType &p, const scalar dt, const point &position0, bool &keepParticle)
Post-move hook.
CloudFunctionObject(CloudType &owner)
Construct null from owner.
TypeName("cloudFunctionObject")
Runtime type information.
virtual ~CloudFunctionObject()
Destructor.
const fileName & outputDir() const
Return the output path.
virtual void postFace(const typename CloudType::parcelType &p)
Post-face hook.
virtual autoPtr< CloudFunctionObject< CloudType > > clone() const
Construct and return a clone.
virtual void preEvolve()
Pre-evolve hook.
virtual void postPatch(const typename CloudType::parcelType &p, const polyPatch &pp)
Post-patch hook.
static autoPtr< CloudFunctionObject< CloudType > > New(const dictionary &dict, CloudType &owner, const word &objectType, const word &modelName)
Selector.
virtual void preFace(const typename CloudType::parcelType &p)
Pre-face hook.
Base class for cloud sub-models.
const CloudType & owner() const
Return const access to the owner cloud.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:80
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:225
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
A class for handling file names.
Definition: fileName.H:82
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:70
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:104
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
Macros to ease declaration of run-time selection tables.
volScalarField & p