initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / dynamicMesh / polyTopoChange / polyTopoChange / refinementDistanceData.H
bloba866c20cbab5636e5cd51e47f5839ea425403b4c
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software; you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by the
13     Free Software Foundation; either version 2 of the License, or (at your
14     option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::refinementDistanceData
28 Description
29     Transfers refinement levels such that slow transition between levels is
30     maintained. Used in FaceCellWave.
32 SourceFiles
33     refinementDistanceDataI.H
34     refinementDistanceData.C
36 \*---------------------------------------------------------------------------*/
38 #ifndef refinementDistanceData_H
39 #define refinementDistanceData_H
41 #include "point.H"
42 #include "tensor.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 namespace Foam
49 class polyPatch;
50 class polyMesh;
52 /*---------------------------------------------------------------------------*\
53                            Class refinementDistanceData Declaration
54 \*---------------------------------------------------------------------------*/
56 class refinementDistanceData
59     // Private data
61         //- unrefined (level0) buffer size (nBufferLayers*level0Size)
62         scalar level0Size_;
64         //- nearest point with highest level
65         point origin_;
66         label originLevel_;
69     // Private Member Functions
71         //- Updates with neighbouring data. Returns true if something changed.
72         inline bool update
73         (
74             const point&,
75             const refinementDistanceData& neighbourInfo,
76             const scalar tol
77         );
79 public:
81     // Constructors
83         //- Construct null
84         inline refinementDistanceData();
86         //- Construct from count
87         inline refinementDistanceData
88         (
89             const scalar level0Size,
90             const point& origin,
91             const label level
92         );
95     // Member Functions
97         // Access
99             inline scalar level0Size() const
100             {
101                 return level0Size_;
102             }
104             inline scalar& level0Size()
105             {
106                 return level0Size_;
107             }
109             inline const point& origin() const
110             {
111                 return origin_;
112             }
114             inline point& origin()
115             {
116                 return origin_;
117             }
119             inline label originLevel() const
120             {
121                 return originLevel_;
122             }
124             inline label& originLevel()
125             {
126                 return originLevel_;
127             }
130         // Other
132             //- Calculates the wanted level at a given point. Walks out from
133             //  the origin.
134             inline label wantedLevel(const point& pt) const;
137         // Needed by FaceCellWave
139             //- Check whether origin has been changed at all or
140             //  still contains original (invalid) value.
141             inline bool valid() const;
143             //- Check for identical geometrical data. Used for cyclics checking.
144             inline bool sameGeometry
145             (
146                 const polyMesh&,
147                 const refinementDistanceData&,
148                 const scalar
149             ) const;
151             //- Convert any absolute coordinates into relative to (patch)face
152             //  centre
153             inline void leaveDomain
154             (
155                 const polyMesh&,
156                 const polyPatch&,
157                 const label patchFaceI,
158                 const point& faceCentre
159             );
161             //- Reverse of leaveDomain
162             inline void enterDomain
163             (
164                 const polyMesh&,
165                 const polyPatch&,
166                 const label patchFaceI,
167                 const point& faceCentre
168             );
170             //- Apply rotation matrix to any coordinates
171             inline void transform
172             (
173                 const polyMesh&,
174                 const tensor&
175             );
177             //- Influence of neighbouring face.
178             inline bool updateCell
179             (
180                 const polyMesh&,
181                 const label thisCellI,
182                 const label neighbourFaceI,
183                 const refinementDistanceData& neighbourInfo,
184                 const scalar tol
185             );
187             //- Influence of neighbouring cell.
188             inline bool updateFace
189             (
190                 const polyMesh&,
191                 const label thisFaceI,
192                 const label neighbourCellI,
193                 const refinementDistanceData& neighbourInfo,
194                 const scalar tol
195             );
197             //- Influence of different value on same face.
198             inline bool updateFace
199             (
200                 const polyMesh&,
201                 const label thisFaceI,
202                 const refinementDistanceData& neighbourInfo,
203                 const scalar tol
204             );
206     // Member Operators
208         // Needed for List IO
209         inline bool operator==(const refinementDistanceData&) const;
211         inline bool operator!=(const refinementDistanceData&) const;
214     // IOstream Operators
216         friend Ostream& operator<<(Ostream&, const refinementDistanceData&);
217         friend Istream& operator>>(Istream&, refinementDistanceData&);
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 } // End namespace Foam
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 #include "refinementDistanceDataI.H"
229 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231 #endif
233 // ************************************************************************* //