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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::CloudFunctionObject
29
30Group
31 grpLagrangianIntermediateFunctionObjects
32
33Description
34 Templated cloud function object base class
35
36SourceFiles
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"
48#include "CloudSubModelBase.H"
49
50// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51
52namespace Foam
53{
54
55class polyPatch;
56class tetIndices;
57
58/*---------------------------------------------------------------------------*\
59 Class CloudFunctionObject Declaration
60\*---------------------------------------------------------------------------*/
61
62template<class CloudType>
64:
65 public CloudSubModelBase<CloudType>
66{
67private:
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
81 using CloudSubModelBase<CloudType>::write;
82
83 //- Write post-processing info
84 virtual void write();
85
86
87public:
88
89 //- Runtime type information
90 TypeName("cloudFunctionObject");
91
92 //- Declare runtime constructor selection table
94 (
95 autoPtr,
98 (
99 const dictionary& dict,
101 const word& modelName
102 ),
104 );
105
106
107 // Constructors
108
109 //- Construct null from owner
111
112 //- Construct from dictionary
114 (
115 const dictionary& dict,
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,
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// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
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
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// ************************************************************************* //
Templated cloud function object base class.
virtual autoPtr< CloudFunctionObject< CloudType > > clone() const
Construct and return a clone.
fileName writeTimeDir() const
Return the output time path.
virtual ~CloudFunctionObject()=default
Destructor.
declareRunTimeSelectionTable(autoPtr, CloudFunctionObject, dictionary,(const dictionary &dict, CloudType &owner, const word &modelName),(dict, owner, modelName))
Declare runtime constructor selection table.
virtual void postMove(parcelType &p, const scalar dt, const point &position0, bool &keepParticle)
Post-move hook.
TypeName("cloudFunctionObject")
Runtime type information.
virtual void postPatch(const parcelType &p, const polyPatch &pp, bool &keepParticle)
Post-patch hook.
const fileName & outputDir() const
Return the output path.
virtual void postEvolve(const typename parcelType::trackingData &td)
Post-evolve hook.
virtual void preEvolve(const typename parcelType::trackingData &td)
Pre-evolve hook.
static autoPtr< CloudFunctionObject< CloudType > > New(const dictionary &dict, CloudType &owner, const word &objectType, const word &modelName)
Selector.
virtual void postFace(const parcelType &p, bool &keepParticle)
Post-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:75
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Class used to pass data into container.
A class for handling file names.
Definition: fileName.H:76
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:75
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:113
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:107
A class for handling words, derived from Foam::string.
Definition: word.H:68
volScalarField & p
Namespace for OpenFOAM.
Macros to ease declaration of run-time selection tables.
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes)
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73