1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 Special version of Particle to do tracking on non-convex cells.
31 \*---------------------------------------------------------------------------*/
33 #ifndef ExactParticle_H
34 #define ExactParticle_H
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 template<class ExactParticle>
47 // Forward declaration of friend functions and operators
49 template<class ParticleType>
52 template<class ParticleType>
56 const ExactParticle<ParticleType>&
60 /*---------------------------------------------------------------------------*\
61 Class ExactParticle Declaration
62 \*---------------------------------------------------------------------------*/
64 template<class ParticleType>
67 public Particle<ParticleType>
72 friend class Cloud<ParticleType>;
77 //- Construct from components
80 const Cloud<ParticleType>& cloud,
81 const vector& position,
85 Particle<ParticleType>(cloud, position, celli)
89 //- Construct from Istream
92 const Cloud<ParticleType>& cloud,
94 bool readFields = true
97 Particle<ParticleType>(cloud, is, readFields)
101 //- Factory class to read-construct particles used for parallel transfer
107 const Cloud<ParticleType>& cloud_;
112 iNew(const Cloud<ParticleType>& cloud)
117 autoPtr<ParticleType> operator()(Istream& is) const
119 return autoPtr<ParticleType>
121 new ParticleType(cloud_, is)
129 virtual ~ExactParticle()
135 //- Track particle to end of trajectory
136 // or until it hits the boundary.
137 // On entry 'stepFraction()' should be set to the fraction of the
138 // time-step at which the tracking starts and on exit it contains
139 // the fraction of the time-step completed.
140 // Returns the boundary face index if the track stops at the
141 // boundary, -1 otherwise.
142 template<class TrackingData>
145 const vector& endPosition,
149 //- Calls the templated track with dummy TrackingData
150 label track(const vector& endPosition);
152 //- Track particle to a given position and returns 1.0 if the
153 // trajectory is completed without hitting a face otherwise
154 // stops at the face and returns the fraction of the trajectory
156 // on entry 'stepFraction()' should be set to the fraction of the
157 // time-step at which the tracking starts.
158 template<class TrackingData>
161 const vector& endPosition,
165 //- Calls the templated trackToFace with dummy TrackingData
166 scalar trackToFace(const vector& endPosition);
171 friend Ostream& operator<< <ParticleType>
174 const ExactParticle<ParticleType>&
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 } // End namespace Foam
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 # include "ExactParticle.C"
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193 // ************************************************************************* //