pointEdgePoint.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2022 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::pointEdgePoint
26 
27 Description
28  Holds information regarding nearest wall point. Used in PointEdgeWave.
29  (so not standard FaceCellWave)
30  To be used in wall distance calculation.
31 
32 SourceFiles
33  pointEdgePointI.H
34  pointEdgePoint.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef pointEdgePoint_H
39 #define pointEdgePoint_H
40 
41 #include "point.H"
42 #include "label.H"
43 #include "scalar.H"
44 #include "tensor.H"
45 #include "pTraits.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 // Forward declaration of classes
53 class polyPatch;
54 class polyMesh;
55 class transformer;
56 
57 
58 // Forward declaration of friend functions and operators
59 
60 class pointEdgePoint;
61 
62 Istream& operator>>(Istream&, pointEdgePoint&);
63 Ostream& operator<<(Ostream&, const pointEdgePoint&);
64 
65 
66 /*---------------------------------------------------------------------------*\
67  Class pointEdgePoint Declaration
68 \*---------------------------------------------------------------------------*/
69 
70 class pointEdgePoint
71 {
72  // Private Data
73 
74  //- Position of nearest wall center
75  point origin_;
76 
77  //- Normal distance (squared) from point to origin
78  scalar distSqr_;
79 
80 
81  // Private Member Functions
82 
83  //- Evaluate distance to point. Update distSqr, origin from whomever
84  // is nearer pt. Return true if w2 is closer to point,
85  // false otherwise.
86  template<class TrackingData>
87  inline bool update
88  (
89  const point&,
90  const pointEdgePoint& w2,
91  const scalar tol,
92  TrackingData& td
93  );
94 
95  //- Combine current with w2. Update distSqr, origin if w2 has smaller
96  // quantities and returns true.
97  template<class TrackingData>
98  inline bool update
99  (
100  const pointEdgePoint& w2,
101  const scalar tol,
102  TrackingData& td
103  );
104 
105 
106 public:
107 
108  // Constructors
109 
110  //- Construct null
111  inline pointEdgePoint();
112 
113  //- Construct from origin, distance
114  inline pointEdgePoint(const point&, const scalar);
115 
116 
117  // Member Functions
118 
119  // Access
120 
121  inline const point& origin() const;
122 
123  inline scalar distSqr() const;
124 
125 
126  // Needed by PointEdgeWave
127 
128  //- Check whether origin has been changed at all or
129  // still contains original (invalid) value.
130  template<class TrackingData>
131  inline bool valid(TrackingData& td) const;
132 
133  //- Check for identical geometrical data. Used for cyclics checking.
134  template<class TrackingData>
135  inline bool sameGeometry
136  (
137  const pointEdgePoint&,
138  const scalar tol,
139  TrackingData& td
140  ) const;
141 
142  //- Transform across an interface
143  template<class TrackingData>
144  inline void transform
145  (
146  const polyPatch& patch,
147  const label patchFacei,
148  const transformer& transform,
149  TrackingData& td
150  );
151 
152  //- Influence of edge on point
153  template<class TrackingData>
154  inline bool updatePoint
155  (
156  const polyMesh& mesh,
157  const label pointi,
158  const label edgeI,
159  const pointEdgePoint& edgeInfo,
160  const scalar tol,
161  TrackingData& td
162  );
163 
164  //- Influence of different value on same point.
165  // Merge new and old info.
166  template<class TrackingData>
167  inline bool updatePoint
168  (
169  const polyMesh& mesh,
170  const label pointi,
171  const pointEdgePoint& newPointInfo,
172  const scalar tol,
173  TrackingData& td
174  );
175 
176  //- Influence of different value on same point.
177  // No information about current position whatsoever.
178  template<class TrackingData>
179  inline bool updatePoint
180  (
181  const pointEdgePoint& newPointInfo,
182  const scalar tol,
183  TrackingData& td
184  );
185 
186  //- Influence of point on edge.
187  template<class TrackingData>
188  inline bool updateEdge
189  (
190  const polyMesh& mesh,
191  const label edgeI,
192  const label pointi,
193  const pointEdgePoint& pointInfo,
194  const scalar tol,
195  TrackingData& td
196  );
197 
198  //- Same (like operator==)
199  template<class TrackingData>
200  inline bool equal(const pointEdgePoint&, TrackingData& td) const;
201 
202 
203  // Member Operators
204 
205  // Needed for List IO
206  inline bool operator==(const pointEdgePoint&) const;
207  inline bool operator!=(const pointEdgePoint&) const;
208 
209 
210  // IOstream Operators
211 
212  friend Ostream& operator<<(Ostream&, const pointEdgePoint&);
214 };
215 
216 
217 //- Data associated with pointEdgePoint type are contiguous
218 template<>
219 inline bool contiguous<pointEdgePoint>()
220 {
221  return true;
222 }
223 
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 } // End namespace Foam
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 #include "pointEdgePointI.H"
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 #endif
236 
237 // ************************************************************************* //
void transform(const polyPatch &patch, const label patchFacei, const transformer &transform, TrackingData &td)
Transform across an interface.
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space...
Definition: transformer.H:83
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
pointEdgePoint()
Construct null.
#define w2
Definition: blockCreate.C:32
const point & origin() const
fvMesh & mesh
bool contiguous< pointEdgePoint >()
Data associated with pointEdgePoint type are contiguous.
scalar distSqr() const
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.
Istream & operator>>(Istream &, directionInfo &)
bool sameGeometry(const pointEdgePoint &, const scalar tol, TrackingData &td) const
Check for identical geometrical data. Used for cyclics checking.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
friend Istream & operator>>(Istream &, pointEdgePoint &)
Ostream & operator<<(Ostream &, const ensightPart &)
bool equal(const pointEdgePoint &, TrackingData &td) const
Same (like operator==)
friend Ostream & operator<<(Ostream &, const pointEdgePoint &)
bool operator!=(const pointEdgePoint &) const
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:76
Holds information regarding nearest wall point. Used in PointEdgeWave. (so not standard FaceCellWave)...
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
bool operator==(const pointEdgePoint &) const
Namespace for OpenFOAM.