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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2013-2016 OpenFOAM Foundation
9 Copyright (C) 2019-2020 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::externalPointEdgePoint
29
30Description
31 Holds information regarding nearest wall point. Used in PointEdgeWave.
32 (so not standard FaceCellWave)
33 To be used in wall distance calculation.
34
35SourceFiles
36 externalPointEdgePointI.H
37 externalPointEdgePoint.C
38
39\*---------------------------------------------------------------------------*/
40
41#ifndef externalPointEdgePoint_H
42#define externalPointEdgePoint_H
43
44#include "pointField.H"
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48namespace Foam
49{
50
51// Forward Declarations
52class polyPatch;
53class polyMesh;
54class externalPointEdgePoint;
55
56Istream& operator>>(Istream&, externalPointEdgePoint&);
57Ostream& operator<<(Ostream&, const externalPointEdgePoint&);
58
59/*---------------------------------------------------------------------------*\
60 Class externalPointEdgePoint Declaration
61\*---------------------------------------------------------------------------*/
64{
65 // Private Data
66
67 //- Position of nearest wall center
68 point origin_;
69
70 //- Normal distance (squared) from point to origin
71 scalar distSqr_;
72
73
74 // Private Member Functions
75
76 //- Evaluate distance to point.
77 // Update distSqr, origin from whomever is nearer pt.
78 // \return true if w2 is closer to point, false otherwise.
79 template<class TrackingData>
80 inline bool update
81 (
82 const point&,
84 const scalar tol,
85 TrackingData& td
86 );
87
88 //- Combine current with w2.
89 // Update distSqr, origin if w2 has smaller quantities and return true
90 template<class TrackingData>
91 inline bool update
92 (
94 const scalar tol,
95 TrackingData& td
96 );
97
98
99public:
100
101 //- Class used to pass data into container
102 class trackingData
103 {
104 public:
106 const pointField& points_;
109 :
111 {}
112 };
113
114
115 // Constructors
116
117 //- Default construct
118 inline externalPointEdgePoint();
119
120 //- Construct from origin, distance
121 inline externalPointEdgePoint(const point&, const scalar);
122
123
124 // Member Functions
125
126 // Access
128 const point& origin() const
129 {
130 return origin_;
131 }
133 scalar distSqr() const
134 {
135 return distSqr_;
136 }
137
138
139 // Needed by PointEdgeWave
140
141 //- Changed or contains original (invalid) value
142 template<class TrackingData>
143 inline bool valid(TrackingData& td) const;
144
145 //- Check for identical geometrical data (eg, cyclics checking)
146 template<class TrackingData>
147 inline bool sameGeometry
148 (
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 //- Test for equality, with TrackingData
230 template<class TrackingData>
231 inline bool equal
232 (
234 TrackingData& td
235 ) const;
236
237
238 // Member Operators
239
240 //- Test for equality
241 inline bool operator==(const externalPointEdgePoint&) const;
242
243 //- Test for inequality
244 inline bool operator!=(const externalPointEdgePoint&) const;
245
246
247 // IOstream Operators
251};
252
253
254// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
255
256//- Contiguous data for externalPointEdgePoint
257template<> struct is_contiguous<externalPointEdgePoint> : std::true_type {};
258
259
260// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
261
262} // End namespace Foam
263
264// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265
267
268// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
269
270#endif
271
272// ************************************************************************* //
#define w2
Definition: blockCreate.C:35
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Class used to pass data into container.
Holds information regarding nearest wall point. Used in PointEdgeWave. (so not standard FaceCellWave)...
externalPointEdgePoint()
Default construct.
bool equal(const externalPointEdgePoint &, TrackingData &td) const
Test for equality, with TrackingData.
bool sameGeometry(const externalPointEdgePoint &, const scalar tol, TrackingData &td) const
Check for identical geometrical data (eg, cyclics checking)
bool operator!=(const externalPointEdgePoint &) const
Test for inequality.
bool updatePoint(const polyMesh &mesh, const label pointi, const label edgeI, const externalPointEdgePoint &edgeInfo, const scalar tol, TrackingData &td)
Influence of edge on point.
bool updateEdge(const polyMesh &mesh, const label edgeI, const label pointi, const externalPointEdgePoint &pointInfo, const scalar tol, TrackingData &td)
Influence of point on edge.
friend Istream & operator>>(Istream &, externalPointEdgePoint &)
void leaveDomain(const polyPatch &patch, const label patchPointi, const point &pos, TrackingData &td)
void transform(const tensor &rotTensor, TrackingData &td)
Apply rotation matrix to origin.
void enterDomain(const polyPatch &patch, const label patchPointi, const point &pos, TrackingData &td)
Convert relative origin to absolute by adding entering point.
bool valid(TrackingData &td) const
Changed or contains original (invalid) value.
friend Ostream & operator<<(Ostream &, const externalPointEdgePoint &)
bool operator==(const externalPointEdgePoint &) const
Test for equality.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:75
mesh update()
dynamicFvMesh & mesh
const pointField & points
Namespace for OpenFOAM.
dimensionedScalar pos(const dimensionedScalar &ds)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Istream & operator>>(Istream &, directionInfo &)
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:78