ENH: autoLayerDriver: better layering information message
[OpenFOAM-2.0.x.git] / src / meshTools / PointEdgeWave / pointEdgePoint.H
blobd4f4aa062f339a196dee1276a51f3c9fbd326e40
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
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.
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.
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/>.
24 Class
25     Foam::pointEdgePoint
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.
32 SourceFiles
33     pointEdgePointI.H
34     pointEdgePoint.C
36 \*---------------------------------------------------------------------------*/
38 #ifndef pointEdgePoint_H
39 #define pointEdgePoint_H
41 #include "point.H"
42 #include "label.H"
43 #include "scalar.H"
44 #include "tensor.H"
45 #include "pTraits.H"
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 namespace Foam
52 // Forward declaration of classes
53 class polyPatch;
54 class polyMesh;
56 /*---------------------------------------------------------------------------*\
57                            Class pointEdgePoint Declaration
58 \*---------------------------------------------------------------------------*/
60 class pointEdgePoint
62     // Private data
64         //- position of nearest wall center
65         point origin_;
67         //- normal distance (squared) from point to origin
68         scalar distSqr_;
71     // Private Member Functions
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         template<class TrackingData>
77         inline bool update
78         (
79             const point&,
80             const pointEdgePoint& w2,
81             const scalar tol,
82             TrackingData& td
83         );
85         //- Combine current with w2. Update distSqr, origin if w2 has smaller
86         //  quantities and returns true.
87         template<class TrackingData>
88         inline bool update
89         (
90             const pointEdgePoint& w2,
91             const scalar tol,
92             TrackingData& td
93         );
96 public:
98     // Constructors
100         //- Construct null
101         inline pointEdgePoint();
103         //- Construct from origin, distance
104         inline pointEdgePoint(const point&, const scalar);
106         //- Construct as copy
107         inline pointEdgePoint(const pointEdgePoint&);
110     // Member Functions
112         // Access
114             inline const point& origin() const;
116             inline scalar distSqr() const;
119         // Needed by meshWave
121             //- Check whether origin has been changed at all or
122             //  still contains original (invalid) value.
123             template<class TrackingData>
124             inline bool valid(TrackingData& td) const;
126             //- Check for identical geometrical data. Used for cyclics checking.
127             template<class TrackingData>
128             inline bool sameGeometry
129             (
130                 const pointEdgePoint&,
131                 const scalar tol,
132                 TrackingData& td
133             ) const;
135             //- Convert origin to relative vector to leaving point
136             //  (= point coordinate)
137             template<class TrackingData>
138             inline void leaveDomain
139             (
140                 const polyPatch& patch,
141                 const label patchPointI,
142                 const point& pos,
143                 TrackingData& td
144             );
146             //- Convert relative origin to absolute by adding entering point
147             template<class TrackingData>
148             inline void enterDomain
149             (
150                 const polyPatch& patch,
151                 const label patchPointI,
152                 const point& pos,
153                 TrackingData& td
154             );
156             //- Apply rotation matrix to origin
157             template<class TrackingData>
158             inline void transform
159             (
160                 const tensor& rotTensor,
161                 TrackingData& td
162             );
164             //- Influence of edge on point
165             template<class TrackingData>
166             inline bool updatePoint
167             (
168                 const polyMesh& mesh,
169                 const label pointI,
170                 const label edgeI,
171                 const pointEdgePoint& edgeInfo,
172                 const scalar tol,
173                 TrackingData& td
174             );
176             //- Influence of different value on same point.
177             //  Merge new and old info.
178             template<class TrackingData>
179             inline bool updatePoint
180             (
181                 const polyMesh& mesh,
182                 const label pointI,
183                 const pointEdgePoint& newPointInfo,
184                 const scalar tol,
185                 TrackingData& td
186             );
188             //- Influence of different value on same point.
189             //  No information about current position whatsoever.
190             template<class TrackingData>
191             inline bool updatePoint
192             (
193                 const pointEdgePoint& newPointInfo,
194                 const scalar tol,
195                 TrackingData& td
196             );
198             //- Influence of point on edge.
199             template<class TrackingData>
200             inline bool updateEdge
201             (
202                 const polyMesh& mesh,
203                 const label edgeI,
204                 const label pointI,
205                 const pointEdgePoint& pointInfo,
206                 const scalar tol,
207                 TrackingData& td
208             );
210             //- Same (like operator==)
211             template<class TrackingData>
212             inline bool equal(const pointEdgePoint&, TrackingData& td) const;
215     // Member Operators
217         // Needed for List IO
218         inline bool operator==(const pointEdgePoint&) const;
219         inline bool operator!=(const pointEdgePoint&) const;
222     // IOstream Operators
224         friend Ostream& operator<<(Ostream&, const pointEdgePoint&);
225         friend Istream& operator>>(Istream&, pointEdgePoint&);
229 //- Data associated with pointEdgePoint type are contiguous
230 template<>
231 inline bool contiguous<pointEdgePoint>()
233     return true;
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
239 } // End namespace Foam
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
243 #include "pointEdgePointI.H"
245 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247 #endif
249 // ************************************************************************* //