OpenFOAM logo
Open Source CFD Toolkit

pointEdgePoint.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2005 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     pointEdgePoint
00027 
00028 Description
00029     Holds information regarding nearest wall point. Used in pointEdgeWave.
00030     (so not standard meshWave)
00031     To be used in wall distance calculation.
00032 
00033 SourceFiles
00034     pointEdgePointI.H
00035     pointEdgePoint.C
00036 
00037 \*---------------------------------------------------------------------------*/
00038 
00039 #ifndef pointEdgePoint_H
00040 #define pointEdgePoint_H
00041 
00042 #include "point.H"
00043 #include "label.H"
00044 #include "scalar.H"
00045 #include "tensor.H"
00046 #include "pTraits.H"
00047 
00048 
00049 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00050 
00051 namespace Foam
00052 {
00053 
00054 // Class forward declarations
00055 class polyPatch;
00056 class polyMesh;
00057 
00058 /*---------------------------------------------------------------------------*\
00059                            Class pointEdgePoint Declaration
00060 \*---------------------------------------------------------------------------*/
00061 
00062 class pointEdgePoint
00063 {
00064     // Private data
00065 
00066         //- position of nearest wall center
00067         point origin_;
00068 
00069         //- normal distance (squared) from point to origin
00070         scalar distSqr_;
00071 
00072     // Private Member Functions
00073 
00074         //- Evaluate distance to point. Update distSqr, origin from whomever
00075         //  is nearer pt. Return true if w2 is closer to point,
00076         //  false otherwise.
00077         inline bool update
00078         (
00079             const point&,
00080             const pointEdgePoint& w2,
00081             const scalar tol
00082         );
00083 
00084         //- Combine current with w2. Update distSqr, origin if w2 has smaller
00085         //  quantities and returns true.
00086         inline bool update
00087         (
00088             const pointEdgePoint& w2,
00089             const scalar tol
00090         );
00091 
00092 public:
00093 
00094     // Static data members
00095 
00096         //- initial point far away.
00097         static point greatPoint;
00098 
00099     // Constructors
00100 
00101         //- Construct null
00102         inline pointEdgePoint();
00103 
00104         //- Construct from origin, distance
00105         inline pointEdgePoint(const point& origin, const scalar distSqr);
00106 
00107         //- Construct as copy
00108         inline pointEdgePoint(const pointEdgePoint&);
00109 
00110 
00111     // Member Functions
00112 
00113         // Access
00114 
00115             inline const point& origin() const;
00116 
00117             inline scalar distSqr() const;
00118 
00119 
00120         // Needed by meshWave
00121 
00122             //- Check whether origin has been changed at all or
00123             //  still contains original (invalid) value.
00124             inline bool valid() const;
00125 
00126             //- Check for identical geometrical data. Used for cyclics checking.
00127             inline bool sameGeometry(const pointEdgePoint&, const scalar tol)
00128              const;
00129 
00130             //- Convert origin to relative vector to leaving point
00131             //  (= point coordinate)
00132             inline void leaveDomain
00133             (
00134                 const polyPatch& patch,
00135                 const label patchPointI,
00136                 const point& pos
00137             );
00138 
00139             //- Convert relative origin to absolute by adding entering point
00140             inline void enterDomain
00141             (
00142                 const polyPatch& patch,
00143                 const label patchPointI,
00144                 const point& pos
00145             );
00146 
00147             //- Apply rotation matrix to origin
00148             inline void transform(const tensor& rotTensor);
00149 
00150             //- Influence of edge on point
00151             inline bool updatePoint
00152             (
00153                 const polyMesh& mesh,
00154                 const label pointI,
00155                 const label edgeI,
00156                 const pointEdgePoint& edgeInfo,
00157                 const scalar tol
00158             );
00159 
00160             //- Influence of different value on same point.
00161             //  Merge new and old info.
00162             inline bool updatePoint
00163             (
00164                 const polyMesh& mesh,
00165                 const label pointI,
00166                 const pointEdgePoint& newPointInfo,
00167                 const scalar tol
00168             );
00169 
00170             //- Influence of different value on same point.
00171             //  No information about current position whatsoever.
00172             inline bool updatePoint
00173             (
00174                 const pointEdgePoint& newPointInfo,
00175                 const scalar tol
00176             );
00177 
00178             //- Influence of point on edge.
00179             inline bool updateEdge
00180             (
00181                 const polyMesh& mesh,
00182                 const label edgeI,
00183                 const label pointI,
00184                 const pointEdgePoint& pointInfo,
00185                 const scalar tol
00186             );
00187 
00188 
00189     // Member Operators
00190 
00191         //Note: Used to determine whether to call update.
00192         inline bool operator==(const pointEdgePoint&) const;
00193 
00194         inline bool operator!=(const pointEdgePoint&) const;
00195 
00196 
00197     // IOstream Operators
00198 
00199         friend Ostream& operator<<(Ostream&, const pointEdgePoint&);
00200         friend Istream& operator>>(Istream&, pointEdgePoint&);
00201 };
00202 
00203 
00204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00205 
00206 } // End namespace Foam
00207 
00208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00209 
00210 #include "pointEdgePointI.H"
00211 
00212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00213 
00214 #endif
00215 
00216 // ************************************************************************* //
For further information go to www.openfoam.org