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 | Copyright (C) 2011-2016 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  //- Construct as copy
101  inline wallPoint(const wallPoint&);
102 
103 
104  // Member Functions
105 
106  // Access
107 
108  inline const point& origin() const;
109 
110  inline point& origin();
111 
112  inline scalar distSqr() const;
113 
114  inline scalar& distSqr();
115 
116 
117  // Needed by FaceCellWave
118 
119  //- Check whether origin has been changed at all or
120  // still contains original (invalid) value.
121  template<class TrackingData>
122  inline bool valid(TrackingData& td) const;
123 
124  //- Check for identical geometrical data. Used for cyclics checking.
125  template<class TrackingData>
126  inline bool sameGeometry
127  (
128  const polyMesh&,
129  const wallPoint&,
130  const scalar,
131  TrackingData& td
132  ) const;
133 
134  //- Convert any absolute coordinates into relative to (patch)face
135  // centre
136  template<class TrackingData>
137  inline void leaveDomain
138  (
139  const polyMesh&,
140  const polyPatch&,
141  const label patchFacei,
142  const point& faceCentre,
143  TrackingData& td
144  );
145 
146  //- Reverse of leaveDomain
147  template<class TrackingData>
148  inline void enterDomain
149  (
150  const polyMesh&,
151  const polyPatch&,
152  const label patchFacei,
153  const point& faceCentre,
154  TrackingData& td
155  );
156 
157  //- Apply rotation matrix to any coordinates
158  template<class TrackingData>
159  inline void transform
160  (
161  const polyMesh&,
162  const tensor&,
163  TrackingData& td
164  );
165 
166  //- Influence of neighbouring face.
167  template<class TrackingData>
168  inline bool updateCell
169  (
170  const polyMesh&,
171  const label thisCelli,
172  const label neighbourFacei,
173  const wallPoint& neighbourInfo,
174  const scalar tol,
175  TrackingData& td
176  );
177 
178  //- Influence of neighbouring cell.
179  template<class TrackingData>
180  inline bool updateFace
181  (
182  const polyMesh&,
183  const label thisFacei,
184  const label neighbourCelli,
185  const wallPoint& neighbourInfo,
186  const scalar tol,
187  TrackingData& td
188  );
189 
190  //- Influence of different value on same face.
191  template<class TrackingData>
192  inline bool updateFace
193  (
194  const polyMesh&,
195  const label thisFacei,
196  const wallPoint& neighbourInfo,
197  const scalar tol,
198  TrackingData& td
199  );
200 
201  //- Same (like operator==)
202  template<class TrackingData>
203  inline bool equal(const wallPoint&, TrackingData& td) const;
204 
205 
206  // Member Operators
207 
208  // Needed for List IO
209  inline bool operator==(const wallPoint&) const;
210  inline bool operator!=(const wallPoint&) const;
211 
212 
213  // IOstream Operators
214 
215  friend Ostream& operator<<(Ostream&, const wallPoint&);
216  friend Istream& operator>>(Istream&, wallPoint&);
217 };
218 
219 
220 //- Data associated with wallPoint type are contiguous
221 template<>
222 inline bool contiguous<wallPoint>()
223 {
224  return true;
225 }
226 
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 } // End namespace Foam
231 
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 
234 #include "wallPointI.H"
235 
236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237 
238 #endif
239 
240 // ************************************************************************* //
bool operator!=(const wallPoint &) const
Definition: wallPointI.H:298
bool contiguous< wallPoint >()
Data associated with wallPoint type are contiguous.
Definition: wallPoint.H:221
void transform(const polyMesh &, const tensor &, TrackingData &td)
Apply rotation matrix to any coordinates.
Definition: wallPointI.H:185
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
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
Definition: wallPointI.H:133
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
Definition: wallPointI.H:199
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:171
bool sameGeometry(const polyMesh &, const wallPoint &, const scalar, TrackingData &td) const
Check for identical geometrical data. Used for cyclics checking.
Definition: wallPointI.H:142
friend Ostream & operator<<(Ostream &, const wallPoint &)
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:215
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:53
const point & origin() const
Definition: wallPointI.H:108
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:281
scalar distSqr() const
Definition: wallPointI.H:120
Ostream & operator<<(Ostream &, const ensightPart &)
bool operator==(const wallPoint &) const
Definition: wallPointI.H:292
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:238
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
Namespace for OpenFOAM.