initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / dynamicMesh / polyTopoChange / polyTopoChange / refinementDataI.H
blob847210e6368592dad06ee58ec310e69eaae1c0e4
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 \*---------------------------------------------------------------------------*/
28 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
31 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
33 // Null constructor
34 inline Foam::refinementData::refinementData()
36     refinementCount_(-1),
37     count_(-1)
41 // Construct from components
42 inline Foam::refinementData::refinementData
44     const label refinementCount,
45     const label count
48     refinementCount_(refinementCount),
49     count_(count)
53 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
55 inline bool Foam::refinementData::valid() const
57     return count_ != -1;
61 // No geometric data so never any problem on cyclics
62 inline bool Foam::refinementData::sameGeometry
64     const polyMesh&,
65     const refinementData&,
66     const scalar
67 ) const
69     return true;
73 // No geometric data.
74 inline void Foam::refinementData::leaveDomain
76     const polyMesh&,
77     const polyPatch& patch,
78     const label patchFaceI,
79     const point& faceCentre
84 // No geometric data.
85 inline void Foam::refinementData::transform
87     const polyMesh&,
88     const tensor& rotTensor
93 // No geometric data.
94 inline void Foam::refinementData::enterDomain
96     const polyMesh&,
97     const polyPatch& patch,
98     const label patchFaceI,
99     const point& faceCentre
104 // Update cell with neighbouring face information
105 inline bool Foam::refinementData::updateCell
107     const polyMesh&,
108     const label thisCellI,
109     const label neighbourFaceI,
110     const refinementData& neighbourInfo,
111     const scalar tol
114     if (!valid())
115     {
116         FatalErrorIn("refinementData::updateCell") << "problem"
117             << abort(FatalError);
118         return false;
119     }
122     // Check if more than 2:1 ratio. This is when I am not refined but neighbour
123     // is and neighbour already had higher cell level.
124     if
125     (
126         neighbourInfo.isRefined()
127     && !isRefined()
128     &&  neighbourInfo.refinementCount() > refinementCount()
129     )
130     {
131         count_ = refinementCount();
132         return true;
133     }
137     // Count from neighbour face by the time it reaches the current cell.
138     label transportedFaceCount;
140     if (neighbourInfo.isRefined())
141     {
142         // refined so passes through two cells.
143         transportedFaceCount = max(0, neighbourInfo.count()-2);
144     }
145     else
146     {
147         // unrefined.
148         transportedFaceCount = max(0, neighbourInfo.count()-1);
149     }
151     if (count_ >= transportedFaceCount)
152     {
153         return false;
154     }
155     else
156     {
157         count_ = transportedFaceCount;
159         return true;
160     }
164 // Update face with neighbouring cell information
165 inline bool Foam::refinementData::updateFace
167     const polyMesh&,
168     const label thisFaceI,
169     const label neighbourCellI,
170     const refinementData& neighbourInfo,
171     const scalar tol
174     // From cell to its faces.
175     if (!valid())
176     {
177         refinementCount_ = neighbourInfo.refinementCount();
178         count_ = neighbourInfo.count();
180         return true;
181     }
183     if (count_ >= neighbourInfo.count())
184     {
185         return false;
186     }
187     else
188     {
189         refinementCount_ = neighbourInfo.refinementCount();
190         count_ = neighbourInfo.count();
192         return true;
193     }
197 // Update face with coupled face information
198 inline bool Foam::refinementData::updateFace
200     const polyMesh&,
201     const label thisFaceI,
202     const refinementData& neighbourInfo,
203     const scalar tol
206     // From face to face (e.g. coupled faces)
207     if (!valid())
208     {
209         refinementCount_ = neighbourInfo.refinementCount();
210         count_ = neighbourInfo.count();
212         return true;
213     }
215     if (count_ >= neighbourInfo.count())
216     {
217         return false;
218     }
219     else
220     {
221         refinementCount_ = neighbourInfo.refinementCount();
222         count_ = neighbourInfo.count();
224         return true;
225     }
226 }    
229 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
231 inline bool Foam::refinementData::operator==(const Foam::refinementData& rhs)
232  const
234     return count() == rhs.count() && refinementCount() == rhs.refinementCount();
238 inline bool Foam::refinementData::operator!=(const Foam::refinementData& rhs)
239  const
241     return !(*this == rhs);
245 // ************************************************************************* //