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-2015 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  Class findCellParticle Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 class findCellParticle
53 :
54  public particle
55 {
56  // Private data
57 
58  //- End point to track to
59  point end_;
60 
61  //- Passive data
62  label data_;
63 
64 
65 public:
66 
67  friend class Cloud<findCellParticle>;
68 
69  //- Class used to pass tracking data to the trackToFace function
70  class trackingData
71  :
72  public particle::TrackingData<Cloud<findCellParticle> >
73  {
76 
77  public:
78 
79  // Constructors
80 
82  (
86  )
87  :
91  {}
92 
93 
94  // Member functions
95 
97  {
98  return cellToData_;
99  }
100 
102  {
103  return cellToEnd_;
104  }
105  };
106 
107 
108  // Constructors
109 
110  //- Construct from components
112  (
113  const polyMesh& mesh,
114  const vector& position,
115  const label cellI,
116  const label tetFaceI,
117  const label tetPtI,
118  const point& end,
119  const label data
120  );
121 
122  //- Construct from Istream
124  (
125  const polyMesh& mesh,
126  Istream& is,
127  bool readFields = true
128  );
129 
130  //- Construct and return a clone
131  autoPtr<particle> clone() const
132  {
133  return autoPtr<particle>(new findCellParticle(*this));
134  }
135 
136  //- Factory class to read-construct particles used for
137  // parallel transfer
138  class iNew
139  {
140  const polyMesh& mesh_;
141 
142  public:
143 
144  iNew(const polyMesh& mesh)
145  :
146  mesh_(mesh)
147  {}
148 
150  {
152  (
153  new findCellParticle(mesh_, is, true)
154  );
155  }
156  };
157 
158 
159  // Member Functions
160 
161  //- Point to track to
162  const point& end() const
163  {
164  return end_;
165  }
166 
167  //- Transported label
168  label data() const
169  {
170  return data_;
171  }
172 
173 
174  // Tracking
175 
176  //- Track all particles to their end point
177  bool move(trackingData&, const scalar);
178 
179 
180  //- Overridable function to handle the particle hitting a patch
181  // Executed before other patch-hitting functions
182  bool hitPatch
183  (
184  const polyPatch&,
185  trackingData& td,
186  const label patchI,
187  const scalar trackFraction,
188  const tetIndices& tetIs
189  );
190 
191  //- Overridable function to handle the particle hitting a wedge
192  void hitWedgePatch
193  (
194  const wedgePolyPatch&,
195  trackingData& td
196  );
197 
198  //- Overridable function to handle the particle hitting a
199  // symmetry plane
201  (
202  const symmetryPlanePolyPatch&,
203  trackingData& td
204  );
205 
206  //- Overridable function to handle the particle hitting a
207  // symmetry patch
208  void hitSymmetryPatch
209  (
210  const symmetryPolyPatch&,
211  trackingData& td
212  );
213 
214  //- Overridable function to handle the particle hitting a cyclic
215  void hitCyclicPatch
216  (
217  const cyclicPolyPatch&,
218  trackingData& td
219  );
220 
221  //- Overridable function to handle the particle hitting a
222  //- processorPatch
223  void hitProcessorPatch
224  (
225  const processorPolyPatch&,
226  trackingData& td
227  );
228 
229  //- Overridable function to handle the particle hitting a wallPatch
230  void hitWallPatch
231  (
232  const wallPolyPatch&,
233  trackingData& td,
234  const tetIndices&
235  );
236 
237  //- Overridable function to handle the particle hitting a polyPatch
238  void hitPatch
239  (
240  const polyPatch&,
241  trackingData& td
242  );
243 
244 
245  // Ostream Operator
246 
247  friend Ostream& operator<<(Ostream&, const findCellParticle&);
248 };
249 
250 
251 template<>
252 inline bool contiguous<findCellParticle>()
253 {
254  return true;
255 }
256 
257 
258 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
259 
260 } // End namespace Foam
261 
262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263 
264 #endif
265 
266 // ************************************************************************* //
Foam::findCellParticle::hitWallPatch
void hitWallPatch(const wallPolyPatch &, trackingData &td, const tetIndices &)
Overridable function to handle the particle hitting a wallPatch.
Definition: findCellParticle.C:188
Foam::findCellParticle::iNew
Factory class to read-construct particles used for.
Definition: findCellParticle.H:137
Foam::wedgePolyPatch
Wedge front and back plane patch.
Definition: wedgePolyPatch.H:48
Foam::cyclicPolyPatch
Cyclic plane patch.
Definition: cyclicPolyPatch.H:63
Foam::findCellParticle::hitSymmetryPlanePatch
void hitSymmetryPlanePatch(const symmetryPlanePolyPatch &, trackingData &td)
Overridable function to handle the particle hitting a.
Definition: findCellParticle.C:144
Foam::findCellParticle::trackingData::cellToEnd
List< List< point > > & cellToEnd()
Definition: findCellParticle.H:100
Foam::particle::TrackingData< Cloud< findCellParticle > >::cloud
Cloud< findCellParticle > & cloud()
Return a reference to the cloud.
Definition: particle.H:125
Foam::findCellParticle::end_
point end_
End point to track to.
Definition: findCellParticle.H:58
Foam::findCellParticle::hitCyclicPatch
void hitCyclicPatch(const cyclicPolyPatch &, trackingData &td)
Overridable function to handle the particle hitting a cyclic.
Definition: findCellParticle.C:166
Foam::readFields
This function object reads fields from the time directories and adds them to the mesh database for fu...
Definition: readFields.H:104
Foam::findCellParticle::trackingData::cellToData_
labelListList & cellToData_
Definition: findCellParticle.H:73
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::findCellParticle::iNew::operator()
autoPtr< findCellParticle > operator()(Istream &is) const
Definition: findCellParticle.H:148
Foam::findCellParticle::trackingData::cellToEnd_
List< List< point > > & cellToEnd_
Definition: findCellParticle.H:74
Foam::label
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
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:57
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
Foam::findCellParticle::hitProcessorPatch
void hitProcessorPatch(const processorPolyPatch &, trackingData &td)
Definition: findCellParticle.C:177
Foam::symmetryPlanePolyPatch
Symmetry-plane patch.
Definition: symmetryPlanePolyPatch.H:48
Foam::findCellParticle::iNew::iNew
iNew(const polyMesh &mesh)
Definition: findCellParticle.H:143
Foam::symmetryPolyPatch
Symmetry patch for non-planar or multi-plane patches.
Definition: symmetryPolyPatch.H:51
Foam::processorPolyPatch
Neighbour processor patch.
Definition: processorPolyPatch.H:55
Foam::particle::mesh
const polyMesh & mesh() const
Return the mesh database.
Definition: particleI.H:580
Foam::findCellParticle::trackingData::cellToData
labelListList & cellToData()
Definition: findCellParticle.H:95
Foam::findCellParticle::trackingData::trackingData
trackingData(Cloud< findCellParticle > &cloud, labelListList &cellToData, List< List< point > > &cellToEnd)
Definition: findCellParticle.H:81
Foam::findCellParticle
Particle class that finds cells by tracking.
Definition: findCellParticle.H:51
Foam::wallPolyPatch
Foam::wallPolyPatch.
Definition: wallPolyPatch.H:48
Foam::findCellParticle::findCellParticle
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.
Definition: findCellParticle.C:31
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::findCellParticle::iNew::mesh_
const polyMesh & mesh_
Definition: findCellParticle.H:139
Foam::tetIndices
Storage and named access for the indices of a tet which is part of the decomposition of a cell.
Definition: tetIndices.H:73
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::cloud
A cloud is a collection of lagrangian particles.
Definition: cloud.H:51
Foam::findCellParticle::hitSymmetryPatch
void hitSymmetryPatch(const symmetryPolyPatch &, trackingData &td)
Overridable function to handle the particle hitting a.
Definition: findCellParticle.C:155
Foam::Vector< scalar >
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::particle
Base particle class.
Definition: particle.H:78
Foam::findCellParticle::data_
label data_
Passive data.
Definition: findCellParticle.H:61
Foam::contiguous< findCellParticle >
bool contiguous< findCellParticle >()
Definition: findCellParticle.H:251
Foam::Cloud
Base cloud calls templated on particle type.
Definition: Cloud.H:52
Foam::findCellParticle::hitPatch
bool hitPatch(const polyPatch &, trackingData &td, const label patchI, const scalar trackFraction, const tetIndices &tetIs)
Overridable function to handle the particle hitting a patch.
Definition: findCellParticle.C:120
Foam::particle::position
const vector & position() const
Return current particle position.
Definition: particleI.H:586
particle.H
Foam::findCellParticle::hitWedgePatch
void hitWedgePatch(const wedgePolyPatch &, trackingData &td)
Overridable function to handle the particle hitting a wedge.
Definition: findCellParticle.C:133
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::findCellParticle::move
bool move(trackingData &, const scalar)
Track all particles to their end point.
Definition: findCellParticle.C:85
Foam::findCellParticle::end
const point & end() const
Point to track to.
Definition: findCellParticle.H:161
Foam::particle::TrackingData
Definition: particle.H:94
Foam::findCellParticle::clone
autoPtr< particle > clone() const
Construct and return a clone.
Definition: findCellParticle.H:130
Foam::data
Database for solution data, solver performance and other reduced data.
Definition: data.H:52
Foam::findCellParticle::data
label data() const
Transported label.
Definition: findCellParticle.H:167
Foam::findCellParticle::trackingData
Class used to pass tracking data to the trackToFace function.
Definition: findCellParticle.H:69
autoPtr.H