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-2022 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 polyPatch;
49 class polyMesh;
50 class transformer;
51 
52 // Forward declaration of friend functions and operators
53 template<class Derived>
54 class WallPointBase;
55 template<class Derived>
56 Ostream& operator<<(Ostream&, const WallPointBase<Derived>&);
57 template<class Derived>
59 
60 /*---------------------------------------------------------------------------*\
61  Class WallPointBase Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 template<class Derived>
65 class WallPointBase
66 {
67  // Private Data
68 
69  //- Position of nearest wall center
70  point origin_;
71 
72  //- Normal distance (squared) from cellcenter to origin
73  scalar distSqr_;
74 
75 
76 protected:
77 
78  // Protected Member Functions
79 
80  //- Evaluate distance to point. Update distSqr, origin from whomever
81  // is nearer pt. Return true if w2 is closer to point,
82  // false otherwise.
83  template<class TrackingData>
84  inline bool update
85  (
86  const point&,
88  const scalar tol,
89  TrackingData& td
90  );
91 
92 
93 public:
94 
95  // Constructors
96 
97  //- Construct null
98  inline WallPointBase();
99 
100  //- Construct from origin, distance
101  inline WallPointBase(const point& origin, const scalar distSqr);
102 
103  //- Construct from face, distance
104  inline WallPointBase
105  (
106  const face& f,
107  const pointField& ps,
108  const point& centre,
109  const scalar distSqr
110  );
111 
112 
113  // Member Functions
114 
115  // Access
116 
117  inline const point& origin() const;
118 
119  inline point& origin();
120 
121  inline scalar distSqr() const;
122 
123  inline scalar& distSqr();
124 
125  template<class TrackingData>
126  inline scalar dist(TrackingData& td) const;
127 
128 
129  // Needed by FaceCellWave
130 
131  //- Check whether origin has been changed at all or
132  // still contains original (invalid) value.
133  template<class TrackingData>
134  inline bool valid(TrackingData& td) const;
135 
136  //- Check for identical geometrical data. Used for cyclics checking.
137  template<class TrackingData>
138  inline bool sameGeometry
139  (
140  const polyMesh&,
141  const WallPointBase<Derived>&,
142  const scalar,
143  TrackingData& td
144  ) const;
145 
146  //- Transform across an interface
147  template<class TrackingData>
148  inline void transform
149  (
150  const polyPatch& patch,
151  const label patchFacei,
152  const transformer& transform,
153  TrackingData& td
154  );
155 
156  //- Influence of neighbouring face.
157  template<class TrackingData>
158  inline bool updateCell
159  (
160  const polyMesh&,
161  const label thisCelli,
162  const label neighbourFacei,
163  const WallPointBase<Derived>& neighbourInfo,
164  const scalar tol,
165  TrackingData& td
166  );
167 
168  //- Influence of neighbouring cell.
169  template<class TrackingData>
170  inline bool updateFace
171  (
172  const polyMesh&,
173  const label thisFacei,
174  const label neighbourCelli,
175  const WallPointBase<Derived>& neighbourInfo,
176  const scalar tol,
177  TrackingData& td
178  );
179 
180  //- Influence of different value on same face.
181  template<class TrackingData>
182  inline bool updateFace
183  (
184  const polyMesh&,
185  const label thisFacei,
186  const WallPointBase<Derived>& neighbourInfo,
187  const scalar tol,
188  TrackingData& td
189  );
190 
191  //- Same (like operator==)
192  template<class TrackingData>
193  inline bool equal
194  (
195  const WallPointBase<Derived>&,
196  TrackingData& td
197  ) const;
198 
199 
200  // Member Operators
201 
202  inline bool operator==(const WallPointBase<Derived>&) const;
203  inline bool operator!=(const WallPointBase<Derived>&) const;
204 
205 
206  // IOstream Operators
207 
208  friend Ostream& operator<< <Derived>
209  (
210  Ostream&,
212  );
213 
214  friend Istream& operator>> <Derived>
215  (
216  Istream&,
218  );
219 };
220 
221 
222 /*---------------------------------------------------------------------------*\
223  Class wallPoint Declaration
224 \*---------------------------------------------------------------------------*/
226 class wallPoint
227 :
228  public WallPointBase<wallPoint>
229 {
230  public:
231 
234  template<class Derived> using type = WallPointBase<Derived>;
235 };
236 
237 
238 //- Data associated with wallPoint type are contiguous
239 template<>
240 inline bool contiguous<wallPoint>()
241 {
242  return true;
243 }
244 
245 
246 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 
248 } // End namespace Foam
249 
250 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
251 
252 #include "wallPointI.H"
253 
254 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
255 
256 #endif
257 
258 // ************************************************************************* //
bool contiguous< wallPoint >()
Data associated with wallPoint type are contiguous.
Definition: wallPoint.H:239
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space...
Definition: transformer.H:83
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
bool operator==(const WallPointBase< Derived > &) const
Definition: wallPointI.H:281
#define w2
Definition: blockCreate.C:32
scalar distSqr() const
Definition: wallPointI.H:123
scalar dist(TrackingData &td) const
bool equal(const WallPointBase< Derived > &, TrackingData &td) const
Same (like operator==)
Definition: wallPointI.H:268
Istream & operator>>(Istream &, directionInfo &)
bool sameGeometry(const polyMesh &, const WallPointBase< Derived > &, const scalar, TrackingData &td) const
Check for identical geometrical data. Used for cyclics checking.
Definition: wallPointI.H:155
const point & origin() const
Definition: wallPointI.H:109
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
Definition: wallPointI.H:146
WallPointBase()
Construct null.
Definition: wallPointI.H:73
void transform(const polyPatch &patch, const label patchFacei, const transformer &transform, TrackingData &td)
Transform across an interface.
Definition: wallPointI.H:185
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
labelList f(nPoints)
Holds information regarding nearest wall point. Used in wall distance calculation.
Definition: wallPoint.H:225
bool update(const point &, const WallPointBase< Derived > &w2, const scalar tol, TrackingData &td)
Evaluate distance to point. Update distSqr, origin from whomever.
Definition: wallPointI.H:36
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:76
bool operator!=(const WallPointBase< Derived > &) const
Definition: wallPointI.H:291
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
bool updateFace(const polyMesh &, const label thisFacei, const label neighbourCelli, const WallPointBase< Derived > &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
Definition: wallPointI.H:223
bool updateCell(const polyMesh &, const label thisCelli, const label neighbourFacei, const WallPointBase< Derived > &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
Definition: wallPointI.H:200
Namespace for OpenFOAM.