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

refinementDistanceData.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::refinementDistanceData
00027 
00028 Description
00029     Transfers refinement levels such that slow transition between levels is
00030     maintained. Used in FaceCellWave.
00031 
00032 SourceFiles
00033     refinementDistanceDataI.H
00034     refinementDistanceData.C
00035 
00036 \*---------------------------------------------------------------------------*/
00037 
00038 #ifndef refinementDistanceData_H
00039 #define refinementDistanceData_H
00040 
00041 #include "point.H"
00042 #include "tensor.H"
00043 
00044 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00045 
00046 namespace Foam
00047 {
00048 
00049 class polyPatch;
00050 class polyMesh;
00051 
00052 /*---------------------------------------------------------------------------*\
00053                            Class refinementDistanceData Declaration
00054 \*---------------------------------------------------------------------------*/
00055 
00056 class refinementDistanceData
00057 {
00058 
00059     // Private data
00060 
00061         //- unrefined (level0) buffer size (nBufferLayers*level0Size)
00062         scalar level0Size_;
00063 
00064         //- nearest point with highest level
00065         point origin_;
00066         label originLevel_;
00067 
00068 
00069     // Private Member Functions
00070 
00071         //- Updates with neighbouring data. Returns true if something changed.
00072         inline bool update
00073         (
00074             const point&,
00075             const refinementDistanceData& neighbourInfo,
00076             const scalar tol
00077         );
00078 
00079 public:
00080 
00081     // Constructors
00082 
00083         //- Construct null
00084         inline refinementDistanceData();
00085 
00086         //- Construct from count
00087         inline refinementDistanceData
00088         (
00089             const scalar level0Size,
00090             const point& origin,
00091             const label level
00092         );
00093 
00094 
00095     // Member Functions
00096 
00097         // Access
00098 
00099             inline scalar level0Size() const
00100             {
00101                 return level0Size_;
00102             }
00103 
00104             inline scalar& level0Size()
00105             {
00106                 return level0Size_;
00107             }
00108 
00109             inline const point& origin() const
00110             {
00111                 return origin_;
00112             }
00113 
00114             inline point& origin()
00115             {
00116                 return origin_;
00117             }
00118 
00119             inline label originLevel() const
00120             {
00121                 return originLevel_;
00122             }
00123 
00124             inline label& originLevel()
00125             {
00126                 return originLevel_;
00127             }
00128 
00129 
00130         // Other
00131 
00132             //- Calculates the wanted level at a given point. Walks out from
00133             //  the origin.
00134             inline label wantedLevel(const point& pt) const;
00135 
00136 
00137         // Needed by FaceCellWave
00138 
00139             //- Check whether origin has been changed at all or
00140             //  still contains original (invalid) value.
00141             inline bool valid() const;
00142 
00143             //- Check for identical geometrical data. Used for cyclics checking.
00144             inline bool sameGeometry
00145             (
00146                 const polyMesh&,
00147                 const refinementDistanceData&,
00148                 const scalar
00149             ) const;
00150 
00151             //- Convert any absolute coordinates into relative to (patch)face
00152             //  centre
00153             inline void leaveDomain
00154             (
00155                 const polyMesh&,
00156                 const polyPatch&,
00157                 const label patchFaceI,
00158                 const point& faceCentre
00159             );
00160 
00161             //- Reverse of leaveDomain
00162             inline void enterDomain
00163             (
00164                 const polyMesh&,
00165                 const polyPatch&,
00166                 const label patchFaceI,
00167                 const point& faceCentre
00168             );
00169 
00170             //- Apply rotation matrix to any coordinates
00171             inline void transform
00172             (
00173                 const polyMesh&,
00174                 const tensor&
00175             );
00176 
00177             //- Influence of neighbouring face.
00178             inline bool updateCell
00179             (
00180                 const polyMesh&,
00181                 const label thisCellI,
00182                 const label neighbourFaceI,
00183                 const refinementDistanceData& neighbourInfo,
00184                 const scalar tol
00185             );
00186 
00187             //- Influence of neighbouring cell.
00188             inline bool updateFace
00189             (
00190                 const polyMesh&,
00191                 const label thisFaceI,
00192                 const label neighbourCellI,
00193                 const refinementDistanceData& neighbourInfo,
00194                 const scalar tol
00195             );
00196 
00197             //- Influence of different value on same face.
00198             inline bool updateFace
00199             (
00200                 const polyMesh&,
00201                 const label thisFaceI,
00202                 const refinementDistanceData& neighbourInfo,
00203                 const scalar tol
00204             );
00205 
00206     // Member Operators
00207 
00208         // Needed for List IO
00209         inline bool operator==(const refinementDistanceData&) const;
00210 
00211         inline bool operator!=(const refinementDistanceData&) const;
00212 
00213 
00214     // IOstream Operators
00215 
00216         friend Ostream& operator<<(Ostream&, const refinementDistanceData&);
00217         friend Istream& operator>>(Istream&, refinementDistanceData&);
00218 };
00219 
00220 
00221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00222 
00223 } // End namespace Foam
00224 
00225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00226 
00227 #include "refinementDistanceDataI.H"
00228 
00229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00230 
00231 #endif
00232 
00233 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd