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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::findCellParticle
29
30Description
31 Particle class that finds cells by tracking
32
33SourceFiles
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
46namespace Foam
47{
48
49// Forward Declarations
50class findCellParticleCloud;
51class findCellParticle;
52
53Ostream& operator<<(Ostream&, const findCellParticle&);
54
55
56/*---------------------------------------------------------------------------*\
57 Class findCellParticle Declaration
58\*---------------------------------------------------------------------------*/
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
76public:
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
93 (
97 )
98 :
100 cellToData_(cellToData),
101 cellToEnd_(cellToEnd)
102 {}
103
104
105 // Member functions
108 {
109 return cellToData_;
110 }
113 {
114 return cellToEnd_;
115 }
116 };
117
118
119 // Constructors
120
121 //- Construct from components
123 (
124 const polyMesh& mesh,
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
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:
167 iNew(const polyMesh& mesh)
168 :
169 mesh_(mesh)
170 {}
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
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
246 (
248 trackingData&,
249 const vector&
250 );
251
252 //- Overridable function to handle the particle hitting a cyclicACMI
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
270 friend Ostream& operator<<(Ostream&, const findCellParticle&);
271};
272
273
274// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
275
276//- Contiguous data for findCellParticle
277template<> struct is_contiguous<findCellParticle> : std::true_type {};
278
279
280// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
281
282} // End namespace Foam
283
284// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
285
286#endif
287
288// ************************************************************************* //
Base cloud calls templated on particle type.
Definition: Cloud.H:68
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A cloud is a registry collection of lagrangian particles.
Definition: cloud.H:60
Database for solution data, solver performance and other reduced data.
Definition: data.H:58
Factory class to read-construct particles used for.
iNew(const polyMesh &mesh)
autoPtr< findCellParticle > operator()(Istream &is) const
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.
bool hitPatch(Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a patch.
point & start()
Point to track from.
autoPtr< particle > clone() const
Construct and return a clone.
void hitWallPatch(Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a wallPatch.
void hitProcessorPatch(Cloud< findCellParticle > &, trackingData &)
const point & start() const
Point to track from.
friend Ostream & operator<<(Ostream &, const findCellParticle &)
void hitSymmetryPatch(Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a.
void hitCyclicACMIPatch(Cloud< findCellParticle > &, trackingData &, const vector &)
Overridable function to handle the particle hitting a cyclicACMI.
void hitSymmetryPlanePatch(Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a.
bool move(Cloud< findCellParticle > &, trackingData &, const scalar)
Track all particles to their end point.
const point & end() const
Point to track to.
void hitWedgePatch(Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a wedge.
void hitCyclicAMIPatch(Cloud< findCellParticle > &, trackingData &, const vector &)
Overridable function to handle the particle hitting a cyclicAMI.
void hitCyclicPatch(Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a cyclic.
label data() const
Transported label.
point & end()
Point to track to.
label & data()
Transported label.
Base particle class.
Definition: particle.H:79
vector position() const
Return current particle position.
Definition: particleI.H:314
static void readFields(TrackCloudType &c)
Read the fields associated with the owner cloud.
const polyMesh & mesh() const noexcept
Return the mesh database.
Definition: particleI.H:137
const barycentric & coordinates() const noexcept
Return current particle coordinates.
Definition: particleI.H:143
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
Namespace for OpenFOAM.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:78