FreeFOAM The Cross-Platform CFD Toolkit
pointData.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::pointData
26 
27 Description
28  Holds information regarding nearest wall point. Used in pointEdgeWave.
29  (so not standard meshWave)
30 
31  To be used in wall distance calculation.
32 
33 SourceFiles
34  pointDataI.H
35  pointData.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef pointData_H
40 #define pointData_H
41 
42 #include <OpenFOAM/point.H>
43 #include <OpenFOAM/label.H>
44 #include <OpenFOAM/tensor.H>
45 
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 // Class forward declarations
53 class polyPatch;
54 class polyMesh;
55 
56 /*---------------------------------------------------------------------------*\
57  Class pointData Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 class pointData
61 {
62  // Private data
63 
64  //- position of nearest wall center
65  point origin_;
66 
67  //- normal distance (squared) from point to origin
68  scalar distSqr_;
69 
70  //- additional information.
71  scalar s_;
72 
73  //- additional information.
74  vector v_;
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  inline bool update
83  (
84  const point&,
85  const pointData& w2,
86  const scalar tol
87  );
88 
89  //- Combine current with w2. Update distSqr, origin if w2 has smaller
90  // quantities and returns true.
91  inline bool update
92  (
93  const pointData& w2,
94  const scalar tol
95  );
96 
97 public:
98 
99  // Constructors
100 
101  //- Construct null
102  inline pointData();
103 
104  //- Construct from origin, distance
105  inline pointData
106  (
107  const point& origin,
108  const scalar distSqr,
109  const scalar s,
110  const vector& v
111  );
112 
113  //- Construct as copy
114  inline pointData(const pointData&);
115 
116 
117  // Member Functions
118 
119  // Access
120 
121  inline const point& origin() const;
122 
123  inline scalar distSqr() const;
124 
125  inline scalar s() const;
126 
127  inline const vector& v() const;
128 
129 
130  // Needed by meshWave
131 
132  //- Check whether origin has been changed at all or
133  // still contains original (invalid) value.
134  inline bool valid() const;
135 
136  //- Check for identical geometrical data. Used for cyclics checking.
137  inline bool sameGeometry(const pointData&, const scalar tol)
138  const;
139 
140  //- Convert origin to relative vector to leaving point
141  // (= point coordinate)
142  inline void leaveDomain
143  (
144  const polyPatch& patch,
145  const label patchPointI,
146  const point& pos
147  );
148 
149  //- Convert relative origin to absolute by adding entering point
150  inline void enterDomain
151  (
152  const polyPatch& patch,
153  const label patchPointI,
154  const point& pos
155  );
156 
157  //- Apply rotation matrix to origin
158  inline void transform(const tensor& rotTensor);
159 
160  //- Influence of edge on point
161  inline bool updatePoint
162  (
163  const polyMesh& mesh,
164  const label pointI,
165  const label edgeI,
166  const pointData& edgeInfo,
167  const scalar tol
168  );
169 
170  //- Influence of different value on same point.
171  // Merge new and old info.
172  inline bool updatePoint
173  (
174  const polyMesh& mesh,
175  const label pointI,
176  const pointData& newPointInfo,
177  const scalar tol
178  );
179 
180  //- Influence of different value on same point.
181  // No information about current position whatsoever.
182  inline bool updatePoint
183  (
184  const pointData& newPointInfo,
185  const scalar tol
186  );
187 
188  //- Influence of point on edge.
189  inline bool updateEdge
190  (
191  const polyMesh& mesh,
192  const label edgeI,
193  const label pointI,
194  const pointData& pointInfo,
195  const scalar tol
196  );
197 
198 
199  // Member Operators
200 
201  //Note: Used to determine whether to call update.
202  inline bool operator==(const pointData&) const;
203 
204  inline bool operator!=(const pointData&) const;
205 
206 
207  // IOstream Operators
208 
209  friend Ostream& operator<<(Ostream&, const pointData&);
210  friend Istream& operator>>(Istream&, pointData&);
211 };
212 
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 } // End namespace Foam
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 #include "pointDataI.H"
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 #endif
225 
226 // ************************ vim: set sw=4 sts=4 et: ************************ //