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-2019 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  wallPoint.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef wallPoint_H
38 #define wallPoint_H
39 
40 #include "point.H"
41 #include "label.H"
42 #include "scalar.H"
43 #include "tensor.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 // Forward declaration of classes
51 class polyPatch;
52 class polyMesh;
53 class wallPoint;
54 
55 // Forward declaration of friend functions and operators
56 Ostream& operator<<(Ostream&, const wallPoint&);
57 Istream& operator>>(Istream&, wallPoint&);
58 
59 
60 /*---------------------------------------------------------------------------*\
61  Class wallPoint Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 class wallPoint
65 {
66  // Private Data
67 
68  //- Position of nearest wall center
69  point origin_;
70 
71  //- Normal distance (squared) from cellcenter to origin
72  scalar distSqr_;
73 
74 
75  // Private Member Functions
76 
77  //- Evaluate distance to point. Update distSqr, origin from whomever
78  // is nearer pt. Return true if w2 is closer to point,
79  // false otherwise.
80  template<class TrackingData>
81  inline bool update
82  (
83  const point&,
84  const wallPoint& w2,
85  const scalar tol,
86  TrackingData& td
87  );
88 
89 
90 public:
91 
92  // Constructors
93 
94  //- Construct null
95  inline wallPoint();
96 
97  //- Construct from origin, distance
98  inline wallPoint(const point& origin, const scalar distSqr);
99 
100 
101  // Member Functions
102 
103  // Access
104 
105  inline const point& origin() const;
106 
107  inline point& origin();
108 
109  inline scalar distSqr() const;
110 
111  inline scalar& distSqr();
112 
113 
114  // Needed by FaceCellWave
115 
116  //- Check whether origin has been changed at all or
117  // still contains original (invalid) value.
118  template<class TrackingData>
119  inline bool valid(TrackingData& td) const;
120 
121  //- Check for identical geometrical data. Used for cyclics checking.
122  template<class TrackingData>
123  inline bool sameGeometry
124  (
125  const polyMesh&,
126  const wallPoint&,
127  const scalar,
128  TrackingData& td
129  ) const;
130 
131  //- Convert any absolute coordinates into relative to (patch)face
132  // centre
133  template<class TrackingData>
134  inline void leaveDomain
135  (
136  const polyMesh&,
137  const polyPatch&,
138  const label patchFacei,
139  const point& faceCentre,
140  TrackingData& td
141  );
142 
143  //- Reverse of leaveDomain
144  template<class TrackingData>
145  inline void enterDomain
146  (
147  const polyMesh&,
148  const polyPatch&,
149  const label patchFacei,
150  const point& faceCentre,
151  TrackingData& td
152  );
153 
154  //- Apply rotation matrix to any coordinates
155  template<class TrackingData>
156  inline void transform
157  (
158  const polyMesh&,
159  const tensor&,
160  TrackingData& td
161  );
162 
163  //- Influence of neighbouring face.
164  template<class TrackingData>
165  inline bool updateCell
166  (
167  const polyMesh&,
168  const label thisCelli,
169  const label neighbourFacei,
170  const wallPoint& neighbourInfo,
171  const scalar tol,
172  TrackingData& td
173  );
174 
175  //- Influence of neighbouring cell.
176  template<class TrackingData>
177  inline bool updateFace
178  (
179  const polyMesh&,
180  const label thisFacei,
181  const label neighbourCelli,
182  const wallPoint& neighbourInfo,
183  const scalar tol,
184  TrackingData& td
185  );
186 
187  //- Influence of different value on same face.
188  template<class TrackingData>
189  inline bool updateFace
190  (
191  const polyMesh&,
192  const label thisFacei,
193  const wallPoint& neighbourInfo,
194  const scalar tol,
195  TrackingData& td
196  );
197 
198  //- Same (like operator==)
199  template<class TrackingData>
200  inline bool equal(const wallPoint&, TrackingData& td) const;
201 
202 
203  // Member Operators
204 
205  // Needed for List IO
206  inline bool operator==(const wallPoint&) const;
207  inline bool operator!=(const wallPoint&) const;
208 
209 
210  // IOstream Operators
211 
212  friend Ostream& operator<<(Ostream&, const wallPoint&);
213  friend Istream& operator>>(Istream&, wallPoint&);
214 };
215 
216 
217 //- Data associated with wallPoint type are contiguous
218 template<>
219 inline bool contiguous<wallPoint>()
220 {
221  return true;
222 }
223 
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 } // End namespace Foam
228 
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
230 
231 #include "wallPointI.H"
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 #endif
236 
237 // ************************************************************************* //
bool contiguous< wallPoint >()
Data associated with wallPoint type are contiguous.
Definition: wallPoint.H:218
void transform(const polyMesh &, const tensor &, TrackingData &td)
Apply rotation matrix to any coordinates.
Definition: wallPointI.H:178
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
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
#define w2
Definition: blockCreate.C:32
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
Definition: wallPointI.H:192
bool sameGeometry(const polyMesh &, const wallPoint &, const scalar, TrackingData &td) const
Check for identical geometrical data. Used for cyclics checking.
Definition: wallPointI.H:135
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:164
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
Definition: wallPointI.H:126
friend Ostream & operator<<(Ostream &, const wallPoint &)
bool operator!=(const wallPoint &) const
Definition: wallPointI.H:291
bool operator==(const wallPoint &) const
Definition: wallPointI.H:285
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:208
Istream & operator>>(Istream &, directionInfo &)
wallPoint()
Construct null.
Definition: wallPointI.H:85
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
friend Istream & operator>>(Istream &, wallPoint &)
Holds information regarding nearest wall point. Used in wall distance calculation.
Definition: wallPoint.H:63
bool equal(const wallPoint &, TrackingData &td) const
Same (like operator==)
Definition: wallPointI.H:274
const point & origin() const
Definition: wallPointI.H:101
scalar distSqr() const
Definition: wallPointI.H:113
Ostream & operator<<(Ostream &, const ensightPart &)
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
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:231
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
Namespace for OpenFOAM.