externalPointEdgePoint.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 | Copyright (C) 2013-2016 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  //- Construct as copy
127 
128 
129  // Member Functions
130 
131  // Access
132 
133  inline const point& origin() const;
134 
135  inline scalar distSqr() const;
136 
137 
138  // Needed by PointEdgeWave
139 
140  //- Check whether origin has been changed at all or
141  // still contains original (invalid) value.
142  template<class TrackingData>
143  inline bool valid(TrackingData& td) const;
144 
145  //- Check for identical geometrical data. Used for cyclics checking.
146  template<class TrackingData>
147  inline bool sameGeometry
148  (
149  const externalPointEdgePoint&,
150  const scalar tol,
151  TrackingData& td
152  ) const;
153 
154  //- Convert origin to relative vector to leaving point
155  // (= point coordinate)
156  template<class TrackingData>
157  inline void leaveDomain
158  (
159  const polyPatch& patch,
160  const label patchPointi,
161  const point& pos,
162  TrackingData& td
163  );
164 
165  //- Convert relative origin to absolute by adding entering point
166  template<class TrackingData>
167  inline void enterDomain
168  (
169  const polyPatch& patch,
170  const label patchPointi,
171  const point& pos,
172  TrackingData& td
173  );
174 
175  //- Apply rotation matrix to origin
176  template<class TrackingData>
177  inline void transform
178  (
179  const tensor& rotTensor,
180  TrackingData& td
181  );
182 
183  //- Influence of edge on point
184  template<class TrackingData>
185  inline bool updatePoint
186  (
187  const polyMesh& mesh,
188  const label pointi,
189  const label edgeI,
190  const externalPointEdgePoint& edgeInfo,
191  const scalar tol,
192  TrackingData& td
193  );
194 
195  //- Influence of different value on same point.
196  // Merge new and old info.
197  template<class TrackingData>
198  inline bool updatePoint
199  (
200  const polyMesh& mesh,
201  const label pointi,
202  const externalPointEdgePoint& newPointInfo,
203  const scalar tol,
204  TrackingData& td
205  );
206 
207  //- Influence of different value on same point.
208  // No information about current position whatsoever.
209  template<class TrackingData>
210  inline bool updatePoint
211  (
212  const externalPointEdgePoint& newPointInfo,
213  const scalar tol,
214  TrackingData& td
215  );
216 
217  //- Influence of point on edge.
218  template<class TrackingData>
219  inline bool updateEdge
220  (
221  const polyMesh& mesh,
222  const label edgeI,
223  const label pointi,
224  const externalPointEdgePoint& pointInfo,
225  const scalar tol,
226  TrackingData& td
227  );
228 
229  //- Equivalent to operator== with TrackingData
230  template<class TrackingData>
231  inline bool equal
232  (
233  const externalPointEdgePoint&,
234  TrackingData& td
235  ) const;
236 
237 
238  // Member Operators
239 
240  // Needed for List IO
241  inline bool operator==(const externalPointEdgePoint&) const;
242  inline bool operator!=(const externalPointEdgePoint&) const;
243 
244 
245  // IOstream Operators
246 
249 };
250 
251 
252 //- Data associated with externalPointEdgePoint type are contiguous
253 template<>
255 {
256  return true;
257 }
258 
259 
260 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
261 
262 } // End namespace Foam
263 
264 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265 
266 #include "externalPointEdgePointI.H"
267 
268 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
269 
270 #endif
271 
272 // ************************************************************************* //
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:53
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.