1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
28 Records particle state (all variables) on each call to postFace
33 \*---------------------------------------------------------------------------*/
35 #ifndef ParticleTracks_H
36 #define ParticleTracks_H
38 #include "CloudFunctionObject.H"
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 /*---------------------------------------------------------------------------*\
46 Class ParticleTracks Declaration
47 \*---------------------------------------------------------------------------*/
49 template<class CloudType>
52 public CloudFunctionObject<CloudType>
58 //- Convenience typedef for parcel type
59 typedef typename CloudType::parcelType parcelType;
61 //- Convenience typedef for hash hit-table
62 typedef HashTable<label, labelPair, typename labelPair::Hash<> >
65 //- Number of face-hit intervals between storing parcel data
68 //- Maximum number of particles to store per track
71 //- Flag to indicate whether data should be reset/cleared on writing
74 //- Table of number of times a particle has hit a face
75 hitTableType faceHitCounter_;
77 //- Pointer to the cloud storage
78 autoPtr<Cloud<parcelType> > cloudPtr_;
83 // Protected member functions
85 //- Write post-processing info
91 //- Runtime type information
92 TypeName("particleTracks");
97 //- Construct from dictionary
98 ParticleTracks(const dictionary& dict, CloudType& owner);
101 ParticleTracks(const ParticleTracks<CloudType>& ppm);
103 //- Construct and return a clone
104 virtual autoPtr<CloudFunctionObject<CloudType> > clone() const
106 return autoPtr<CloudFunctionObject<CloudType> >
108 new ParticleTracks<CloudType>(*this)
114 virtual ~ParticleTracks();
121 //- Return const access to the track interval
122 inline label trackInterval() const;
124 //- Return const access to the max samples
125 inline label maxSamples() const;
127 //- Return const access to the reset on write flag
128 inline const Switch& resetOnWrite() const;
130 //- Rerurn the table of number of times a particle has hit a face
131 inline const hitTableType& faceHitCounter() const;
133 //- Return const access to the cloud
134 inline const Cloud<parcelType>& cloud() const;
140 virtual void preEvolve();
143 virtual void postFace(const parcelType& p, const label faceI);
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 } // End namespace Foam
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 #include "ParticleTracksI.H"
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 # include "ParticleTracks.C"
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 // ************************************************************************* //