FreeFOAM The Cross-Platform CFD Toolkit
cellInfoI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
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.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "cellClassification.H"
27 #include <OpenFOAM/polyMesh.H>
28 
29 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
30 
31 // Update this with w2 information
32 inline bool Foam::cellInfo::update
33 (
34  const cellInfo& w2,
35  const label thisFaceI,
36  const label thisCellI,
37  const label neighbourFaceI,
38  const label neighbourCellI
39 )
40 {
41  if
42  (
43  (w2.type() == cellClassification::NOTSET)
44  || (w2.type() == cellClassification::CUT)
45  )
46  {
47  FatalErrorIn("cellInfo::update(const cellInfo&)")
48  << "Problem: trying to propagate NOTSET or CUT type:" << w2.type()
49  << " into cell/face with type:" << type() << endl
50  << "thisFaceI:" << thisFaceI
51  << " thisCellI:" << thisCellI
52  << " neighbourFaceI:" << neighbourFaceI
53  << " neighbourCellI:" << neighbourCellI
54  << abort(FatalError);
55  return false;
56  }
57 
59  {
60  type_ = w2.type();
61 
62  return true;
63  }
64 
66  {
67  // Reached boundary. Stop.
68  return false;
69  }
70 
71  if (type() == w2.type())
72  {
73  // Should never happen; already checked in meshWave
74  return false;
75  }
76 
77  // Two conflicting types
78  FatalErrorIn("cellInfo::update(const cellInfo&)")
79  << "Problem: trying to propagate conflicting types:" << w2.type()
80  << " into cell/face with type:" << type() << endl
81  << "thisFaceI:" << thisFaceI
82  << " thisCellI:" << thisCellI
83  << " neighbourFaceI:" << neighbourFaceI
84  << " neighbourCellI:" << neighbourCellI
85  << abort(FatalError);
86 
87  return false;
88 }
89 
90 
91 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
92 
93 // Null constructor
95 :
96  type_(cellClassification::NOTSET)
97 {}
98 
99 
100 // Construct from components
101 inline Foam::cellInfo::cellInfo(const label type)
102 :
103  type_(type)
104 {}
105 
106 
107 // Construct as copy
109 :
110  type_(w2.type())
111 {}
112 
113 
114 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
115 
116 inline bool Foam::cellInfo::valid() const
117 {
118  return type_ != cellClassification::NOTSET;
119 }
120 
121 
122 // No geometric data so never any problem on cyclics
124 (
125  const polyMesh&,
126  const cellInfo& w2,
127  const scalar tol
128 )
129  const
130 {
131  return true;
132 }
133 
134 
135 // No geometric data.
136 inline void Foam::cellInfo::leaveDomain
137 (
138  const polyMesh&,
139  const polyPatch& patch,
140  const label patchFaceI,
141  const point& faceCentre
142 )
143 {}
144 
145 
146 // No geometric data.
147 inline void Foam::cellInfo::transform
148 (
149  const polyMesh&,
150  const tensor& rotTensor
151 )
152 {}
153 
154 
155 // No geometric data.
156 inline void Foam::cellInfo::enterDomain
157 (
158  const polyMesh&,
159  const polyPatch& patch,
160  const label patchFaceI,
161  const point& faceCentre
162 )
163 {}
164 
165 
166 // Update this with neighbour information
167 inline bool Foam::cellInfo::updateCell
168 (
169  const polyMesh&,
170  const label thisCellI,
171  const label neighbourFaceI,
172  const cellInfo& neighbourInfo,
173  const scalar tol
174 )
175 {
176  return update
177  (
178  neighbourInfo,
179  -1,
180  thisCellI,
181  neighbourFaceI,
182  -1
183  );
184 }
185 
186 
187 // Update this with neighbour information
188 inline bool Foam::cellInfo::updateFace
189 (
190  const polyMesh&,
191  const label thisFaceI,
192  const label neighbourCellI,
193  const cellInfo& neighbourInfo,
194  const scalar tol
195 )
196 {
197  return update
198  (
199  neighbourInfo,
200  thisFaceI,
201  -1,
202  -1,
203  neighbourCellI
204  );
205 }
206 
207 // Update this with neighbour information
208 inline bool Foam::cellInfo::updateFace
209 (
210  const polyMesh&,
211  const label thisFaceI,
212  const cellInfo& neighbourInfo,
213  const scalar tol
214 )
215 {
216  return update
217  (
218  neighbourInfo,
219  thisFaceI,
220  -1,
221  -1,
222  -1
223  );
224 }
225 
226 
227 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
228 
229 inline bool Foam::cellInfo::operator==(const Foam::cellInfo& rhs) const
230 {
231  return type() == rhs.type();
232 }
233 
234 
235 inline bool Foam::cellInfo::operator!=(const Foam::cellInfo& rhs) const
236 {
237  return !(*this == rhs);
238 }
239 
240 
241 // ************************ vim: set sw=4 sts=4 et: ************************ //