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) 2011-2016 OpenFOAM Foundation
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 "polyMesh.H"
28 
29 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
30 
31 // Update this with w2 information
32 template<class TrackingData>
33 inline bool Foam::cellInfo::update
34 (
35  const cellInfo& w2,
36  const label thisFacei,
37  const label thisCelli,
38  const label neighbourFacei,
39  const label neighbourCelli,
40  TrackingData& td
41 )
42 {
43  if
44  (
45  (w2.type() == cellClassification::NOTSET)
46  || (w2.type() == cellClassification::CUT)
47  )
48  {
50  << "Problem: trying to propagate NOTSET or CUT type:" << w2.type()
51  << " into cell/face with type:" << type() << endl
52  << "thisFacei:" << thisFacei
53  << " thisCelli:" << thisCelli
54  << " neighbourFacei:" << neighbourFacei
55  << " neighbourCelli:" << neighbourCelli
56  << abort(FatalError);
57  return false;
58  }
59 
61  {
62  type_ = w2.type();
63 
64  return true;
65  }
66 
68  {
69  // Reached boundary. Stop.
70  return false;
71  }
72 
73  if (type() == w2.type())
74  {
75  // Should never happen; already checked in meshWave
76  return false;
77  }
78 
79  // Two conflicting types
81  << "Problem: trying to propagate conflicting types:" << w2.type()
82  << " into cell/face with type:" << type() << endl
83  << "thisFacei:" << thisFacei
84  << " thisCelli:" << thisCelli
85  << " neighbourFacei:" << neighbourFacei
86  << " neighbourCelli:" << neighbourCelli
87  << abort(FatalError);
88 
89  return false;
90 }
91 
92 
93 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
94 
95 // Null constructor
97 :
98  type_(cellClassification::NOTSET)
99 {}
100 
101 
102 // Construct from components
104 :
105  type_(type)
106 {}
107 
108 
109 // Construct as copy
111 :
112  type_(w2.type())
113 {}
114 
115 
116 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
117 
118 template<class TrackingData>
119 inline bool Foam::cellInfo::valid(TrackingData& td) const
120 {
121  return type_ != cellClassification::NOTSET;
122 }
123 
124 
125 // No geometric data so never any problem on cyclics
126 template<class TrackingData>
128 (
129  const polyMesh&,
130  const cellInfo& w2,
131  const scalar tol,
132  TrackingData& td
133 )
134  const
135 {
136  return true;
137 }
138 
139 
140 // No geometric data.
141 template<class TrackingData>
142 inline void Foam::cellInfo::leaveDomain
143 (
144  const polyMesh&,
145  const polyPatch& patch,
146  const label patchFacei,
147  const point& faceCentre,
148  TrackingData& td
149 )
150 {}
151 
152 
153 // No geometric data.
154 template<class TrackingData>
155 inline void Foam::cellInfo::transform
156 (
157  const polyMesh&,
158  const tensor& rotTensor,
159  TrackingData& td
160 )
161 {}
162 
163 
164 // No geometric data.
165 template<class TrackingData>
166 inline void Foam::cellInfo::enterDomain
167 (
168  const polyMesh&,
169  const polyPatch& patch,
170  const label patchFacei,
171  const point& faceCentre,
172  TrackingData& td
173 )
174 {}
175 
176 
177 // Update this with neighbour information
178 template<class TrackingData>
179 inline bool Foam::cellInfo::updateCell
180 (
181  const polyMesh&,
182  const label thisCelli,
183  const label neighbourFacei,
184  const cellInfo& neighbourInfo,
185  const scalar tol,
186  TrackingData& td
187 )
188 {
189  return update
190  (
191  neighbourInfo,
192  -1,
193  thisCelli,
194  neighbourFacei,
195  -1,
196  td
197  );
198 }
199 
200 
201 // Update this with neighbour information
202 template<class TrackingData>
203 inline bool Foam::cellInfo::updateFace
204 (
205  const polyMesh&,
206  const label thisFacei,
207  const label neighbourCelli,
208  const cellInfo& neighbourInfo,
209  const scalar tol,
210  TrackingData& td
211 )
212 {
213  return update
214  (
215  neighbourInfo,
216  thisFacei,
217  -1,
218  -1,
219  neighbourCelli,
220  td
221  );
222 }
223 
224 // Update this with neighbour information
225 template<class TrackingData>
226 inline bool Foam::cellInfo::updateFace
227 (
228  const polyMesh&,
229  const label thisFacei,
230  const cellInfo& neighbourInfo,
231  const scalar tol,
232  TrackingData& td
233 )
234 {
235  return update
236  (
237  neighbourInfo,
238  thisFacei,
239  -1,
240  -1,
241  -1,
242  td
243  );
244 }
245 
246 
247 template<class TrackingData>
248 inline bool Foam::cellInfo::equal
249 (
250  const cellInfo& rhs,
251  TrackingData& td
252 ) const
253 {
254  return operator==(rhs);
255 }
256 
257 
258 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
259 
260 inline bool Foam::cellInfo::operator==(const Foam::cellInfo& rhs) const
261 {
262  return type() == rhs.type();
263 }
264 
265 
266 inline bool Foam::cellInfo::operator!=(const Foam::cellInfo& rhs) const
267 {
268  return !(*this == rhs);
269 }
270 
271 
272 // ************************************************************************* //
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
label type() const
Definition: cellInfo.H:103
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
cellInfo()
Construct null.
Definition: cellInfoI.H:96
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
Holds information regarding type of cell. Used in inside/outside determination in cellClassification...
Definition: cellInfo.H:63
void enterDomain(const polyMesh &, const polyPatch &patch, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
Definition: cellInfoI.H:167
bool equal(const cellInfo &, TrackingData &td) const
Same (like operator==)
Definition: cellInfoI.H:249
bool operator==(const cellInfo &) const
Definition: cellInfoI.H:260
&#39;Cuts&#39; a mesh with a surface.
bool operator!=(const cellInfo &) const
Definition: cellInfoI.H:266
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
Definition: cellInfoI.H:119
bool updateCell(const polyMesh &, const label thisCelli, const label neighbourFacei, const cellInfo &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
Definition: cellInfoI.H:180
errorManip< error > abort(error &err)
Definition: errorManip.H:131
void leaveDomain(const polyMesh &, const polyPatch &patch, const label patchFacei, const point &faceCentre, TrackingData &td)
Convert any absolute coordinates into relative to (patch)face.
Definition: cellInfoI.H:143
bool sameGeometry(const polyMesh &, const cellInfo &, const scalar, TrackingData &td) const
Check for identical geometrical data. Used for cyclics checking.
Definition: cellInfoI.H:128
void transform(const polyMesh &, const tensor &rotTensor, TrackingData &td)
Apply rotation matrix to any coordinates.
Definition: cellInfoI.H:156
bool updateFace(const polyMesh &, const label thisFacei, const label neighbourCelli, const cellInfo &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
Definition: cellInfoI.H:204
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66