FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

pointData.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-2010 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
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your 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, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::pointData
00026 
00027 Description
00028     Holds information regarding nearest wall point. Used in pointEdgeWave.
00029     (so not standard meshWave)
00030 
00031     To be used in wall distance calculation.
00032 
00033 SourceFiles
00034     pointDataI.H
00035     pointData.C
00036 
00037 \*---------------------------------------------------------------------------*/
00038 
00039 #ifndef pointData_H
00040 #define pointData_H
00041 
00042 #include <OpenFOAM/point.H>
00043 #include <OpenFOAM/label.H>
00044 #include <OpenFOAM/tensor.H>
00045 
00046 
00047 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00048 
00049 namespace Foam
00050 {
00051 
00052 // Class forward declarations
00053 class polyPatch;
00054 class polyMesh;
00055 
00056 /*---------------------------------------------------------------------------*\
00057                            Class pointData Declaration
00058 \*---------------------------------------------------------------------------*/
00059 
00060 class pointData
00061 {
00062     // Private data
00063 
00064         //- position of nearest wall center
00065         point origin_;
00066 
00067         //- normal distance (squared) from point to origin
00068         scalar distSqr_;
00069 
00070         //- additional information.
00071         scalar s_;
00072 
00073         //- additional information.
00074         vector v_;
00075 
00076 
00077     // Private Member Functions
00078 
00079         //- Evaluate distance to point. Update distSqr, origin from whomever
00080         //  is nearer pt. Return true if w2 is closer to point,
00081         //  false otherwise.
00082         inline bool update
00083         (
00084             const point&,
00085             const pointData& w2,
00086             const scalar tol
00087         );
00088 
00089         //- Combine current with w2. Update distSqr, origin if w2 has smaller
00090         //  quantities and returns true.
00091         inline bool update
00092         (
00093             const pointData& w2,
00094             const scalar tol
00095         );
00096 
00097 public:
00098 
00099     // Constructors
00100 
00101         //- Construct null
00102         inline pointData();
00103 
00104         //- Construct from origin, distance
00105         inline pointData
00106         (
00107             const point& origin,
00108             const scalar distSqr,
00109             const scalar s,
00110             const vector& v
00111         );
00112 
00113         //- Construct as copy
00114         inline pointData(const pointData&);
00115 
00116 
00117     // Member Functions
00118 
00119         // Access
00120 
00121             inline const point& origin() const;
00122 
00123             inline scalar distSqr() const;
00124 
00125             inline scalar s() const;
00126 
00127             inline const vector& v() const;
00128 
00129 
00130         // Needed by meshWave
00131 
00132             //- Check whether origin has been changed at all or
00133             //  still contains original (invalid) value.
00134             inline bool valid() const;
00135 
00136             //- Check for identical geometrical data. Used for cyclics checking.
00137             inline bool sameGeometry(const pointData&, const scalar tol)
00138              const;
00139 
00140             //- Convert origin to relative vector to leaving point
00141             //  (= point coordinate)
00142             inline void leaveDomain
00143             (
00144                 const polyPatch& patch,
00145                 const label patchPointI,
00146                 const point& pos
00147             );
00148 
00149             //- Convert relative origin to absolute by adding entering point
00150             inline void enterDomain
00151             (
00152                 const polyPatch& patch,
00153                 const label patchPointI,
00154                 const point& pos
00155             );
00156 
00157             //- Apply rotation matrix to origin
00158             inline void transform(const tensor& rotTensor);
00159 
00160             //- Influence of edge on point
00161             inline bool updatePoint
00162             (
00163                 const polyMesh& mesh,
00164                 const label pointI,
00165                 const label edgeI,
00166                 const pointData& edgeInfo,
00167                 const scalar tol
00168             );
00169 
00170             //- Influence of different value on same point.
00171             //  Merge new and old info.
00172             inline bool updatePoint
00173             (
00174                 const polyMesh& mesh,
00175                 const label pointI,
00176                 const pointData& newPointInfo,
00177                 const scalar tol
00178             );
00179 
00180             //- Influence of different value on same point.
00181             //  No information about current position whatsoever.
00182             inline bool updatePoint
00183             (
00184                 const pointData& newPointInfo,
00185                 const scalar tol
00186             );
00187 
00188             //- Influence of point on edge.
00189             inline bool updateEdge
00190             (
00191                 const polyMesh& mesh,
00192                 const label edgeI,
00193                 const label pointI,
00194                 const pointData& pointInfo,
00195                 const scalar tol
00196             );
00197 
00198 
00199     // Member Operators
00200 
00201         //Note: Used to determine whether to call update.
00202         inline bool operator==(const pointData&) const;
00203 
00204         inline bool operator!=(const pointData&) const;
00205 
00206 
00207     // IOstream Operators
00208 
00209         friend Ostream& operator<<(Ostream&, const pointData&);
00210         friend Istream& operator>>(Istream&, pointData&);
00211 };
00212 
00213 
00214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00215 
00216 } // End namespace Foam
00217 
00218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00219 
00220 #include "pointDataI.H"
00221 
00222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00223 
00224 #endif
00225 
00226 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines