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 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. Update distSqr, origin from whomever
80  // is nearer pt. Return true if w2 is closer to point,
81  // 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  //- Construct null
97  inline wallPoint();
98 
99  //- Construct from origin, distance
100  inline wallPoint(const point& origin, const scalar distSqr);
101 
102  //- Construct as copy
103  inline wallPoint(const wallPoint&);
104 
105 
106  // Member Functions
107 
108  // Access
109 
110  inline const point& origin() const;
111 
112  inline point& origin();
113 
114  inline scalar distSqr() const;
115 
116  inline scalar& distSqr();
117 
118 
119  // Needed by FaceCellWave
120 
121  //- Check whether origin has been changed at all or
122  // still contains original (invalid) value.
123  template<class TrackingData>
124  inline bool valid(TrackingData& td) const;
125 
126  //- Check for identical geometrical data. Used for cyclics checking.
127  template<class TrackingData>
128  inline bool sameGeometry
129  (
130  const polyMesh&,
131  const wallPoint&,
132  const scalar,
133  TrackingData& td
134  ) const;
135 
136  //- Convert any absolute coordinates into relative to (patch)face
137  // centre
138  template<class TrackingData>
139  inline void leaveDomain
140  (
141  const polyMesh&,
142  const polyPatch&,
143  const label patchFacei,
144  const point& faceCentre,
145  TrackingData& td
146  );
147 
148  //- Reverse of leaveDomain
149  template<class TrackingData>
150  inline void enterDomain
151  (
152  const polyMesh&,
153  const polyPatch&,
154  const label patchFacei,
155  const point& faceCentre,
156  TrackingData& td
157  );
158 
159  //- Apply rotation matrix to any coordinates
160  template<class TrackingData>
161  inline void transform
162  (
163  const polyMesh&,
164  const tensor&,
165  TrackingData& td
166  );
167 
168  //- Influence of neighbouring face.
169  template<class TrackingData>
170  inline bool updateCell
171  (
172  const polyMesh&,
173  const label thisCelli,
174  const label neighbourFacei,
175  const wallPoint& neighbourInfo,
176  const scalar tol,
177  TrackingData& td
178  );
179 
180  //- Influence of neighbouring cell.
181  template<class TrackingData>
182  inline bool updateFace
183  (
184  const polyMesh&,
185  const label thisFacei,
186  const label neighbourCelli,
187  const wallPoint& neighbourInfo,
188  const scalar tol,
189  TrackingData& td
190  );
191 
192  //- Influence of different value on same face.
193  template<class TrackingData>
194  inline bool updateFace
195  (
196  const polyMesh&,
197  const label thisFacei,
198  const wallPoint& neighbourInfo,
199  const scalar tol,
200  TrackingData& td
201  );
202 
203  //- Same (like operator==)
204  template<class TrackingData>
205  inline bool equal(const wallPoint&, TrackingData& td) const;
206 
207 
208  // Member Operators
209 
210  // Needed for List IO
211  inline bool operator==(const wallPoint&) const;
212  inline bool operator!=(const wallPoint&) const;
213 
214 
215  // IOstream Operators
216 
217  friend Ostream& operator<<(Ostream&, const wallPoint&);
218  friend Istream& operator>>(Istream&, wallPoint&);
219 };
220 
221 
222 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
223 
224 //- Contiguous data for wallPoint
225 template<> struct is_contiguous<wallPoint> : std::true_type {};
226 
227 //- Contiguous scalar data for wallPoint
228 template<> struct is_contiguous_scalar<wallPoint> : std::true_type {};
229 
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 } // End namespace Foam
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 #include "wallPointI.H"
238 
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240 
241 #endif
242 
243 // ************************************************************************* //
Foam::wallPoint::sameGeometry
bool sameGeometry(const polyMesh &, const wallPoint &, const scalar, TrackingData &td) const
Check for identical geometrical data. Used for cyclics checking.
Definition: wallPointI.H:144
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
Check whether origin has been changed at all or.
Definition: wallPointI.H:135
Foam::wallPoint::operator!=
bool operator!=(const wallPoint &) const
Definition: wallPointI.H:300
Foam::wallPoint::operator==
bool operator==(const wallPoint &) const
Definition: wallPointI.H:294
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:240
wallPointI.H
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:228
Foam::wallPoint::wallPoint
wallPoint()
Construct null.
Definition: wallPointI.H:87
tensor.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::label
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:62
Foam::wallPoint::enterDomain
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
Definition: wallPointI.H:201
Foam::wallPoint::distSqr
scalar distSqr() const
Definition: wallPointI.H:122
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:66
Foam::wallPoint::leaveDomain
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Convert any absolute coordinates into relative to (patch)face.
Definition: wallPointI.H:173
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:217
scalar.H
w2
#define w2
Definition: blockCreate.C:35
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::wallPoint::origin
const point & origin() const
Definition: wallPointI.H:110
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
Same (like operator==)
Definition: wallPointI.H:283
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::wallPoint::transform
void transform(const polyMesh &, const tensor &, TrackingData &td)
Apply rotation matrix to any coordinates.
Definition: wallPointI.H:187
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &)
Definition: boundaryPatch.C:102
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 &)