initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / meshTools / cellClassification / cellInfoI.H
blob3a106e0516259873e737f17d00511433c4c4ac9d
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 \*---------------------------------------------------------------------------*/
27 #include "cellClassification.H"
28 #include "polyMesh.H"
30 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
32 // Update this with w2 information
33 inline bool Foam::cellInfo::update
35     const cellInfo& w2,
36     const label thisFaceI,
37     const label thisCellI,
38     const label neighbourFaceI,
39     const label neighbourCellI
42     if
43     (
44         (w2.type() == cellClassification::NOTSET)
45      || (w2.type() == cellClassification::CUT)
46     )
47     {
48         FatalErrorIn("cellInfo::update(const cellInfo&)")
49             << "Problem: trying to propagate NOTSET or CUT type:" << w2.type()
50             << " into cell/face with type:" << type() << endl
51             << "thisFaceI:" << thisFaceI
52             << "  thisCellI:" << thisCellI
53             << "  neighbourFaceI:" << neighbourFaceI
54             << "  neighbourCellI:" << neighbourCellI
55             << abort(FatalError);
56         return false;
57     }
59     if (type() == cellClassification::NOTSET)
60     {
61         type_ = w2.type();
63         return true;
64     }
66     if (type() == cellClassification::CUT)
67     {
68         // Reached boundary. Stop.
69         return false;
70     }
72     if (type() == w2.type())
73     {
74         // Should never happen; already checked in meshWave
75         return false;
76     }
78     // Two conflicting types
79     FatalErrorIn("cellInfo::update(const cellInfo&)")
80         << "Problem: trying to propagate conflicting types:" << w2.type()
81         << " into cell/face with type:" << type() << endl
82         << "thisFaceI:" << thisFaceI
83         << "  thisCellI:" << thisCellI
84         << "  neighbourFaceI:" << neighbourFaceI
85         << "  neighbourCellI:" << neighbourCellI
86         << abort(FatalError);
88     return false;
90     
92 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
94 // Null constructor
95 inline Foam::cellInfo::cellInfo()
97     type_(cellClassification::NOTSET)
101 // Construct from components
102 inline Foam::cellInfo::cellInfo(const label type)
104     type_(type)
108 // Construct as copy
109 inline Foam::cellInfo::cellInfo(const cellInfo& w2)
111     type_(w2.type())
115 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
117 inline bool Foam::cellInfo::valid() const
119     return type_ != cellClassification::NOTSET;
123 // No geometric data so never any problem on cyclics
124 inline bool Foam::cellInfo::sameGeometry
126     const polyMesh&,
127     const cellInfo& w2,
128     const scalar tol
130  const
132     return true;
136 // No geometric data.
137 inline void Foam::cellInfo::leaveDomain
139     const polyMesh&,
140     const polyPatch& patch,
141     const label patchFaceI,
142     const point& faceCentre
147 // No geometric data.
148 inline void Foam::cellInfo::transform
150     const polyMesh&,
151     const tensor& rotTensor
156 // No geometric data.
157 inline void Foam::cellInfo::enterDomain
159     const polyMesh&,
160     const polyPatch& patch,
161     const label patchFaceI,
162     const point& faceCentre
167 // Update this with neighbour information
168 inline bool Foam::cellInfo::updateCell
170     const polyMesh&,
171     const label thisCellI,
172     const label neighbourFaceI,
173     const cellInfo& neighbourInfo,
174     const scalar tol
177     return update
178     (
179         neighbourInfo,
180         -1,
181         thisCellI,
182         neighbourFaceI,
183         -1
184     );
185 }    
188 // Update this with neighbour information
189 inline bool Foam::cellInfo::updateFace
191     const polyMesh&,
192     const label thisFaceI,
193     const label neighbourCellI,
194     const cellInfo& neighbourInfo,
195     const scalar tol
198     return update
199     (
200         neighbourInfo,
201         thisFaceI,
202         -1,
203         -1,
204         neighbourCellI
205     );
206 }    
208 // Update this with neighbour information
209 inline bool Foam::cellInfo::updateFace
211     const polyMesh&,
212     const label thisFaceI,
213     const cellInfo& neighbourInfo,
214     const scalar tol
217     return update
218     (
219         neighbourInfo,
220         thisFaceI,
221         -1,
222         -1,
223         -1
224     );
225 }    
228 // * * * * * * * * * * * * * * * Member Operators  * * * * * * * * * * * * * //
230 inline bool Foam::cellInfo::operator==(const Foam::cellInfo& rhs) const
232     return type() == rhs.type();
236 inline bool Foam::cellInfo::operator!=(const Foam::cellInfo& rhs) const
238     return !(*this == rhs);
242 // ************************************************************************* //