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-2023 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 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(Cloud<findCellParticle>&, trackingData&);
178 
179  //- Overridable function to handle the particle hitting a wedge
180  void hitWedgePatch(Cloud<findCellParticle>&, trackingData&);
181 
182  //- Overridable function to handle the particle hitting a
183  // symmetry plane
184  void hitSymmetryPlanePatch(Cloud<findCellParticle>&, trackingData&);
185 
186  //- Overridable function to handle the particle hitting a
187  // symmetry patch
188  void hitSymmetryPatch(Cloud<findCellParticle>&, trackingData&);
189 
190  //- Overridable function to handle the particle hitting a cyclic
191  void hitCyclicPatch(Cloud<findCellParticle>&, trackingData&);
192 
193  //- Overridable function to handle the particle hitting a
194  //- processorPatch
195  void hitProcessorPatch(Cloud<findCellParticle>&, trackingData&);
196 
197  //- Overridable function to handle the particle hitting a wallPatch
198  void hitWallPatch(Cloud<findCellParticle>&, trackingData&);
199 
200 
201  // Ostream Operator
202 
203  friend Ostream& operator<<(Ostream&, const findCellParticle&);
204 };
205 
206 
207 template<>
208 inline bool contiguous<findCellParticle>()
209 {
210  return true;
211 }
212 
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 } // End namespace Foam
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 #endif
221 
222 // ************************************************************************* //
Base cloud calls templated on particle type.
Definition: Cloud.H:74
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
A cloud is a collection of lagrangian particles.
Definition: cloud.H:55
Class used to pass tracking data to the trackToFace function.
trackingData(Cloud< findCellParticle > &cloud, labelListList &cellToData, List< List< point >> &cellToEnd)
List< List< point > > & cellToEnd()
Particle class that finds cells by tracking.
void hitWallPatch(Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a wallPatch.
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.
void hitProcessorPatch(Cloud< findCellParticle > &, trackingData &)
friend Ostream & operator<<(Ostream &, const findCellParticle &)
void hitSymmetryPatch(Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a.
void hitSymmetryPlanePatch(Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a.
static autoPtr< findCellParticle > New(Istream &is)
Construct from Istream and return.
void hitWedgePatch(Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a wedge.
void hitCyclicPatch(Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a cyclic.
label data() const
Transported label.
autoPtr< particle > clone() const
Construct and return a clone.
const vector & displacement() const
Displacement over which to track.
bool move(Cloud< findCellParticle > &, trackingData &)
Track all particles to their end point.
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:255
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
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)