externalPointEdgePoint.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) 2013-2019 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::externalPointEdgePoint
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  externalPointEdgePointI.H
34  externalPointEdgePoint.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef externalPointEdgePoint_H
39 #define externalPointEdgePoint_H
40 
41 #include "pointField.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 // Forward declaration of classes
49 class polyPatch;
50 class polyMesh;
51 
52 
53 // Forward declaration of friend functions and operators
54 
55 class externalPointEdgePoint;
56 
57 Istream& operator>>(Istream&, externalPointEdgePoint&);
58 Ostream& operator<<(Ostream&, const externalPointEdgePoint&);
59 
60 
61 /*---------------------------------------------------------------------------*\
62  Class externalPointEdgePoint Declaration
63 \*---------------------------------------------------------------------------*/
64 
66 {
67  // Private Data
68 
69  //- Position of nearest wall center
70  point origin_;
71 
72  //- Normal distance (squared) from point to origin
73  scalar distSqr_;
74 
75 
76  // Private Member Functions
77 
78  //- Evaluate distance to point. Update distSqr, origin from whomever
79  // is nearer pt. Return true if w2 is closer to point,
80  // false otherwise.
81  template<class TrackingData>
82  inline bool update
83  (
84  const point&,
86  const scalar tol,
87  TrackingData& td
88  );
89 
90  //- Combine current with w2. Update distSqr, origin if w2 has smaller
91  // quantities and returns true.
92  template<class TrackingData>
93  inline bool update
94  (
95  const externalPointEdgePoint& w2,
96  const scalar tol,
97  TrackingData& td
98  );
99 
100 
101 public:
102 
103  //- Class used to pass data into container
104  class trackingData
105  {
106  public:
107  const pointField& points_;
110  :
111  points_(points)
112  {}
113  };
114 
115 
116 
117  // Constructors
118 
119  //- Construct null
120  inline externalPointEdgePoint();
121 
122  //- Construct from origin, distance
123  inline externalPointEdgePoint(const point&, const scalar);
124 
125 
126  // Member Functions
127 
128  // Access
129 
130  inline const point& origin() const;
131 
132  inline scalar distSqr() const;
133 
134 
135  // Needed by PointEdgeWave
136 
137  //- Check whether origin has been changed at all or
138  // still contains original (invalid) value.
139  template<class TrackingData>
140  inline bool valid(TrackingData& td) const;
141 
142  //- Check for identical geometrical data. Used for cyclics checking.
143  template<class TrackingData>
144  inline bool sameGeometry
145  (
146  const externalPointEdgePoint&,
147  const scalar tol,
148  TrackingData& td
149  ) const;
150 
151  //- Convert origin to relative vector to leaving point
152  // (= point coordinate)
153  template<class TrackingData>
154  inline void leaveDomain
155  (
156  const polyPatch& patch,
157  const label patchPointi,
158  const point& pos,
159  TrackingData& td
160  );
161 
162  //- Convert relative origin to absolute by adding entering point
163  template<class TrackingData>
164  inline void enterDomain
165  (
166  const polyPatch& patch,
167  const label patchPointi,
168  const point& pos,
169  TrackingData& td
170  );
171 
172  //- Apply rotation matrix to origin
173  template<class TrackingData>
174  inline void transform
175  (
176  const tensor& rotTensor,
177  TrackingData& td
178  );
179 
180  //- Influence of edge on point
181  template<class TrackingData>
182  inline bool updatePoint
183  (
184  const polyMesh& mesh,
185  const label pointi,
186  const label edgeI,
187  const externalPointEdgePoint& edgeInfo,
188  const scalar tol,
189  TrackingData& td
190  );
191 
192  //- Influence of different value on same point.
193  // Merge new and old info.
194  template<class TrackingData>
195  inline bool updatePoint
196  (
197  const polyMesh& mesh,
198  const label pointi,
199  const externalPointEdgePoint& newPointInfo,
200  const scalar tol,
201  TrackingData& td
202  );
203 
204  //- Influence of different value on same point.
205  // No information about current position whatsoever.
206  template<class TrackingData>
207  inline bool updatePoint
208  (
209  const externalPointEdgePoint& newPointInfo,
210  const scalar tol,
211  TrackingData& td
212  );
213 
214  //- Influence of point on edge.
215  template<class TrackingData>
216  inline bool updateEdge
217  (
218  const polyMesh& mesh,
219  const label edgeI,
220  const label pointi,
221  const externalPointEdgePoint& pointInfo,
222  const scalar tol,
223  TrackingData& td
224  );
225 
226  //- Equivalent to operator== with TrackingData
227  template<class TrackingData>
228  inline bool equal
229  (
230  const externalPointEdgePoint&,
231  TrackingData& td
232  ) const;
233 
234 
235  // Member Operators
236 
237  // Needed for List IO
238  inline bool operator==(const externalPointEdgePoint&) const;
239  inline bool operator!=(const externalPointEdgePoint&) const;
240 
241 
242  // IOstream Operators
243 
246 };
247 
248 
249 //- Data associated with externalPointEdgePoint type are contiguous
250 template<>
252 {
253  return true;
254 }
255 
256 
257 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
258 
259 } // End namespace Foam
260 
261 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
262 
263 #include "externalPointEdgePointI.H"
264 
265 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
266 
267 #endif
268 
269 // ************************************************************************* //
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
bool updatePoint(const polyMesh &mesh, const label pointi, const label edgeI, const externalPointEdgePoint &edgeInfo, const scalar tol, TrackingData &td)
Influence of edge on point.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
#define w2
Definition: blockCreate.C:32
friend Istream & operator>>(Istream &, externalPointEdgePoint &)
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
dimensionedScalar pos(const dimensionedScalar &ds)
Holds information regarding nearest wall point. Used in PointEdgeWave. (so not standard FaceCellWave)...
dynamicFvMesh & mesh
const pointField & points
Istream & operator>>(Istream &, directionInfo &)
void transform(const tensor &rotTensor, TrackingData &td)
Apply rotation matrix to origin.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
bool operator!=(const externalPointEdgePoint &) const
friend Ostream & operator<<(Ostream &, const externalPointEdgePoint &)
bool sameGeometry(const externalPointEdgePoint &, const scalar tol, TrackingData &td) const
Check for identical geometrical data. Used for cyclics checking.
Class used to pass data into container.
Ostream & operator<<(Ostream &, const ensightPart &)
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
bool equal(const externalPointEdgePoint &, TrackingData &td) const
Equivalent to operator== with TrackingData.
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
void leaveDomain(const polyPatch &patch, const label patchPointi, const point &pos, TrackingData &td)
Convert origin to relative vector to leaving point.
bool contiguous< externalPointEdgePoint >()
Data associated with externalPointEdgePoint type are contiguous.
Namespace for OpenFOAM.
bool operator==(const externalPointEdgePoint &) const
bool updateEdge(const polyMesh &mesh, const label edgeI, const label pointi, const externalPointEdgePoint &pointInfo, const scalar tol, TrackingData &td)
Influence of point on edge.
void enterDomain(const polyPatch &patch, const label patchPointi, const point &pos, TrackingData &td)
Convert relative origin to absolute by adding entering point.