OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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