ParticleTracks.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-2013 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
67 
68  //- Maximum number of particles to store per track
70 
71  //- Flag to indicate whether data should be reset/cleared on writing
73 
74  //- Table of number of times a particle has hit a face
76 
77  //- Pointer to the cloud storage
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
149  (
150  const parcelType& p,
151  const label faceI,
152  bool& keepParticle
153  );
154 };
155 
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 } // End namespace Foam
160 
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 
163 #include "ParticleTracksI.H"
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 #ifdef NoRepository
168 # include "ParticleTracks.C"
169 #endif
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #endif
174 
175 // ************************************************************************* //
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:60
Foam::ParticleTracks::preEvolve
virtual void preEvolve()
Pre-evolve hook.
Definition: ParticleTracks.C:100
p
p
Definition: pEqn.H:62
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::ParticleTracks::trackInterval_
label trackInterval_
Number of face-hit intervals between storing parcel data.
Definition: ParticleTracks.H:65
Foam::ParticleTracks::write
void write()
Write post-processing info.
Definition: ParticleTracks.C:34
Foam::ParticleTracks::parcelType
CloudType::parcelType parcelType
Convenience typedef for parcel type.
Definition: ParticleTracks.H:58
Foam::ParticleTracks::clone
virtual autoPtr< CloudFunctionObject< CloudType > > clone() const
Construct and return a clone.
Definition: ParticleTracks.H:108
Foam::ParticleTracks
Records particle state (all variables) on each call to postFace.
Definition: ParticleTracks.H:49
Foam::CloudSubModelBase::owner
const CloudType & owner() const
Return const access to the owner cloud.
Definition: CloudSubModelBase.C:103
Foam::ParticleTracks::trackInterval
label trackInterval() const
Return const access to the track interval.
Definition: ParticleTracksI.H:31
Foam::subModelBase::modelName
const word & modelName() const
Return const access to the name of the sub-model.
Definition: subModelBase.C:104
Foam::ParticleTracks::ParticleTracks
ParticleTracks(const dictionary &dict, CloudType &owner, const word &modelName)
Construct from dictionary.
Definition: ParticleTracks.C:60
CloudFunctionObject.H
Foam::ParticleTracks::TypeName
TypeName("particleTracks")
Runtime type information.
ParticleTracks.C
Foam::ParticleTracks::cloudPtr_
autoPtr< Cloud< parcelType > > cloudPtr_
Pointer to the cloud storage.
Definition: ParticleTracks.H:77
Foam::label
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
Foam::subModelBase::dict
const dictionary & dict() const
Return const access to the cloud dictionary.
Definition: subModelBase.C:110
Foam::ParticleTracks::~ParticleTracks
virtual ~ParticleTracks()
Destructor.
Definition: ParticleTracks.C:93
Foam::ParticleTracks::faceHitCounter_
hitTableType faceHitCounter_
Table of number of times a particle has hit a face.
Definition: ParticleTracks.H:74
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:68
Foam::ParticleTracks::resetOnWrite_
Switch resetOnWrite_
Flag to indicate whether data should be reset/cleared on writing.
Definition: ParticleTracks.H:71
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::ParticleTracks::cloud
const Cloud< parcelType > & cloud() const
Return const access to the cloud.
Definition: ParticleTracksI.H:61
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::ParticleTracks::maxSamples_
label maxSamples_
Maximum number of particles to store per track.
Definition: ParticleTracks.H:68
Foam::ParticleTracks::maxSamples
label maxSamples() const
Return const access to the max samples.
Definition: ParticleTracksI.H:38
Foam::ParticleTracks::faceHitCounter
const hitTableType & faceHitCounter() const
Rerurn the table of number of times a particle has hit a face.
Definition: ParticleTracksI.H:53
Foam::HashTable
An STL-conforming hash table.
Definition: HashTable.H:61
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
ParticleTracksI.H
Foam::CloudFunctionObject
Templated cloud function object base class.
Definition: CloudFunctionObject.H:56
Foam::Cloud
Base cloud calls templated on particle type.
Definition: Cloud.H:52
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:217
Foam::ParticleTracks::hitTableType
HashTable< label, labelPair, typename labelPair::Hash<> > hitTableType
Convenience typedef for hash hit-table.
Definition: ParticleTracks.H:62
Foam::ParticleTracks::resetOnWrite
const Switch & resetOnWrite() const
Return const access to the reset on write flag.
Definition: ParticleTracksI.H:45
Foam::ParticleTracks::postFace
virtual void postFace(const parcelType &p, const label faceI, bool &keepParticle)
Post-face hook.
Definition: ParticleTracks.C:114