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 | Copyright (C) 2013-2016 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  //- End point to track to
67  point end_;
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  :
80  public particle::TrackingData<Cloud<findCellParticle>>
81  {
82  labelListList& cellToData_;
83  List<List<point>>& cellToEnd_;
84 
85  public:
86 
87  // Constructors
88 
90  (
94  )
95  :
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 vector& position,
123  const label celli,
124  const label tetFacei,
125  const label tetPtI,
126  const point& end,
127  const label data
128  );
129 
130  //- Construct from Istream
132  (
133  const polyMesh& mesh,
134  Istream& is,
135  bool readFields = true
136  );
137 
138  //- Construct and return a clone
139  autoPtr<particle> clone() const
140  {
141  return autoPtr<particle>(new findCellParticle(*this));
142  }
143 
144  //- Factory class to read-construct particles used for
145  // parallel transfer
146  class iNew
147  {
148  const polyMesh& mesh_;
149 
150  public:
152  iNew(const polyMesh& mesh)
153  :
154  mesh_(mesh)
155  {}
157  autoPtr<findCellParticle> operator()(Istream& is) const
158  {
160  (
161  new findCellParticle(mesh_, is, true)
162  );
163  }
164  };
165 
166 
167  // Member Functions
168 
169  //- Point to track to
170  const point& end() const
171  {
172  return end_;
173  }
174 
175  //- Transported label
176  label data() const
177  {
178  return data_;
179  }
180 
181 
182  // Tracking
183 
184  //- Track all particles to their end point
185  bool move(trackingData&, const scalar);
186 
187 
188  //- Overridable function to handle the particle hitting a patch
189  // Executed before other patch-hitting functions
190  bool hitPatch
191  (
192  const polyPatch&,
193  trackingData& td,
194  const label patchi,
195  const scalar trackFraction,
196  const tetIndices& tetIs
197  );
198 
199  //- Overridable function to handle the particle hitting a wedge
200  void hitWedgePatch
201  (
202  const wedgePolyPatch&,
203  trackingData& td
204  );
205 
206  //- Overridable function to handle the particle hitting a
207  // symmetry plane
209  (
210  const symmetryPlanePolyPatch&,
211  trackingData& td
212  );
213 
214  //- Overridable function to handle the particle hitting a
215  // symmetry patch
216  void hitSymmetryPatch
217  (
218  const symmetryPolyPatch&,
219  trackingData& td
220  );
221 
222  //- Overridable function to handle the particle hitting a cyclic
223  void hitCyclicPatch
224  (
225  const cyclicPolyPatch&,
226  trackingData& td
227  );
228 
229  //- Overridable function to handle the particle hitting a
230  //- processorPatch
231  void hitProcessorPatch
232  (
233  const processorPolyPatch&,
234  trackingData& td
235  );
236 
237  //- Overridable function to handle the particle hitting a wallPatch
238  void hitWallPatch
239  (
240  const wallPolyPatch&,
241  trackingData& td,
242  const tetIndices&
243  );
244 
245  //- Overridable function to handle the particle hitting a polyPatch
246  void hitPatch
247  (
248  const polyPatch&,
249  trackingData& td
250  );
251 
252 
253  // Ostream Operator
254 
255  friend Ostream& operator<<(Ostream&, const findCellParticle&);
256 };
257 
258 
259 template<>
260 inline bool contiguous<findCellParticle>()
261 {
262  return true;
263 }
264 
265 
266 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
267 
268 } // End namespace Foam
269 
270 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
271 
272 #endif
273 
274 // ************************************************************************* //
Symmetry patch for non-planar or multi-plane patches.
void hitWedgePatch(const wedgePolyPatch &, trackingData &td)
Overridable function to handle the particle hitting a wedge.
friend Ostream & operator<<(Ostream &, const findCellParticle &)
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 hitSymmetryPatch(const symmetryPolyPatch &, trackingData &td)
Overridable function to handle the particle hitting a.
void hitCyclicPatch(const cyclicPolyPatch &, trackingData &td)
Overridable function to handle the particle hitting a cyclic.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
findCellParticle(const polyMesh &mesh, const vector &position, const label celli, const label tetFacei, const label tetPtI, const point &end, const label data)
Construct from components.
static void readFields(CloudType &c)
Read the fields associated with the owner cloud.
const point & end() const
Point to track to.
Base particle class.
Definition: particle.H:78
Neighbour processor patch.
label data() const
Transported label.
bool hitPatch(const polyPatch &, trackingData &td, const label patchi, const scalar trackFraction, const tetIndices &tetIs)
Overridable function to handle the particle hitting a patch.
const vector & position() const
Return current particle position.
Definition: particleI.H:586
Cyclic plane patch.
A cloud is a collection of lagrangian particles.
Definition: cloud.H:51
Foam::wallPolyPatch.
Definition: wallPolyPatch.H:48
const polyMesh & mesh_
Reference to the polyMesh database.
Definition: particle.H:137
Wedge front and back plane patch.
void hitProcessorPatch(const processorPolyPatch &, trackingData &td)
Storage and named access for the indices of a tet which is part of the decomposition of a cell...
Definition: tetIndices.H:81
void hitWallPatch(const wallPolyPatch &, trackingData &td, const tetIndices &)
Overridable function to handle the particle hitting a wallPatch.
Base cloud calls templated on particle type.
Definition: Cloud.H:52
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
Database for solution data, solver performance and other reduced data.
Definition: data.H:52
List< List< point > > & cellToEnd()
label patchi
Ostream & operator<<(Ostream &, const ensightPart &)
Particle class that finds cells by tracking.
const polyMesh & mesh() const
Return the mesh database.
Definition: particleI.H:580
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:53
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
void hitSymmetryPlanePatch(const symmetryPlanePolyPatch &, trackingData &td)
Overridable function to handle the particle hitting a.
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
Factory class to read-construct particles used for.
Class used to pass tracking data to the trackToFace function.
bool move(trackingData &, const scalar)
Track all particles to their end point.
trackingData(Cloud< findCellParticle > &cloud, labelListList &cellToData, List< List< point >> &cellToEnd)
autoPtr< particle > clone() const
Construct and return a clone.
Namespace for OpenFOAM.