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