FreeFOAM The Cross-Platform CFD Toolkit
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) 1991-2010 OpenCFD Ltd.
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 <OpenFOAM/point.H>
41 #include <OpenFOAM/label.H>
42 #include <OpenFOAM/scalar.H>
43 #include <OpenFOAM/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  // Private Member Functions
75 
76  //- Evaluate distance to point. Update distSqr, origin from whomever
77  // is nearer pt. Return true if w2 is closer to point,
78  // false otherwise.
79  inline bool update
80  (
81  const point&,
82  const wallPoint& w2,
83  const scalar tol
84  );
85 
86 
87 public:
88 
89  // Static data members
90 
91  //- initial point far away.
92  static point greatPoint;
93 
94 
95  // Constructors
96 
97  //- Construct null
98  inline wallPoint();
99 
100  //- Construct from origin, distance
101  inline wallPoint
102  (
103  const point& origin,
104  const scalar distSqr
105  );
106 
107  //- Construct as copy
108  inline wallPoint
109  (
110  const wallPoint&
111  );
112 
113 
114  // Member Functions
115 
116  // Access
117 
118  inline const point& origin() const;
119 
120  inline point& origin();
121 
122  inline scalar distSqr() const;
123 
124  inline scalar& distSqr();
125 
126 
127  // Needed by FaceCellWave
128 
129  //- Check whether origin has been changed at all or
130  // still contains original (invalid) value.
131  inline bool valid() const;
132 
133  //- Check for identical geometrical data. Used for cyclics checking.
134  inline bool sameGeometry
135  (
136  const polyMesh&,
137  const wallPoint&,
138  const scalar
139  ) const;
140 
141  //- Convert any absolute coordinates into relative to (patch)face
142  // centre
143  inline void leaveDomain
144  (
145  const polyMesh&,
146  const polyPatch&,
147  const label patchFaceI,
148  const point& faceCentre
149  );
150 
151  //- Reverse of leaveDomain
152  inline void enterDomain
153  (
154  const polyMesh&,
155  const polyPatch&,
156  const label patchFaceI,
157  const point& faceCentre
158  );
159 
160  //- Apply rotation matrix to any coordinates
161  inline void transform
162  (
163  const polyMesh&,
164  const tensor&
165  );
166 
167  //- Influence of neighbouring face.
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  );
176 
177  //- Influence of neighbouring cell.
178  inline bool updateFace
179  (
180  const polyMesh&,
181  const label thisFaceI,
182  const label neighbourCellI,
183  const wallPoint& neighbourInfo,
184  const scalar tol
185  );
186 
187  //- Influence of different value on same face.
188  inline bool updateFace
189  (
190  const polyMesh&,
191  const label thisFaceI,
192  const wallPoint& neighbourInfo,
193  const scalar tol
194  );
195 
196 
197  // Member Operators
198 
199  // Needed for List IO
200  inline bool operator==(const wallPoint&) const;
201  inline bool operator!=(const wallPoint&) const;
202 
203 
204  // IOstream Operators
205 
206  friend Ostream& operator<<(Ostream&, const wallPoint&);
207  friend Istream& operator>>(Istream&, wallPoint&);
208 };
209 
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 } // End namespace Foam
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 #include <meshTools/wallPointI.H>
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 #endif
222 
223 // ************************ vim: set sw=4 sts=4 et: ************************ //