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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "cellClassification.H"
29 #include "polyMesh.H"
30 
31 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32 
33 // Update this with w2 information
34 template<class TrackingData>
35 inline bool Foam::cellInfo::update
36 (
37  const cellInfo& w2,
38  const label thisFacei,
39  const label thisCelli,
40  const label neighbourFacei,
41  const label neighbourCelli,
42  TrackingData& td
43 )
44 {
45  if
46  (
47  (w2.type() == cellClassification::NOTSET)
48  || (w2.type() == cellClassification::CUT)
49  )
50  {
52  << "Problem: trying to propagate NOTSET or CUT type:" << w2.type()
53  << " into cell/face with type:" << type() << endl
54  << "thisFacei:" << thisFacei
55  << " thisCelli:" << thisCelli
56  << " neighbourFacei:" << neighbourFacei
57  << " neighbourCelli:" << neighbourCelli
58  << abort(FatalError);
59  return false;
60  }
61 
63  {
64  type_ = w2.type();
65 
66  return true;
67  }
68 
70  {
71  // Reached boundary. Stop.
72  return false;
73  }
74 
75  if (type() == w2.type())
76  {
77  // Should never happen; already checked in meshWave
78  return false;
79  }
80 
81  // Two conflicting types
83  << "Problem: trying to propagate conflicting types:" << w2.type()
84  << " into cell/face with type:" << type() << endl
85  << "thisFacei:" << thisFacei
86  << " thisCelli:" << thisCelli
87  << " neighbourFacei:" << neighbourFacei
88  << " neighbourCelli:" << neighbourCelli
89  << abort(FatalError);
90 
91  return false;
92 }
93 
94 
95 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
96 
97 // Null constructor
99 :
100  type_(cellClassification::NOTSET)
101 {}
102 
103 
104 // Construct from components
106 :
107  type_(type)
108 {}
109 
110 
111 // Construct as copy
113 :
114  type_(w2.type())
115 {}
116 
117 
118 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
119 
120 template<class TrackingData>
121 inline bool Foam::cellInfo::valid(TrackingData& td) const
122 {
123  return type_ != cellClassification::NOTSET;
124 }
125 
126 
127 // No geometric data so never any problem on cyclics
128 template<class TrackingData>
130 (
131  const polyMesh&,
132  const cellInfo& w2,
133  const scalar tol,
134  TrackingData& td
135 )
136  const
137 {
138  return true;
139 }
140 
141 
142 // No geometric data.
143 template<class TrackingData>
144 inline void Foam::cellInfo::leaveDomain
145 (
146  const polyMesh&,
147  const polyPatch& patch,
148  const label patchFacei,
149  const point& faceCentre,
150  TrackingData& td
151 )
152 {}
153 
154 
155 // No geometric data.
156 template<class TrackingData>
157 inline void Foam::cellInfo::transform
158 (
159  const polyMesh&,
160  const tensor& rotTensor,
161  TrackingData& td
162 )
163 {}
164 
165 
166 // No geometric data.
167 template<class TrackingData>
168 inline void Foam::cellInfo::enterDomain
169 (
170  const polyMesh&,
171  const polyPatch& patch,
172  const label patchFacei,
173  const point& faceCentre,
174  TrackingData& td
175 )
176 {}
177 
178 
179 // Update this with neighbour information
180 template<class TrackingData>
181 inline bool Foam::cellInfo::updateCell
182 (
183  const polyMesh&,
184  const label thisCelli,
185  const label neighbourFacei,
186  const cellInfo& neighbourInfo,
187  const scalar tol,
188  TrackingData& td
189 )
190 {
191  return update
192  (
193  neighbourInfo,
194  -1,
195  thisCelli,
196  neighbourFacei,
197  -1,
198  td
199  );
200 }
201 
202 
203 // Update this with neighbour information
204 template<class TrackingData>
205 inline bool Foam::cellInfo::updateFace
206 (
207  const polyMesh&,
208  const label thisFacei,
209  const label neighbourCelli,
210  const cellInfo& neighbourInfo,
211  const scalar tol,
212  TrackingData& td
213 )
214 {
215  return update
216  (
217  neighbourInfo,
218  thisFacei,
219  -1,
220  -1,
221  neighbourCelli,
222  td
223  );
224 }
225 
226 // Update this with neighbour information
227 template<class TrackingData>
228 inline bool Foam::cellInfo::updateFace
229 (
230  const polyMesh&,
231  const label thisFacei,
232  const cellInfo& neighbourInfo,
233  const scalar tol,
234  TrackingData& td
235 )
236 {
237  return update
238  (
239  neighbourInfo,
240  thisFacei,
241  -1,
242  -1,
243  -1,
244  td
245  );
246 }
247 
248 
249 template<class TrackingData>
250 inline bool Foam::cellInfo::equal
251 (
252  const cellInfo& rhs,
253  TrackingData& td
254 ) const
255 {
256  return operator==(rhs);
257 }
258 
259 
260 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
261 
262 inline bool Foam::cellInfo::operator==(const Foam::cellInfo& rhs) const
263 {
264  return type() == rhs.type();
265 }
266 
267 
268 inline bool Foam::cellInfo::operator!=(const Foam::cellInfo& rhs) const
269 {
270  return !(*this == rhs);
271 }
272 
273 
274 // ************************************************************************* //
cellClassification.H
Foam::Tensor< scalar >
update
mesh update()
Foam::cellClassification::CUT
Definition: cellClassification.H:132
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:337
Foam::cellInfo::updateCell
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:182
Foam::cellInfo::updateFace
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:206
polyMesh.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::cellInfo::sameGeometry
bool sameGeometry(const polyMesh &, const cellInfo &, const scalar, TrackingData &td) const
Check for identical geometrical data. Used for cyclics checking.
Definition: cellInfoI.H:130
Foam::cellInfo::transform
void transform(const polyMesh &, const tensor &rotTensor, TrackingData &td)
Apply rotation matrix to any coordinates.
Definition: cellInfoI.H:158
Foam::label
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:62
Foam::operator==
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
Foam::cellInfo::type
label type() const
Definition: cellInfo.H:105
Foam::cellClassification::NOTSET
Definition: cellClassification.H:129
Foam::FatalError
error FatalError
w2
#define w2
Definition: blockCreate.C:35
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:137
Foam::cellClassification
'Cuts' a mesh with a surface.
Definition: cellClassification.H:117
Foam::cellInfo::enterDomain
void enterDomain(const polyMesh &, const polyPatch &patch, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
Definition: cellInfoI.H:169
Foam::cellInfo
Holds information regarding type of cell. Used in inside/outside determination in cellClassification.
Definition: cellInfo.H:64
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:355
Foam::cellInfo::operator==
bool operator==(const cellInfo &) const
Definition: cellInfoI.H:262
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::Vector< scalar >
Foam::type
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:590
Foam::cellInfo::valid
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
Definition: cellInfoI.H:121
Foam::cellInfo::cellInfo
cellInfo()
Construct null.
Definition: cellInfoI.H:98
Foam::cellInfo::operator!=
bool operator!=(const cellInfo &) const
Definition: cellInfoI.H:268
Foam::cellInfo::leaveDomain
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:145
Foam::cellInfo::equal
bool equal(const cellInfo &, TrackingData &td) const
Same (like operator==)
Definition: cellInfoI.H:251