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

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