findCellParticle.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) 2013-2019 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::findCellParticle
26 
27 Description
28  Particle class that finds cells by tracking
29 
30 SourceFiles
31  findCellParticle.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef findCellParticle_H
36 #define findCellParticle_H
37 
38 #include "particle.H"
39 #include "autoPtr.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 class findCellParticleCloud;
47 
48 
49 // Forward declaration of friend functions and operators
50 
51 class findCellParticle;
52 
53 Ostream& operator<<(Ostream&, const findCellParticle&);
54 
55 
56 /*---------------------------------------------------------------------------*\
57  Class findCellParticle Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 class findCellParticle
61 :
62  public particle
63 {
64  // Private Data
65 
66  //- Displacement over which to track
67  vector displacement_;
68 
69  //- Passive data
70  label data_;
71 
72 
73 public:
74 
75  friend class Cloud<findCellParticle>;
76 
77  //- Class used to pass tracking data to the trackToFace function
78  class trackingData
79  :
81  {
82  labelListList& cellToData_;
83  List<List<point>>& cellToEnd_;
84 
85  public:
86 
87  // Constructors
88 
90  (
94  )
95  :
96  particle::trackingData(cloud),
97  cellToData_(cellToData),
98  cellToEnd_(cellToEnd)
99  {}
100 
101 
102  // Member Functions
105  {
106  return cellToData_;
107  }
110  {
111  return cellToEnd_;
112  }
113  };
114 
115 
116  // Constructors
117 
118  //- Construct from components
120  (
121  const polyMesh& mesh,
122  const barycentric& coordinates,
123  const label celli,
124  const label tetFacei,
125  const label tetPtI,
126  const vector& displacement,
127  const label data
128  );
129 
130  //- Construct from a position and a cell, searching for the rest of the
131  // required topology
133  (
134  const polyMesh& mesh,
135  const vector& position,
136  const label celli,
137  const vector& displacement,
138  const label data
139  );
140 
141  //- Construct from Istream
143  (
144  const polyMesh& mesh,
145  Istream& is,
146  bool readFields = true
147  );
148 
149  //- Construct and return a clone
150  autoPtr<particle> clone() const
151  {
152  return autoPtr<particle>(new findCellParticle(*this));
153  }
154 
155  //- Factory class to read-construct particles used for
156  // parallel transfer
157  class iNew
158  {
159  const polyMesh& mesh_;
160 
161  public:
163  iNew(const polyMesh& mesh)
164  :
165  mesh_(mesh)
166  {}
168  autoPtr<findCellParticle> operator()(Istream& is) const
169  {
171  (
172  new findCellParticle(mesh_, is, true)
173  );
174  }
175  };
176 
177 
178  // Member Functions
179 
180  //- Displacement over which to track
181  const vector& displacement() const
182  {
183  return displacement_;
184  }
185 
186  //- Displacement over which to track
188  {
189  return displacement_;
190  }
191 
192  //- Transported label
193  label data() const
194  {
195  return data_;
196  }
197 
198  //- Transported label
199  label& data()
200  {
201  return data_;
202  }
203 
204 
205  // Tracking
206 
207  //- Track all particles to their end point
208  bool move(Cloud<findCellParticle>&, trackingData&, const scalar);
209 
210  //- Overridable function to handle the particle hitting a patch
211  // Executed before other patch-hitting functions
213 
214  //- Overridable function to handle the particle hitting a wedge
216 
217  //- Overridable function to handle the particle hitting a
218  // symmetry plane
220 
221  //- Overridable function to handle the particle hitting a
222  // symmetry patch
224 
225  //- Overridable function to handle the particle hitting a cyclic
227 
228  //- Overridable function to handle the particle hitting a cyclicAMI
229  void hitCyclicAMIPatch
230  (
231  const vector&,
232  const scalar,
234  trackingData&
235  );
236 
237  //- Overridable function to handle the particle hitting a cyclicACMI
238  void hitCyclicACMIPatch
239  (
240  const vector&,
241  const scalar,
243  trackingData&
244  );
245 
246  //- Overridable function to handle the particle hitting a
247  //cyclicRepeatAMI
249  (
250  const vector&,
251  const scalar,
253  trackingData&
254  );
255 
256  //- Overridable function to handle the particle hitting a
257  //- processorPatch
259 
260  //- Overridable function to handle the particle hitting a wallPatch
262 
263 
264  // Ostream Operator
265 
266  friend Ostream& operator<<(Ostream&, const findCellParticle&);
267 };
268 
269 
270 template<>
271 inline bool contiguous<findCellParticle>()
272 {
273  return true;
274 }
275 
276 
277 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
278 
279 } // End namespace Foam
280 
281 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
282 
283 #endif
284 
285 // ************************************************************************* //
friend Ostream & operator<<(Ostream &, const findCellParticle &)
const polyMesh & mesh() const
Return the mesh database.
Definition: particleI.H:125
bool contiguous< findCellParticle >()
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
void hitCyclicACMIPatch(const vector &, const scalar, Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a cyclicACMI.
autoPtr< particle > clone() const
Construct and return a clone.
bool move(Cloud< findCellParticle > &, trackingData &, const scalar)
Track all particles to their end point.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
void hitCyclicPatch(Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a cyclic.
void hitSymmetryPatch(Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a.
Base particle class.
Definition: particle.H:84
void hitProcessorPatch(Cloud< findCellParticle > &, trackingData &)
void hitWedgePatch(Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a wedge.
findCellParticle(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPtI, const vector &displacement, const label data)
Construct from components.
A cloud is a collection of lagrangian particles.
Definition: cloud.H:51
label data() const
Transported label.
Base cloud calls templated on particle type.
Definition: Cloud.H:52
void hitCyclicAMIPatch(const vector &, const scalar, Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a cyclicAMI.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
Database for solution and other reduced data.
Definition: data.H:51
void hitCyclicRepeatAMIPatch(const vector &, const scalar, Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a.
const vector & displacement() const
Displacement over which to track.
bool hitPatch(Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a patch.
List< List< point > > & cellToEnd()
static void readFields(TrackCloudType &c)
Read the fields associated with the owner cloud.
Ostream & operator<<(Ostream &, const ensightPart &)
Particle class that finds cells by tracking.
const barycentric & coordinates() const
Return current particle coordinates.
Definition: particleI.H:131
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
void hitWallPatch(Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a wallPatch.
Factory class to read-construct particles used for.
Class used to pass tracking data to the trackToFace function.
vector position() const
Return current particle position.
Definition: particleI.H:278
trackingData(Cloud< findCellParticle > &cloud, labelListList &cellToData, List< List< point >> &cellToEnd)
Namespace for OpenFOAM.
void hitSymmetryPlanePatch(Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a.