pointEdgePoint.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) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2019-2022 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::pointEdgePoint
29 
30 Description
31  Holds information regarding nearest wall point. Used in PointEdgeWave.
32  (so not standard FaceCellWave)
33  To be used in wall distance calculation.
34 
35 SourceFiles
36  pointEdgePointI.H
37  pointEdgePoint.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef Foam_pointEdgePoint_H
42 #define Foam_pointEdgePoint_H
43 
44 #include "point.H"
45 #include "label.H"
46 #include "scalar.H"
47 #include "tensor.H"
48 #include "pTraits.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 // Forward Declarations
56 class polyPatch;
57 class polyMesh;
58 class pointEdgePoint;
59 
60 Istream& operator>>(Istream&, pointEdgePoint&);
61 Ostream& operator<<(Ostream&, const pointEdgePoint&);
62 
63 /*---------------------------------------------------------------------------*\
64  Class pointEdgePoint Declaration
65 \*---------------------------------------------------------------------------*/
66 
67 class pointEdgePoint
68 {
69  // Private Data
70 
71  //- Position of nearest wall center
72  point origin_;
73 
74  //- Normal distance (squared) from point to origin
75  scalar distSqr_;
76 
77 
78  // Private Member Functions
79 
80  //- Evaluate distance to point.
81  // Update distSqr, origin from whomever is nearer pt.
82  // \return true if w2 is closer to point, false otherwise.
83  template<class TrackingData>
84  inline bool update
85  (
86  const point&,
87  const pointEdgePoint& w2,
88  const scalar tol,
89  TrackingData& td
90  );
91 
92  //- Combine current with w2. Update distSqr, origin if w2 has smaller
93  // quantities and returns true.
94  template<class TrackingData>
95  inline bool update
96  (
97  const pointEdgePoint& w2,
98  const scalar tol,
99  TrackingData& td
100  );
101 
102 
103 public:
104 
105  // Constructors
106 
107  //- Default construct. Max point
108  inline pointEdgePoint();
109 
110  //- Construct from origin, distance
111  inline pointEdgePoint(const point& origin, const scalar distSqr);
112 
113 
114  // Member Functions
115 
116  // Access
117 
118  const point& origin() const noexcept { return origin_; }
119 
120  point& origin() noexcept { return origin_; }
121 
122  scalar distSqr() const noexcept { return distSqr_; }
123 
124  scalar& distSqr() noexcept { return distSqr_; }
125 
126 
127  // Member Operators
128 
129  //- Test for equality
130  inline bool operator==(const pointEdgePoint&) const;
132  //- Test for inequality
133  inline bool operator!=(const pointEdgePoint&) const;
134 
135 
136  // IOstream Operators
137 
138  friend Ostream& operator<<(Ostream&, const pointEdgePoint&);
140 
141 
142  // Wave Methods
143 
144  // Needed by PointEdgeWave
145 
146  //- Changed or contains original (invalid) value
147  template<class TrackingData>
148  inline bool valid(TrackingData& td) const;
149 
150  //- Check for identical geometrical data (eg, cyclics checking)
151  template<class TrackingData>
152  inline bool sameGeometry
153  (
154  const pointEdgePoint&,
155  const scalar tol,
156  TrackingData& td
157  ) const;
158 
159  //- Convert origin to relative vector to leaving point
160  // (= point coordinate)
161  template<class TrackingData>
162  inline void leaveDomain
163  (
164  const polyPatch& patch,
165  const label patchPointi,
166  const point& pos,
167  TrackingData& td
168  );
169 
170  //- Convert relative origin to absolute by adding entering point
171  template<class TrackingData>
172  inline void enterDomain
173  (
174  const polyPatch& patch,
175  const label patchPointi,
176  const point& pos,
177  TrackingData& td
178  );
179 
180  //- Apply rotation matrix to origin
181  template<class TrackingData>
182  inline void transform
183  (
184  const tensor& rotTensor,
185  TrackingData& td
186  );
187 
188  //- Influence of edge on point
189  template<class TrackingData>
190  inline bool updatePoint
191  (
192  const polyMesh& mesh,
193  const label pointi,
194  const label edgeI,
195  const pointEdgePoint& edgeInfo,
196  const scalar tol,
197  TrackingData& td
198  );
199 
200  //- Influence of different value on same point.
201  // Merge new and old info.
202  template<class TrackingData>
203  inline bool updatePoint
204  (
205  const polyMesh& mesh,
206  const label pointi,
207  const pointEdgePoint& newPointInfo,
208  const scalar tol,
209  TrackingData& td
210  );
211 
212  //- Influence of different value on same point.
213  // No information about current position whatsoever.
214  template<class TrackingData>
215  inline bool updatePoint
216  (
217  const pointEdgePoint& newPointInfo,
218  const scalar tol,
219  TrackingData& td
220  );
221 
222  //- Influence of point on edge.
223  template<class TrackingData>
224  inline bool updateEdge
225  (
226  const polyMesh& mesh,
227  const label edgeI,
228  const label pointi,
229  const pointEdgePoint& pointInfo,
230  const scalar tol,
231  TrackingData& td
232  );
233 
234  //- Test for equality, with TrackingData
235  template<class TrackingData>
236  inline bool equal(const pointEdgePoint&, TrackingData& td) const;
237 };
238 
239 
240 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
241 
242 //- Contiguous data for pointEdgePoint
243 template<> struct is_contiguous<pointEdgePoint> : std::true_type {};
244 
245 //- Contiguous scalar data for pointEdgePoint
246 template<> struct is_contiguous_scalar<pointEdgePoint> : std::true_type {};
247 
248 
249 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250 
251 } // End namespace Foam
252 
253 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
254 
255 #include "pointEdgePointI.H"
256 
257 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
258 
259 #endif
260 
261 // ************************************************************************* //
void enterDomain(const polyPatch &patch, const label patchPointi, const point &pos, TrackingData &td)
Convert relative origin to absolute by adding entering point.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
pointEdgePoint()
Default construct. Max point.
#define w2
Definition: blockCreate.C:28
void transform(const tensor &rotTensor, TrackingData &td)
Apply rotation matrix to origin.
bool updateEdge(const polyMesh &mesh, const label edgeI, const label pointi, const pointEdgePoint &pointInfo, const scalar tol, TrackingData &td)
Influence of point on edge.
bool updatePoint(const polyMesh &mesh, const label pointi, const label edgeI, const pointEdgePoint &edgeInfo, const scalar tol, TrackingData &td)
Influence of edge on point.
const point & origin() const noexcept
dimensionedScalar pos(const dimensionedScalar &ds)
dynamicFvMesh & mesh
Istream & operator>>(Istream &, directionInfo &)
void leaveDomain(const polyPatch &patch, const label patchPointi, const point &pos, TrackingData &td)
Convert origin to relative vector to leaving point.
bool sameGeometry(const pointEdgePoint &, const scalar tol, TrackingData &td) const
Check for identical geometrical data (eg, cyclics checking)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:55
const direction noexcept
Definition: Scalar.H:258
friend Istream & operator>>(Istream &, pointEdgePoint &)
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
mesh update()
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:76
A template class to specify that a data type can be considered as being contiguous in memory...
Definition: contiguous.H:71
const std::string patch
OpenFOAM patch number as a std::string.
bool equal(const pointEdgePoint &, TrackingData &td) const
Test for equality, with TrackingData.
friend Ostream & operator<<(Ostream &, const pointEdgePoint &)
bool operator!=(const pointEdgePoint &) const
Test for inequality.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:73
Holds information regarding nearest wall point. Used in PointEdgeWave. (so not standard FaceCellWave)...
bool valid(TrackingData &td) const
Changed or contains original (invalid) value.
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:69
Tensor of scalars, i.e. Tensor<scalar>.
scalar distSqr() const noexcept
bool operator==(const pointEdgePoint &) const
Test for equality.
Namespace for OpenFOAM.