wallPoint.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::wallPoint
26 
27 Description
28  Holds information regarding nearest wall point. Used in wall distance
29  calculation.
30 
31 SourceFiles
32  wallPointI.H
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef wallPoint_H
37 #define wallPoint_H
38 
39 #include "pointField.H"
40 #include "face.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 // Forward declaration of classes
48 class transformer;
49 
50 // Forward declaration of friend functions and operators
51 class wallPoint;
52 Ostream& operator<<(Ostream&, const wallPoint&);
53 Istream& operator>>(Istream&, wallPoint&);
54 
55 /*---------------------------------------------------------------------------*\
56  Class wallPoint Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 class wallPoint
60 {
61  // Private Data
62 
63  //- Position of nearest wall center
64  point origin_;
65 
66  //- Normal distance (squared) from cellcenter to origin
67  scalar distSqr_;
68 
69 
70 protected:
71 
72  // Protected Member Functions
73 
74  //- Evaluate distance to point. Update distSqr, origin from whomever
75  // is nearer pt. Return true if w2 is closer to point, false
76  // otherwise.
77  template<class TrackingData>
78  inline bool update
79  (
80  const point&,
81  const wallPoint& w2,
82  const scalar tol,
83  TrackingData& td
84  );
85 
86 
87 public:
88 
89  // Constructors
90 
91  //- Construct null
92  inline wallPoint();
93 
94  //- Construct from origin, distance
95  inline wallPoint(const point& origin, const scalar distSqr);
96 
97  //- Construct from face, distance
98  inline wallPoint
99  (
100  const face& f,
101  const pointField& ps,
102  const point& centre,
103  const scalar distSqr
104  );
105 
106 
107  // Member Functions
108 
109  // Access
110 
111  inline const point& origin() const;
112 
113  inline point& origin();
114 
115  inline scalar distSqr() const;
116 
117  inline scalar& distSqr();
118 
119  template<class TrackingData>
120  inline scalar dist(TrackingData& td) const;
121 
122 
123  // Needed by FaceCellWave
124 
125  //- Check whether origin has been changed at all or
126  // still contains original (invalid) value.
127  template<class TrackingData>
128  inline bool valid(TrackingData& td) const;
129 
130  //- Check for identical geometrical data. Used for cyclics checking.
131  template<class TrackingData>
132  inline bool sameGeometry
133  (
134  const wallPoint&,
135  const scalar,
136  TrackingData& td
137  ) const;
138 
139  //- Transform across an interface
140  template<class TrackingData>
141  inline void transform
142  (
143  const transformer& transform,
144  TrackingData& td
145  );
146 
147  //- Same (like operator==)
148  template<class TrackingData>
149  inline bool equal
150  (
151  const wallPoint&,
152  TrackingData& td
153  ) const;
154 
155 
156  // Member Operators
157 
158  inline bool operator==(const wallPoint&) const;
159  inline bool operator!=(const wallPoint&) const;
160 
161 
162  // IOstream Operators
163 
164  inline friend Ostream& operator<<(Ostream&, const wallPoint&);
165  inline friend Istream& operator>>(Istream&, wallPoint&);
166 };
167 
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 } // End namespace Foam
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 #include "wallPointI.H"
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 #endif
180 
181 // ************************************************************************* //
#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
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:76
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space.
Definition: transformer.H:84
Holds information regarding nearest wall point. Used in wall distance calculation.
Definition: wallPoint.H:59
bool operator!=(const wallPoint &) const
Definition: wallPointI.H:192
scalar dist(TrackingData &td) const
void transform(const transformer &transform, TrackingData &td)
Transform across an interface.
Definition: wallPointI.H:159
bool operator==(const wallPoint &) const
Definition: wallPointI.H:183
scalar distSqr() const
Definition: wallPointI.H:115
friend Ostream & operator<<(Ostream &, const wallPoint &)
bool equal(const wallPoint &, TrackingData &td) const
Same (like operator==)
Definition: wallPointI.H:171
wallPoint()
Construct null.
Definition: wallPointI.H:70
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
Definition: wallPointI.H:135
friend Istream & operator>>(Istream &, wallPoint &)
bool sameGeometry(const wallPoint &, const scalar, TrackingData &td) const
Check for identical geometrical data. Used for cyclics checking.
Definition: wallPointI.H:143
const point & origin() const
Definition: wallPointI.H:103
bool update(const point &, const wallPoint &w2, const scalar tol, TrackingData &td)
Evaluate distance to point. Update distSqr, origin from whomever.
Definition: wallPointI.H:34
Namespace for OpenFOAM.
Istream & operator>>(Istream &, pistonPointEdgeData &)
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)
labelList f(nPoints)