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-2023 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 
96 public:
97 
98  // Constructors
99 
100  //- Construct null
101  inline pointEdgePoint();
102 
103  //- Construct from origin, distance
104  inline pointEdgePoint(const point&, const scalar);
105 
106 
107  // Member Functions
108 
109  // Access
110 
111  inline const point& origin() const;
112 
113  inline scalar distSqr() const;
114 
115 
116  // Needed by PointEdgeWave
117 
118  //- Check whether origin has been changed at all or
119  // still contains original (invalid) value.
120  template<class TrackingData>
121  inline bool valid(TrackingData& td) const;
122 
123  //- Transform across an interface
124  template<class TrackingData>
125  inline void transform
126  (
127  const polyPatch& patch,
128  const label patchFacei,
129  const transformer& transform,
130  TrackingData& td
131  );
132 
133  //- Influence of edge on point
134  template<class TrackingData>
135  inline bool updatePoint
136  (
137  const polyMesh& mesh,
138  const label pointi,
139  const label edgeI,
140  const pointEdgePoint& edgeInfo,
141  const scalar tol,
142  TrackingData& td
143  );
144 
145  //- Influence of different value on same point.
146  // Merge new and old info.
147  template<class TrackingData>
148  inline bool updatePoint
149  (
150  const polyMesh& mesh,
151  const label pointi,
152  const pointEdgePoint& newPointInfo,
153  const scalar tol,
154  TrackingData& td
155  );
156 
157  //- Influence of point on edge.
158  template<class TrackingData>
159  inline bool updateEdge
160  (
161  const polyMesh& mesh,
162  const label edgeI,
163  const label pointi,
164  const pointEdgePoint& pointInfo,
165  const scalar tol,
166  TrackingData& td
167  );
168 
169  //- Same (like operator==)
170  template<class TrackingData>
171  inline bool equal(const pointEdgePoint&, TrackingData& td) const;
172 
173 
174  // Member Operators
175 
176  // Needed for List IO
177  inline bool operator==(const pointEdgePoint&) const;
178  inline bool operator!=(const pointEdgePoint&) const;
179 
180 
181  // IOstream Operators
182 
183  inline friend Ostream& operator<<(Ostream&, const pointEdgePoint&);
184  inline friend Istream& operator>>(Istream&, pointEdgePoint&);
185 };
186 
187 
188 //- Data associated with pointEdgePoint type are contiguous
189 template<>
190 inline bool contiguous<pointEdgePoint>()
191 {
192  return true;
193 }
194 
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 } // End namespace Foam
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 #include "pointEdgePointI.H"
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #endif
207 
208 // ************************************************************************* //
#define w2
Definition: blockCreate.C:32
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Holds information regarding nearest wall point. Used in PointEdgeWave. (so not standard FaceCellWave)...
friend Ostream & operator<<(Ostream &, const pointEdgePoint &)
scalar distSqr() const
bool equal(const pointEdgePoint &, TrackingData &td) const
Same (like operator==)
pointEdgePoint()
Construct null.
bool operator==(const pointEdgePoint &) const
bool operator!=(const pointEdgePoint &) const
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
bool updatePoint(const polyMesh &mesh, const label pointi, const label edgeI, const pointEdgePoint &edgeInfo, const scalar tol, TrackingData &td)
Influence of edge on point.
friend Istream & operator>>(Istream &, pointEdgePoint &)
bool updateEdge(const polyMesh &mesh, const label edgeI, const label pointi, const pointEdgePoint &pointInfo, const scalar tol, TrackingData &td)
Influence of point on edge.
const point & origin() const
void transform(const polyPatch &patch, const label patchFacei, const transformer &transform, TrackingData &td)
Transform across an interface.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:70
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space.
Definition: transformer.H:84
Namespace for OpenFOAM.
bool contiguous< pointEdgePoint >()
Data associated with pointEdgePoint type are contiguous.
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
Istream & operator>>(Istream &, pistonPointEdgeData &)
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)