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