wallPoint.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) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2019-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::wallPoint
29 
30 Description
31  Holds information regarding nearest wall point. Used in wall distance
32  calculation.
33 
34 SourceFiles
35  wallPointI.H
36  wallPoint.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef wallPoint_H
41 #define wallPoint_H
42 
43 #include "point.H"
44 #include "label.H"
45 #include "scalar.H"
46 #include "tensor.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 // Forward Declarations
54 class polyPatch;
55 class polyMesh;
56 class wallPoint;
57 
58 Ostream& operator<<(Ostream&, const wallPoint&);
59 Istream& operator>>(Istream&, wallPoint&);
60 
61 
62 /*---------------------------------------------------------------------------*\
63  Class wallPoint Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 class wallPoint
67 {
68  // Private Data
69 
70  //- Position of nearest wall center
71  point origin_;
72 
73  //- Normal distance (squared) from cellcenter to origin
74  scalar distSqr_;
75 
76 
77  // Private Member Functions
78 
79  //- Evaluate distance to point.
80  // Update distSqr, origin from whomever is nearer pt.
81  // \return true if w2 is closer to point, false otherwise.
82  template<class TrackingData>
83  inline bool update
84  (
85  const point&,
86  const wallPoint& w2,
87  const scalar tol,
88  TrackingData& td
89  );
90 
91 
92 public:
93 
94  // Constructors
95 
96  //- Default construct
97  inline wallPoint();
98 
99  //- Construct from origin, distance-squared
100  inline wallPoint(const point& origin, const scalar distSqr);
101 
102 
103  // Member Functions
104 
105  // Access
106 
107  const point& origin() const
108  {
109  return origin_;
110  }
111  point& origin()
112  {
113  return origin_;
114  }
115 
116  scalar distSqr() const
117  {
118  return distSqr_;
119  }
120  scalar& distSqr()
121  {
122  return distSqr_;
123  }
124 
125 
126  // Needed by FaceCellWave
127 
128  //- Changed or contains original (invalid) value
129  template<class TrackingData>
130  inline bool valid(TrackingData& td) const;
131 
132  //- Check for identical geometrical data (eg, cyclics checking)
133  template<class TrackingData>
134  inline bool sameGeometry
135  (
136  const polyMesh&,
137  const wallPoint&,
138  const scalar,
139  TrackingData& td
140  ) const;
141 
142  //- Convert any absolute coordinates into relative to (patch)face
143  //- centre
144  template<class TrackingData>
145  inline void leaveDomain
146  (
147  const polyMesh&,
148  const polyPatch&,
149  const label patchFacei,
150  const point& faceCentre,
151  TrackingData& td
152  );
153 
154  //- Reverse of leaveDomain
155  template<class TrackingData>
156  inline void enterDomain
157  (
158  const polyMesh&,
159  const polyPatch&,
160  const label patchFacei,
161  const point& faceCentre,
162  TrackingData& td
163  );
164 
165  //- Apply rotation matrix to any coordinates
166  template<class TrackingData>
167  inline void transform
168  (
169  const polyMesh&,
170  const tensor&,
171  TrackingData& td
172  );
173 
174  //- Influence of neighbouring face.
175  template<class TrackingData>
176  inline bool updateCell
177  (
178  const polyMesh&,
179  const label thisCelli,
180  const label neighbourFacei,
181  const wallPoint& neighbourInfo,
182  const scalar tol,
183  TrackingData& td
184  );
185 
186  //- Influence of neighbouring cell.
187  template<class TrackingData>
188  inline bool updateFace
189  (
190  const polyMesh&,
191  const label thisFacei,
192  const label neighbourCelli,
193  const wallPoint& neighbourInfo,
194  const scalar tol,
195  TrackingData& td
196  );
197 
198  //- Influence of different value on same face.
199  template<class TrackingData>
200  inline bool updateFace
201  (
202  const polyMesh&,
203  const label thisFacei,
204  const wallPoint& neighbourInfo,
205  const scalar tol,
206  TrackingData& td
207  );
208 
209  //- Test for equality, with TrackingData
210  template<class TrackingData>
211  inline bool equal(const wallPoint&, TrackingData& td) const;
212 
213 
214  // Member Operators
215 
216  //- Test for equality
217  inline bool operator==(const wallPoint&) const;
218 
219  //- Test for inequality
220  inline bool operator!=(const wallPoint&) const;
221 
222 
223  // IOstream Operators
224 
225  friend Ostream& operator<<(Ostream&, const wallPoint&);
226  friend Istream& operator>>(Istream&, wallPoint&);
227 };
228 
229 
230 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
231 
232 //- Contiguous data for wallPoint
233 template<> struct is_contiguous<wallPoint> : std::true_type {};
234 
235 //- Contiguous scalar data for wallPoint
236 template<> struct is_contiguous_scalar<wallPoint> : std::true_type {};
237 
238 
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240 
241 } // End namespace Foam
242 
243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244 
245 #include "wallPointI.H"
246 
247 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
248 
249 #endif
250 
251 // ************************************************************************* //
Foam::wallPoint::sameGeometry
bool sameGeometry(const polyMesh &, const wallPoint &, const scalar, TrackingData &td) const
Check for identical geometrical data (eg, cyclics checking)
Definition: wallPointI.H:114
Foam::wallPoint
Holds information regarding nearest wall point. Used in wall distance calculation.
Definition: wallPoint.H:65
Foam::Tensor< scalar >
Foam::wallPoint::valid
bool valid(TrackingData &td) const
Changed or contains original (invalid) value.
Definition: wallPointI.H:105
Foam::wallPoint::operator!=
bool operator!=(const wallPoint &) const
Test for inequality.
Definition: wallPointI.H:275
Foam::wallPoint::operator==
bool operator==(const wallPoint &) const
Test for equality.
Definition: wallPointI.H:266
point.H
Foam::wallPoint::updateFace
bool updateFace(const polyMesh &, const label thisFacei, const label neighbourCelli, const wallPoint &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
Definition: wallPointI.H:210
Foam::wallPoint::distSqr
scalar & distSqr()
Definition: wallPoint.H:119
wallPointI.H
Foam::wallPoint::origin
const point & origin() const
Definition: wallPoint.H:106
Foam::wallPoint::distSqr
scalar distSqr() const
Definition: wallPoint.H:115
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:230
Foam::wallPoint::wallPoint
wallPoint()
Default construct.
Definition: wallPointI.H:88
tensor.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::wallPoint::enterDomain
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
Definition: wallPointI.H:171
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:68
Foam::wallPoint::leaveDomain
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Definition: wallPointI.H:143
Foam::wallPoint::updateCell
bool updateCell(const polyMesh &, const label thisCelli, const label neighbourFacei, const wallPoint &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
Definition: wallPointI.H:187
scalar.H
w2
#define w2
Definition: blockCreate.C:35
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::is_contiguous_scalar
A template class to specify if a data type is composed solely of Foam::scalar elements.
Definition: contiguous.H:91
Foam::wallPoint::operator<<
friend Ostream & operator<<(Ostream &, const wallPoint &)
Foam::Vector< scalar >
label.H
Foam::wallPoint::equal
bool equal(const wallPoint &, TrackingData &td) const
Test for equality, with TrackingData.
Definition: wallPointI.H:254
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::point
vector point
Point is a vector.
Definition: point.H:43
Foam::wallPoint::transform
void transform(const polyMesh &, const tensor &, TrackingData &td)
Apply rotation matrix to any coordinates.
Definition: wallPointI.H:157
Foam::tensor
Tensor< scalar > tensor
Tensor of scalars, i.e. Tensor<scalar>.
Definition: symmTensor.H:61
Foam::wallPoint::origin
point & origin()
Definition: wallPoint.H:110
Foam::is_contiguous
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:75
Foam::wallPoint::operator>>
friend Istream & operator>>(Istream &, wallPoint &)