findCellParticle.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2013-2017 OpenFOAM Foundation
9  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::findCellParticle
29 
30 Description
31  Particle class that finds cells by tracking
32 
33 SourceFiles
34  findCellParticle.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef findCellParticle_H
39 #define findCellParticle_H
40 
41 #include "particle.H"
42 #include "autoPtr.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // Forward Declarations
50 class findCellParticleCloud;
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  //- Start point to track from
67  point start_;
68 
69  //- End point to track to
70  point end_;
71 
72  //- Passive data
73  label data_;
74 
75 
76 public:
77 
78  friend class Cloud<findCellParticle>;
79 
80  //- Class used to pass tracking data to the trackToFace function
81  class trackingData
82  :
84  {
85  labelListList& cellToData_;
86  List<List<point>>& cellToEnd_;
87 
88  public:
89 
90  // Constructors
91 
93  (
97  )
98  :
100  cellToData_(cellToData),
101  cellToEnd_(cellToEnd)
102  {}
103 
104 
105  // Member functions
106 
108  {
109  return cellToData_;
110  }
111 
113  {
114  return cellToEnd_;
115  }
116  };
117 
118 
119  // Constructors
120 
121  //- Construct from components
123  (
124  const polyMesh& mesh,
125  const barycentric& coordinates,
126  const label celli,
127  const label tetFacei,
128  const label tetPti,
129  const point& end,
130  const label data
131  );
132 
133  //- Construct from a position and a cell, searching for the rest of the
134  // required topology
136  (
137  const polyMesh& mesh,
138  const vector& position,
139  const label celli,
140  const point& end,
141  const label data
142  );
143 
144  //- Construct from Istream
146  (
147  const polyMesh& mesh,
148  Istream& is,
149  bool readFields = true,
150  bool newFormat = true
151  );
152 
153  //- Construct and return a clone
154  autoPtr<particle> clone() const
155  {
156  return autoPtr<particle>(new findCellParticle(*this));
157  }
158 
159  //- Factory class to read-construct particles used for
160  // parallel transfer
161  class iNew
162  {
163  const polyMesh& mesh_;
164 
165  public:
166 
167  iNew(const polyMesh& mesh)
168  :
169  mesh_(mesh)
170  {}
171 
173  {
175  (
176  new findCellParticle(mesh_, is, true)
177  );
178  }
179  };
180 
181 
182  // Member Functions
183 
184  //- Point to track from
185  const point& start() const
186  {
187  return start_;
188  }
189 
190  //- Point to track from
191  point& start()
192  {
193  return start_;
194  }
195 
196  //- Point to track to
197  const point& end() const
198  {
199  return end_;
200  }
201 
202  //- Point to track to
203  point& end()
204  {
205  return end_;
206  }
207 
208  //- Transported label
209  label data() const
210  {
211  return data_;
212  }
213 
214  //- Transported label
215  label& data()
216  {
217  return data_;
218  }
219 
220 
221  // Tracking
222 
223  //- Track all particles to their end point
224  bool move(Cloud<findCellParticle>&, trackingData&, const scalar);
225 
226  //- Overridable function to handle the particle hitting a patch
227  // Executed before other patch-hitting functions
228  bool hitPatch(Cloud<findCellParticle>&, trackingData&);
229 
230  //- Overridable function to handle the particle hitting a wedge
231  void hitWedgePatch(Cloud<findCellParticle>&, trackingData&);
232 
233  //- Overridable function to handle the particle hitting a
234  // symmetry plane
235  void hitSymmetryPlanePatch(Cloud<findCellParticle>&, trackingData&);
236 
237  //- Overridable function to handle the particle hitting a
238  // symmetry patch
239  void hitSymmetryPatch(Cloud<findCellParticle>&, trackingData&);
240 
241  //- Overridable function to handle the particle hitting a cyclic
242  void hitCyclicPatch(Cloud<findCellParticle>&, trackingData&);
243 
244  //- Overridable function to handle the particle hitting a cyclicAMI
245  void hitCyclicAMIPatch
246  (
248  trackingData&,
249  const vector&
250  );
251 
252  //- Overridable function to handle the particle hitting a cyclicACMI
253  void hitCyclicACMIPatch
254  (
256  trackingData&,
257  const vector&
258  );
259 
260  //- Overridable function to handle the particle hitting a
261  //- processorPatch
262  void hitProcessorPatch(Cloud<findCellParticle>&, trackingData&);
263 
264  //- Overridable function to handle the particle hitting a wallPatch
265  void hitWallPatch(Cloud<findCellParticle>&, trackingData&);
266 
267 
268  // Ostream Operator
269 
270  friend Ostream& operator<<(Ostream&, const findCellParticle&);
271 };
272 
273 
274 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
275 
276 //- Contiguous data for findCellParticle
277 template<> struct is_contiguous<findCellParticle> : std::true_type {};
278 
279 
280 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
281 
282 } // End namespace Foam
283 
284 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
285 
286 #endif
287 
288 // ************************************************************************* //
Foam::findCellParticle::iNew
Factory class to read-construct particles used for.
Definition: findCellParticle.H:160
Foam::findCellParticle::hitProcessorPatch
void hitProcessorPatch(Cloud< findCellParticle > &, trackingData &)
Definition: findCellParticle.C:216
Foam::findCellParticle::trackingData::cellToEnd
List< List< point > > & cellToEnd()
Definition: findCellParticle.H:111
Foam::particle::readFields
static void readFields(TrackCloudType &c)
Read the fields associated with the owner cloud.
Definition: particleTemplates.C:140
Foam::findCellParticle::start
point & start()
Point to track from.
Definition: findCellParticle.H:190
Foam::findCellParticle::hitSymmetryPatch
void hitSymmetryPatch(Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a.
Definition: findCellParticle.C:170
Foam::findCellParticle::data
label & data()
Transported label.
Definition: findCellParticle.H:214
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::findCellParticle::iNew::operator()
autoPtr< findCellParticle > operator()(Istream &is) const
Definition: findCellParticle.H:171
Foam::particle::coordinates
const barycentric & coordinates() const
Return current particle coordinates.
Definition: particleI.H:143
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::findCellParticle::operator<<
friend Ostream & operator<<(Ostream &, const findCellParticle &)
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::findCellParticle::move
bool move(Cloud< findCellParticle > &, trackingData &, const scalar)
Track all particles to their end point.
Definition: findCellParticle.C:111
Foam::findCellParticle::iNew::iNew
iNew(const polyMesh &mesh)
Definition: findCellParticle.H:166
Foam::findCellParticle::trackingData::trackingData
trackingData(Cloud< findCellParticle > &cloud, labelListList &cellToData, List< List< point >> &cellToEnd)
Definition: findCellParticle.H:92
Foam::particle::position
vector position() const
Return current particle position.
Definition: particleI.H:314
Foam::Barycentric< scalar >
Foam::particle::mesh
const polyMesh & mesh() const
Return the mesh database.
Definition: particleI.H:137
Foam::findCellParticle::trackingData::cellToData
labelListList & cellToData()
Definition: findCellParticle.H:106
Foam::findCellParticle::hitWallPatch
void hitWallPatch(Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a wallPatch.
Definition: findCellParticle.C:227
Foam::findCellParticle::findCellParticle
findCellParticle(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPti, const point &end, const label data)
Construct from components.
Definition: findCellParticle.C:34
Foam::findCellParticle
Particle class that finds cells by tracking.
Definition: findCellParticle.H:59
Foam::findCellParticle::hitCyclicAMIPatch
void hitCyclicAMIPatch(Cloud< findCellParticle > &, trackingData &, const vector &)
Overridable function to handle the particle hitting a cyclicAMI.
Definition: findCellParticle.C:192
Foam::findCellParticle::hitSymmetryPlanePatch
void hitSymmetryPlanePatch(Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a.
Definition: findCellParticle.C:159
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::findCellParticle::hitCyclicPatch
void hitCyclicPatch(Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a cyclic.
Definition: findCellParticle.C:181
Foam::findCellParticle::hitWedgePatch
void hitWedgePatch(Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a wedge.
Definition: findCellParticle.C:148
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::cloud
A cloud is a registry collection of lagrangian particles.
Definition: cloud.H:57
Foam::Vector< scalar >
Foam::List< labelList >
Foam::particle
Base particle class.
Definition: particle.H:76
Foam::Cloud
Base cloud calls templated on particle type.
Definition: Cloud.H:55
particle.H
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::findCellParticle::end
point & end()
Point to track to.
Definition: findCellParticle.H:202
Foam::findCellParticle::hitCyclicACMIPatch
void hitCyclicACMIPatch(Cloud< findCellParticle > &, trackingData &, const vector &)
Overridable function to handle the particle hitting a cyclicACMI.
Definition: findCellParticle.C:204
Foam::particle::trackingData
Definition: particle.H:95
Foam::findCellParticle::end
const point & end() const
Point to track to.
Definition: findCellParticle.H:196
Foam::findCellParticle::clone
autoPtr< particle > clone() const
Construct and return a clone.
Definition: findCellParticle.H:153
Foam::data
Database for solution data, solver performance and other reduced data.
Definition: data.H:55
Foam::findCellParticle::data
label data() const
Transported label.
Definition: findCellParticle.H:208
Foam::findCellParticle::hitPatch
bool hitPatch(Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a patch.
Definition: findCellParticle.C:141
Foam::is_contiguous
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:75
Foam::findCellParticle::trackingData
Class used to pass tracking data to the trackToFace function.
Definition: findCellParticle.H:80
Foam::findCellParticle::start
const point & start() const
Point to track from.
Definition: findCellParticle.H:184
autoPtr.H