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-2022 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  const vector& displacement,
127  const label data
128  );
129 
130  //- Construct from Istream
131  findCellParticle(Istream& is, bool readFields = true);
132 
133  //- Construct and return a clone
134  autoPtr<particle> clone() const
135  {
136  return autoPtr<particle>(new findCellParticle(*this));
137  }
138 
139  //- Construct from Istream and return
141  {
143  }
144 
145 
146  // Member Functions
147 
148  //- Displacement over which to track
149  const vector& displacement() const
150  {
151  return displacement_;
152  }
153 
154  //- Displacement over which to track
156  {
157  return displacement_;
158  }
159 
160  //- Transported label
161  label data() const
162  {
163  return data_;
164  }
165 
166  //- Transported label
167  label& data()
168  {
169  return data_;
170  }
171 
172 
173  // Tracking
174 
175  //- Track all particles to their end point
176  bool move(Cloud<findCellParticle>&, trackingData&);
177 
178  //- Overridable function to handle the particle hitting a wedge
179  void hitWedgePatch(Cloud<findCellParticle>&, trackingData&);
180 
181  //- Overridable function to handle the particle hitting a
182  // symmetry plane
183  void hitSymmetryPlanePatch(Cloud<findCellParticle>&, trackingData&);
184 
185  //- Overridable function to handle the particle hitting a
186  // symmetry patch
187  void hitSymmetryPatch(Cloud<findCellParticle>&, trackingData&);
188 
189  //- Overridable function to handle the particle hitting a cyclic
190  void hitCyclicPatch(Cloud<findCellParticle>&, trackingData&);
191 
192  //- Overridable function to handle the particle hitting a
193  //- processorPatch
194  void hitProcessorPatch(Cloud<findCellParticle>&, trackingData&);
195 
196  //- Overridable function to handle the particle hitting a wallPatch
197  void hitWallPatch(Cloud<findCellParticle>&, trackingData&);
198 
199 
200  // Ostream Operator
201 
202  friend Ostream& operator<<(Ostream&, const findCellParticle&);
203 };
204 
205 
206 template<>
207 inline bool contiguous<findCellParticle>()
208 {
209  return true;
210 }
211 
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 } // End namespace Foam
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 #endif
220 
221 // ************************************************************************* //
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
Database for solution and other reduced data.
Definition: data.H:54
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.
findCellParticle(const polyMesh &mesh, const vector &position, const label celli, const vector &displacement, const label data)
Construct from a position and a cell, searching for the rest of the.
void hitWallPatch(Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a wallPatch.
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 &, const ensightPart &)