CloudFunctionObject.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::CloudFunctionObject
29 
30 Group
31  grpLagrangianIntermediateFunctionObjects
32 
33 Description
34  Templated cloud function object base class
35 
36 SourceFiles
37  CloudFunctionObject.C
38  CloudFunctionObjectNew.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef CloudFunctionObject_H
43 #define CloudFunctionObject_H
44 
45 #include "IOdictionary.H"
46 #include "autoPtr.H"
47 #include "runTimeSelectionTables.H"
48 #include "CloudSubModelBase.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 class polyPatch;
56 class tetIndices;
57 
58 /*---------------------------------------------------------------------------*\
59  Class CloudFunctionObject Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 template<class CloudType>
64 :
65  public CloudSubModelBase<CloudType>
66 {
67 private:
68 
69  //- Convenience typedef for parcel type
70  typedef typename CloudType::parcelType parcelType;
71 
72  // Private data
73 
74  //- Output path
75  fileName outputDir_;
76 
77 
78  // Private Member Functions
79 
80  //- Inherited write from CloudSubModelBase
82 
83  //- Write post-processing info
84  virtual void write();
85 
86 
87 public:
88 
89  //- Runtime type information
90  TypeName("cloudFunctionObject");
91 
92  //- Declare runtime constructor selection table
94  (
95  autoPtr,
97  dictionary,
98  (
99  const dictionary& dict,
100  CloudType& owner,
101  const word& modelName
102  ),
103  (dict, owner, modelName)
104  );
105 
106 
107  // Constructors
108 
109  //- Construct null from owner
111 
112  //- Construct from dictionary
114  (
115  const dictionary& dict,
116  CloudType& owner,
117  const word& objectType,
118  const word& modelName
119  );
120 
121  //- Construct copy
123 
124  //- Construct and return a clone
126  {
128  (
130  );
131  }
132 
133 
134  //- Destructor
135  virtual ~CloudFunctionObject() = default;
136 
137 
138  //- Selector
140  (
141  const dictionary& dict,
142  CloudType& owner,
143  const word& objectType,
144  const word& modelName
145  );
146 
147 
148  // Member Functions
149 
150  // Evaluation
151 
152  //- Pre-evolve hook
153  virtual void preEvolve(const typename parcelType::trackingData& td);
154 
155  //- Post-evolve hook
156  virtual void postEvolve
157  (
158  const typename parcelType::trackingData& td
159  );
160 
161  //- Post-move hook
162  virtual void postMove
163  (
164  parcelType& p,
165  const scalar dt,
166  const point& position0,
167  bool& keepParticle
168  );
169 
170  //- Post-patch hook
171  virtual void postPatch
172  (
173  const parcelType& p,
174  const polyPatch& pp,
175  bool& keepParticle
176  );
177 
178  //- Post-face hook
179  virtual void postFace
180  (
181  const parcelType& p,
182  bool& keepParticle
183  );
184 
185 
186  // Input/output
187 
188  //- Return the output path
189  const fileName& outputDir() const;
190 
191  //- Return the output time path
192  fileName writeTimeDir() const;
193 };
194 
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 } // End namespace Foam
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 #define makeCloudFunctionObject(CloudType) \
203  \
204  typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
205  defineNamedTemplateTypeNameAndDebug \
206  ( \
207  Foam::CloudFunctionObject<kinematicCloudType>, \
208  0 \
209  ); \
210  namespace Foam \
211  { \
212  defineTemplateRunTimeSelectionTable \
213  ( \
214  CloudFunctionObject<kinematicCloudType>, \
215  dictionary \
216  ); \
217  }
218 
219 
220 #define makeCloudFunctionObjectType(SS, CloudType) \
221  \
222  typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
223  defineNamedTemplateTypeNameAndDebug(Foam::SS<kinematicCloudType>, 0); \
224  \
225  Foam::CloudFunctionObject<kinematicCloudType>:: \
226  adddictionaryConstructorToTable<Foam::SS<kinematicCloudType>> \
227  add##SS##CloudType##kinematicCloudType##ConstructorToTable_;
228 
229 
230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231 
232 #ifdef NoRepository
233  #include "CloudFunctionObject.C"
234 #endif
235 
236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237 
238 #endif
239 
240 // ************************************************************************* //
Foam::CloudFunctionObject::postFace
virtual void postFace(const parcelType &p, bool &keepParticle)
Post-face hook.
Definition: CloudFunctionObject.C:134
Foam::CloudFunctionObject::postEvolve
virtual void postEvolve(const typename parcelType::trackingData &td)
Post-evolve hook.
Definition: CloudFunctionObject.C:100
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::CloudFunctionObject::postMove
virtual void postMove(parcelType &p, const scalar dt, const point &position0, bool &keepParticle)
Post-move hook.
Definition: CloudFunctionObject.C:113
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::CloudFunctionObject::clone
virtual autoPtr< CloudFunctionObject< CloudType > > clone() const
Construct and return a clone.
Definition: CloudFunctionObject.H:124
Foam::CloudFunctionObject::CloudFunctionObject
CloudFunctionObject(CloudType &owner)
Construct null from owner.
Definition: CloudFunctionObject.C:44
Foam::CloudSubModelBase
Base class for cloud sub-models.
Definition: CloudSubModelBase.H:51
Foam::subModelBase::modelName
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:107
Foam::subModelBase::dict
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:113
CloudSubModelBase.H
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:67
Foam::CloudSubModelBase::owner
const CloudType & owner() const
Return const access to the owner cloud.
Definition: CloudSubModelBase.C:106
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
Foam::CloudFunctionObject::~CloudFunctionObject
virtual ~CloudFunctionObject()=default
Destructor.
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::CloudFunctionObject::preEvolve
virtual void preEvolve(const typename parcelType::trackingData &td)
Pre-evolve hook.
Definition: CloudFunctionObject.C:92
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::CloudFunctionObject::postPatch
virtual void postPatch(const parcelType &p, const polyPatch &pp, bool &keepParticle)
Post-patch hook.
Definition: CloudFunctionObject.C:124
Foam::CloudFunctionObject::New
static autoPtr< CloudFunctionObject< CloudType > > New(const dictionary &dict, CloudType &owner, const word &objectType, const word &modelName)
Selector.
Definition: CloudFunctionObjectNew.C:36
IOdictionary.H
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::Vector< scalar >
Foam::CloudFunctionObject::writeTimeDir
fileName writeTimeDir() const
Return the output time path.
Definition: CloudFunctionObject.C:149
Foam::CloudFunctionObject
Templated cloud function object base class.
Definition: CloudFunctionObject.H:62
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Foam::CloudFunctionObject::TypeName
TypeName("cloudFunctionObject")
Runtime type information.
Foam::CloudFunctionObject::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, CloudFunctionObject, dictionary,(const dictionary &dict, CloudType &owner, const word &modelName),(dict, owner, modelName))
Declare runtime constructor selection table.
Foam::CloudFunctionObject::outputDir
const fileName & outputDir() const
Return the output path.
Definition: CloudFunctionObject.C:142
CloudFunctionObject.C
autoPtr.H