1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
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
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 * * * * * * * * * * * * * * //
34 inline Foam::refinementData::refinementData()
41 // Construct from components
42 inline Foam::refinementData::refinementData
44 const label refinementCount,
48 refinementCount_(refinementCount),
53 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
55 inline bool Foam::refinementData::valid() const
61 // No geometric data so never any problem on cyclics
62 inline bool Foam::refinementData::sameGeometry
65 const refinementData&,
74 inline void Foam::refinementData::leaveDomain
77 const polyPatch& patch,
78 const label patchFaceI,
79 const point& faceCentre
85 inline void Foam::refinementData::transform
88 const tensor& rotTensor
94 inline void Foam::refinementData::enterDomain
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
108 const label thisCellI,
109 const label neighbourFaceI,
110 const refinementData& neighbourInfo,
116 FatalErrorIn("refinementData::updateCell") << "problem"
117 << abort(FatalError);
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.
126 neighbourInfo.isRefined()
128 && neighbourInfo.refinementCount() > refinementCount()
131 count_ = refinementCount();
137 // Count from neighbour face by the time it reaches the current cell.
138 label transportedFaceCount;
140 if (neighbourInfo.isRefined())
142 // refined so passes through two cells.
143 transportedFaceCount = max(0, neighbourInfo.count()-2);
148 transportedFaceCount = max(0, neighbourInfo.count()-1);
151 if (count_ >= transportedFaceCount)
157 count_ = transportedFaceCount;
164 // Update face with neighbouring cell information
165 inline bool Foam::refinementData::updateFace
168 const label thisFaceI,
169 const label neighbourCellI,
170 const refinementData& neighbourInfo,
174 // From cell to its faces.
177 refinementCount_ = neighbourInfo.refinementCount();
178 count_ = neighbourInfo.count();
183 if (count_ >= neighbourInfo.count())
189 refinementCount_ = neighbourInfo.refinementCount();
190 count_ = neighbourInfo.count();
197 // Update face with coupled face information
198 inline bool Foam::refinementData::updateFace
201 const label thisFaceI,
202 const refinementData& neighbourInfo,
206 // From face to face (e.g. coupled faces)
209 refinementCount_ = neighbourInfo.refinementCount();
210 count_ = neighbourInfo.count();
215 if (count_ >= neighbourInfo.count())
221 refinementCount_ = neighbourInfo.refinementCount();
222 count_ = neighbourInfo.count();
229 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
231 inline bool Foam::refinementData::operator==(const Foam::refinementData& rhs)
234 return count() == rhs.count() && refinementCount() == rhs.refinementCount();
238 inline bool Foam::refinementData::operator!=(const Foam::refinementData& rhs)
241 return !(*this == rhs);
245 // ************************************************************************* //