OpenFOAM logo
Open Source CFD Toolkit

wallPoint.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     wallPoint
00027 
00028 Description
00029     Holds information regarding nearest wall point. Used in wall distance
00030     calculation.
00031 
00032 SourceFiles
00033     wallPointI.H
00034     wallPoint.C
00035 
00036 \*---------------------------------------------------------------------------*/
00037 
00038 #ifndef wallPoint_H
00039 #define wallPoint_H
00040 
00041 #include "point.H"
00042 #include "label.H"
00043 #include "scalar.H"
00044 #include "tensor.H"
00045 
00046 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00047 
00048 namespace Foam
00049 {
00050 
00051 // Class forward declarations
00052 class polyPatch;
00053 class polyMesh;
00054 
00055 /*---------------------------------------------------------------------------*\
00056                            Class wallPoint Declaration
00057 \*---------------------------------------------------------------------------*/
00058 
00059 class wallPoint
00060 {
00061     // Private data
00062 
00063         //- position of nearest wall center
00064         point origin_;
00065 
00066         //- normal distance (squared) from cellcenter to origin
00067         scalar distSqr_;
00068 
00069     // Private Member Functions
00070 
00071         //- Evaluate distance to point. Update distSqr, origin from whomever
00072         //  is nearer pt. Return true if w2 is closer to point,
00073         //  false otherwise.
00074         inline bool update
00075         (
00076             const point&,
00077             const wallPoint& w2,
00078             const scalar tol
00079         );
00080 
00081 public:
00082     // Static data members
00083 
00084         //- initial point far away.
00085         static point greatPoint;
00086 
00087     // Constructors
00088 
00089         //- Construct null
00090         inline wallPoint();
00091 
00092         //- Construct from origin, distance
00093         inline wallPoint
00094         (
00095             const point& origin,
00096             const scalar distSqr
00097         );
00098 
00099         //- Construct as copy
00100         inline wallPoint
00101         (
00102             const wallPoint&
00103         );
00104 
00105     // Member Functions
00106 
00107         // Access
00108 
00109             inline const point& origin() const;
00110 
00111             inline point& origin();
00112 
00113             inline scalar distSqr() const;
00114 
00115             inline scalar& distSqr();
00116 
00117 
00118         // Needed by meshWave
00119 
00120             //- Check whether origin has been changed at all or
00121             //  still contains original (invalid) value.
00122             inline bool valid() const;
00123 
00124             //- Check for identical geometrical data. Used for cyclics checking.
00125             inline bool sameGeometry(const wallPoint&, const scalar tol) const;
00126 
00127             //- Convert origin to relative vector to leaving point
00128             //  (= face centre)
00129             inline void leaveDomain
00130             (
00131                 const polyPatch& patch,
00132                 const label patchFaceI,
00133                 const point& faceCentre
00134             );
00135 
00136             //- Convert relative origin to absolute by adding entering point
00137             inline void enterDomain
00138             (
00139                 const polyPatch& patch,
00140                 const label patchFaceI,
00141                 const point& faceCentre
00142             );
00143 
00144             //- Apply rotation matrix to origin
00145             inline void transform(const tensor& rotTensor);
00146 
00147             //- Influence of neighbouring face.
00148             //  Calls update(...) with cellCentre of cellI
00149             inline bool updateCell
00150             (
00151                 const polyMesh& mesh,
00152                 const label thisCellI,
00153                 const label neighbourFaceI,
00154                 const wallPoint& neighbourWallInfo,
00155                 const scalar tol
00156             );
00157 
00158             //- Influence of neighbouring cell.
00159             //  Calls update(...) with faceCentre of faceI
00160             inline bool updateFace
00161             (
00162                 const polyMesh& mesh,
00163                 const label thisFaceI,
00164                 const label neighbourCellI,
00165                 const wallPoint& neighbourWallInfo,
00166                 const scalar tol
00167             );
00168 
00169             //- Influence of different value on same face.
00170             //  Merge new and old info.
00171             //  Calls update(...) with faceCentre of faceI
00172             inline bool updateFace
00173             (
00174                 const polyMesh& mesh,
00175                 const label thisFaceI,
00176                 const wallPoint& neighbourWallInfo,
00177                 const scalar tol
00178             );
00179 
00180     // Member Operators
00181 
00182         //Note: Used to determine whether to call update.
00183         inline bool operator==(const wallPoint&) const;
00184 
00185         inline bool operator!=(const wallPoint&) const;
00186 
00187 
00188     // IOstream Operators
00189 
00190         friend Ostream& operator<<(Ostream&, const wallPoint&);
00191         friend Istream& operator>>(Istream&, wallPoint&);
00192 };
00193 
00194 
00195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00196 
00197 } // End namespace Foam
00198 
00199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00200 
00201 #include "wallPointI.H"
00202 
00203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00204 
00205 #endif
00206 
00207 // ************************************************************************* //
For further information go to www.openfoam.org