Loading...
Searching...
No Matches
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-2024 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 Foam_findCellParticle_H
39#define Foam_findCellParticle_H
40
41#include "particle.H"
42#include "autoPtr.H"
43
44// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46namespace Foam
47{
48
49// Forward Declarations
50class findCellParticleCloud;
52
54
56/*---------------------------------------------------------------------------*\
57 Class findCellParticle Declaration
58\*---------------------------------------------------------------------------*/
59
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_;
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
91
93 (
97 )
98 :
100 cellToData_(cellToData),
101 cellToEnd_(cellToEnd)
102 {}
103
104
105 // Member Functions
106
107 labelListList& cellToData() noexcept { return cellToData_; }
108
109 List<List<point>>& cellToEnd() noexcept { return cellToEnd_; }
110 };
111
113 // Constructors
114
115 //- Construct from components
117 (
118 const polyMesh& mesh,
120 const label celli,
121 const label tetFacei,
122 const label tetPti,
123 const point& end,
124 const label data
125 );
126
127 //- Construct from a position and a cell,
128 //- searching for the rest of the required topology
130 (
131 const polyMesh& mesh,
132 const vector& position,
133 const label celli,
134 const point& end,
135 const label data
136 );
137
138 //- Construct from Istream
140 (
141 const polyMesh& mesh,
142 Istream& is,
143 bool readFields = true,
144 bool newFormat = true
145 );
146
147 //- Return a clone
148 virtual autoPtr<particle> clone() const
149 {
150 return particle::Clone(*this);
151 }
152
153 //- Factory class to read-construct particles (for parallel transfer)
154 class iNew
155 {
156 const polyMesh& mesh_;
157
158 public:
160 iNew(const polyMesh& mesh)
161 :
162 mesh_(mesh)
163 {}
164
166 {
168 (
169 new findCellParticle(mesh_, is, true)
170 );
171 }
172 };
174
175 // Member Functions
176
177 //- Point to track from
178 const point& start() const noexcept { return start_; }
179
180 //- Point to track from
181 point& start() noexcept { return start_; }
182
183 //- Point to track to
184 const point& end() const noexcept { return end_; }
185
186 //- Point to track to
187 point& end() noexcept { return end_; }
188
189 //- Transported label
190 label data() const noexcept { return data_; }
191
192 //- Transported label
193 label& data() noexcept { return data_; }
194
195
196 // Tracking
197
198 //- Track all particles to their end point
199 bool move(Cloud<findCellParticle>&, trackingData&, const scalar);
200
201 //- Overridable function to handle the particle hitting a patch
202 // Executed before other patch-hitting functions
204
205 //- Overridable function to handle the particle hitting a wedge
207
208 //- Overridable function to handle the particle hitting a
209 // symmetry plane
211
212 //- Overridable function to handle the particle hitting a
213 // symmetry patch
215
216 //- Overridable function to handle the particle hitting a cyclic
219 //- Overridable function to handle the particle hitting a cyclicAMI
221 (
224 const vector&
225 );
226
227 //- Overridable function to handle the particle hitting a cyclicACMI
229 (
232 const vector&
233 );
234
235 //- Overridable function to handle the particle hitting a
236 //- processorPatch
238
239 //- Overridable function to handle the particle hitting a wallPatch
241
242
243 // Ostream Operator
244
245 friend Ostream& operator<<(Ostream&, const findCellParticle&);
246};
247
248
249// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
250
251//- Contiguous data for findCellParticle
252template<> struct is_contiguous<findCellParticle> : std::true_type {};
253
254
255// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256
257} // End namespace Foam
258
259// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
260
261#endif
262
263// ************************************************************************* //
Base cloud calls templated on particle type.
Definition Cloud.H:64
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A cloud is a registry collection of lagrangian particles.
Definition cloud.H:56
Factory class to read-construct particles (for parallel transfer).
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)
labelListList & cellToData() noexcept
List< List< point > > & cellToEnd() noexcept
Particle class that finds cells by tracking.
bool hitPatch(Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a patch.
label & data() noexcept
Transported label.
void hitWallPatch(Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a wallPatch.
void hitProcessorPatch(Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a processorPatch.
friend Ostream & operator<<(Ostream &, const findCellParticle &)
virtual autoPtr< particle > clone() const
Return a clone.
void hitSymmetryPatch(Cloud< findCellParticle > &, trackingData &)
Overridable function to handle the particle hitting a.
const point & start() const noexcept
Point to track from.
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.
point & end() noexcept
Point to track to.
bool move(Cloud< findCellParticle > &, trackingData &, const scalar)
Track all particles to their end point.
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.
label data() const noexcept
Transported label.
const point & end() const noexcept
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.
point & start() noexcept
Point to track from.
vector position() const
Return current particle position.
Definition particleI.H:283
static void readFields(TrackCloudType &c)
Read the fields associated with the owner cloud.
static autoPtr< particle > Clone(const Derived &p)
Clone a particle.
Definition particle.H:552
const polyMesh & mesh() const noexcept
Return the mesh database.
Definition particleI.H:110
const barycentric & coordinates() const noexcept
Return current particle coordinates.
Definition particleI.H:116
particle(const polyMesh &mesh, const barycentric &coordinates, const label celli, const label tetFacei, const label tetPti)
Construct from components.
Definition particle.C:507
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
dynamicFvMesh & mesh
PtrList< coordinateSystem > coordinates(solidRegions.size())
Namespace for OpenFOAM.
void readFields(const typename GeoFieldType::Mesh &mesh, const IOobjectList &objects, const NameMatchPredicate &selectedFields, DynamicList< regIOobject * > &storedObjects)
Read the selected GeometricFields of the templated type and store on the objectRegistry.
List< labelList > labelListList
List of labelList.
Definition labelList.H:38
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
vector point
Point is a vector.
Definition point.H:37
const direction noexcept
Definition scalarImpl.H:265
Barycentric< scalar > barycentric
A scalar version of the templated Barycentric.
Definition barycentric.H:45
Vector< scalar > vector
Definition vector.H:57
A template class to specify that a data type can be considered as being contiguous in memory.
Definition contiguous.H:70