ParticleTracks.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-2018 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::ParticleTracks
26 
27 Description
28  Records particle state (all variables) on each call to postFace
29 
30 SourceFiles
31  ParticleTracks.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef ParticleTracks_H
36 #define ParticleTracks_H
37 
38 #include "CloudFunctionObject.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class ParticleTracks Declaration
47 \*---------------------------------------------------------------------------*/
48 
49 template<class CloudType>
50 class ParticleTracks
51 :
52  public CloudFunctionObject<CloudType>
53 {
54  // Private data
55 
56  // Typedefs
57 
58  //- Convenience typedef for parcel type
59  typedef typename CloudType::parcelType parcelType;
60 
61  //- Convenience typedef for hash hit-table
64 
65  //- Number of face-hit intervals between storing parcel data
66  label trackInterval_;
67 
68  //- Maximum number of particles to store per track
69  label maxSamples_;
70 
71  //- Flag to indicate whether data should be reset/cleared on writing
72  Switch resetOnWrite_;
73 
74  //- Table of number of times a particle has hit a face
75  hitTableType faceHitCounter_;
76 
77  //- Pointer to the cloud storage
78  autoPtr<Cloud<parcelType>> cloudPtr_;
79 
80 
81 protected:
82 
83  // Protected member functions
84 
85  //- Write post-processing info
86  void write();
87 
88 
89 public:
90 
91  //- Runtime type information
92  TypeName("particleTracks");
93 
94 
95  // Constructors
96 
97  //- Construct from dictionary
99  (
100  const dictionary& dict,
101  CloudType& owner,
102  const word& modelName
103  );
104 
105  //- Construct copy
107 
108  //- Construct and return a clone
110  {
112  (
113  new ParticleTracks<CloudType>(*this)
114  );
115  }
116 
117 
118  //- Destructor
119  virtual ~ParticleTracks();
120 
121 
122  // Member Functions
123 
124  // Access
125 
126  //- Return const access to the track interval
127  inline label trackInterval() const;
128 
129  //- Return const access to the max samples
130  inline label maxSamples() const;
131 
132  //- Return const access to the reset on write flag
133  inline const Switch& resetOnWrite() const;
134 
135  //- Rerurn the table of number of times a particle has hit a face
136  inline const hitTableType& faceHitCounter() const;
137 
138  //- Return const access to the cloud
139  inline const Cloud<parcelType>& cloud() const;
140 
141 
142  // Evaluation
143 
144  //- Pre-evolve hook
145  virtual void preEvolve();
146 
147  //- Post-face hook
148  virtual void postFace(const parcelType& p, bool& keepParticle);
149 };
150 
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 } // End namespace Foam
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 #include "ParticleTracksI.H"
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 #ifdef NoRepository
163  #include "ParticleTracks.C"
164 #endif
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 #endif
169 
170 // ************************************************************************* //
const Cloud< parcelType > & cloud() const
Return const access to the cloud.
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
label maxSamples() const
Return const access to the max samples.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
const hitTableType & faceHitCounter() const
Rerurn the table of number of times a particle has hit a face.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none.
Definition: Switch.H:60
Records particle state (all variables) on each call to postFace.
virtual void postFace(const parcelType &p, bool &keepParticle)
Post-face hook.
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:104
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
const CloudType & owner() const
Return const access to the owner cloud.
const Switch & resetOnWrite() const
Return const access to the reset on write flag.
A class for handling words, derived from string.
Definition: word.H:59
virtual void preEvolve()
Pre-evolve hook.
An STL-conforming hash table.
Definition: HashTable.H:62
void write()
Write post-processing info.
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:218
ParticleTracks(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
virtual autoPtr< CloudFunctionObject< CloudType > > clone() const
Construct and return a clone.
label trackInterval() const
Return const access to the track interval.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
volScalarField & p
TypeName("particleTracks")
Runtime type information.
virtual ~ParticleTracks()
Destructor.
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:69
Templated cloud function object base class.
Namespace for OpenFOAM.