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-2024 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 "Cloud.H"
40 #include "autoPtr.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 class findCellParticleCloud;
48 
49 
50 // Forward declaration of friend functions and operators
51 
52 class findCellParticle;
53 
54 Ostream& operator<<(Ostream&, const findCellParticle&);
55 
56 
57 /*---------------------------------------------------------------------------*\
58  Class findCellParticle Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 class findCellParticle
62 :
63  public particle
64 {
65  // Private Data
66 
67  //- Displacement over which to track
68  vector displacement_;
69 
70  //- Passive data
71  label data_;
72 
73 
74 public:
75 
76  friend class lagrangian::Cloud<findCellParticle>;
77 
78  //- Class used to pass tracking data to the trackToFace function
79  class trackingData
80  :
82  {
83  labelListList& cellToData_;
84  List<List<point>>& cellToEnd_;
85 
86  public:
87 
88  // Constructors
89 
91  (
95  )
96  :
98  cellToData_(cellToData),
99  cellToEnd_(cellToEnd)
100  {}
101 
102 
103  // Member Functions
104 
106  {
107  return cellToData_;
108  }
109 
111  {
112  return cellToEnd_;
113  }
114  };
115 
116 
117  // Constructors
118 
119  //- Construct from a position and a cell, searching for the rest of the
120  // required topology
122  (
123  const polyMesh& mesh,
124  const vector& position,
125  const label celli,
126  label& nLocateBoundaryHits,
127  const vector& displacement,
128  const label data
129  );
130 
131  //- Construct from Istream
132  findCellParticle(Istream& is, bool readFields = true);
133 
134  //- Construct and return a clone
135  autoPtr<particle> clone() const
136  {
137  return autoPtr<particle>(new findCellParticle(*this));
138  }
139 
140  //- Construct from Istream and return
142  {
144  }
145 
146 
147  // Member Functions
148 
149  //- Displacement over which to track
150  const vector& displacement() const
151  {
152  return displacement_;
153  }
154 
155  //- Displacement over which to track
157  {
158  return displacement_;
159  }
160 
161  //- Transported label
162  label data() const
163  {
164  return data_;
165  }
166 
167  //- Transported label
168  label& data()
169  {
170  return data_;
171  }
172 
173 
174  // Tracking
175 
176  //- Track all particles to their end point
177  bool move(lagrangian::Cloud<findCellParticle>&, trackingData&);
178 
179  //- Overridable function to handle the particle hitting a wedge
180  void hitWedgePatch
181  (
183  trackingData&
184  );
185 
186  //- Overridable function to handle the particle hitting a
187  // symmetry plane
189  (
191  trackingData&
192  );
193 
194  //- Overridable function to handle the particle hitting a
195  // symmetry patch
196  void hitSymmetryPatch
197  (
199  trackingData&
200  );
201 
202  //- Overridable function to handle the particle hitting a cyclic
203  void hitCyclicPatch
204  (
206  trackingData&
207  );
208 
209  //- Overridable function to handle the particle hitting a
210  //- processorPatch
211  void hitProcessorPatch
212  (
214  trackingData&
215  );
216 
217  //- Overridable function to handle the particle hitting a wallPatch
218  void hitWallPatch
219  (
221  trackingData&
222  );
223 
224 
225  // Ostream Operator
226 
227  friend Ostream& operator<<(Ostream&, const findCellParticle&);
228 };
229 
230 
231 template<>
232 inline bool contiguous<findCellParticle>()
233 {
234  return true;
235 }
236 
237 
238 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 
240 } // End namespace Foam
241 
242 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 
244 #endif
245 
246 // ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Base class for clouds. Provides a basic evolution algorithm, models, and a database for caching deriv...
Definition: cloud.H:63
Class used to pass tracking data to the trackToFace function.
trackingData(lagrangian::Cloud< findCellParticle > &cloud, labelListList &cellToData, List< List< point >> &cellToEnd)
List< List< point > > & cellToEnd()
Particle class that finds cells by tracking.
void hitWallPatch(lagrangian::Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a wallPatch.
void hitSymmetryPlanePatch(lagrangian::Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a.
findCellParticle(const polyMesh &mesh, const vector &position, const label celli, label &nLocateBoundaryHits, const vector &displacement, const label data)
Construct from a position and a cell, searching for the rest of the.
friend Ostream & operator<<(Ostream &, const findCellParticle &)
static autoPtr< findCellParticle > New(Istream &is)
Construct from Istream and return.
void hitSymmetryPatch(lagrangian::Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a.
void hitCyclicPatch(lagrangian::Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a cyclic.
bool move(lagrangian::Cloud< findCellParticle > &, trackingData &)
Track all particles to their end point.
void hitWedgePatch(lagrangian::Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a wedge.
label data() const
Transported label.
void hitProcessorPatch(lagrangian::Cloud< findCellParticle > &, trackingData &)
autoPtr< particle > clone() const
Construct and return a clone.
const vector & displacement() const
Displacement over which to track.
Base particle class.
Definition: particle.H:83
static void readFields(TrackCloudType &c)
Read the fields associated with the owner cloud.
vector position(const polyMesh &mesh) const
Return current particle position.
Definition: particleI.H:159
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
Namespace for OpenFOAM.
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
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)