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 | Copyright (C) 2011-2016 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 label celli,
152  const scalar dt,
153  const point& position0,
154  bool& keepParticle
155  );
156 
157  //- Post-patch hook
158  virtual void postPatch
159  (
160  const typename CloudType::parcelType& p,
161  const polyPatch& pp,
162  const scalar trackFraction,
163  const tetIndices& testIs,
164  bool& keepParticle
165  );
166 
167  //- Post-face hook
168  virtual void postFace
169  (
170  const typename CloudType::parcelType& p,
171  const label facei,
172  bool& keepParticle
173  );
174 
175 
176  // Input/output
177 
178  //- Return the output path
179  const fileName& outputDir() const;
180 
181  //- Return the output time path
182  fileName writeTimeDir() const;
183 };
184 
185 
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 
188 } // End namespace Foam
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 #define makeCloudFunctionObject(CloudType) \
193  \
194  typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
195  defineNamedTemplateTypeNameAndDebug \
196  ( \
197  Foam::CloudFunctionObject<kinematicCloudType>, \
198  0 \
199  ); \
200  namespace Foam \
201  { \
202  defineTemplateRunTimeSelectionTable \
203  ( \
204  CloudFunctionObject<kinematicCloudType>, \
205  dictionary \
206  ); \
207  }
208 
210 #define makeCloudFunctionObjectType(SS, CloudType) \
211  \
212  typedef Foam::CloudType::kinematicCloudType kinematicCloudType; \
213  defineNamedTemplateTypeNameAndDebug(Foam::SS<kinematicCloudType>, 0); \
214  \
215  Foam::CloudFunctionObject<kinematicCloudType>:: \
216  adddictionaryConstructorToTable<Foam::SS<kinematicCloudType>> \
217  add##SS##CloudType##kinematicCloudType##ConstructorToTable_;
218 
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 #ifdef NoRepository
223  #include "CloudFunctionObject.C"
224 #endif
225 
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 
228 #endif
229 
230 // ************************************************************************* //
virtual autoPtr< CloudFunctionObject< CloudType > > clone() const
Construct and return a clone.
virtual void postMove(typename CloudType::parcelType &p, const label celli, const scalar dt, const point &position0, bool &keepParticle)
Post-move hook.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
A class for handling file names.
Definition: fileName.H:69
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
static autoPtr< CloudFunctionObject< CloudType > > New(const dictionary &dict, CloudType &owner, const word &objectType, const word &modelName)
Selector.
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:104
const fileName & outputDir() const
Return the output path.
Base class for cloud sub-models.
virtual void preEvolve()
Pre-evolve hook.
TypeName("cloudFunctionObject")
Runtime type information.
A class for handling words, derived from string.
Definition: word.H:59
virtual void postEvolve()
Post-evolve hook.
Storage and named access for the indices of a tet which is part of the decomposition of a cell...
Definition: tetIndices.H:81
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:217
virtual void postPatch(const typename CloudType::parcelType &p, const polyPatch &pp, const scalar trackFraction, const tetIndices &testIs, bool &keepParticle)
Post-patch hook.
fileName writeTimeDir() const
Return the output time path.
virtual void postFace(const typename CloudType::parcelType &p, const label facei, bool &keepParticle)
Post-face hook.
const CloudType & owner() const
Return const access to the owner cloud.
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:53
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:68
Templated cloud function object base class.
Namespace for OpenFOAM.
virtual ~CloudFunctionObject()
Destructor.