cellInfoI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 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 
96 :
97  type_(cellClassification::NOTSET)
98 {}
99 
100 
102 :
103  type_(type)
104 {}
105 
106 
107 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
108 
109 template<class TrackingData>
110 inline bool Foam::cellInfo::valid(TrackingData& td) const
111 {
112  return type_ != cellClassification::NOTSET;
113 }
114 
115 
116 template<class TrackingData>
118 (
119  const polyMesh&,
120  const cellInfo& w2,
121  const scalar tol,
122  TrackingData& td
123 )
124  const
125 {
126  return true;
127 }
128 
129 
130 template<class TrackingData>
131 inline void Foam::cellInfo::leaveDomain
132 (
133  const polyMesh&,
134  const polyPatch& patch,
135  const label patchFacei,
136  const point& faceCentre,
137  TrackingData& td
138 )
139 {}
140 
141 
142 template<class TrackingData>
143 inline void Foam::cellInfo::transform
144 (
145  const polyMesh&,
146  const tensor& rotTensor,
147  TrackingData& td
148 )
149 {}
150 
151 
152 template<class TrackingData>
153 inline void Foam::cellInfo::enterDomain
154 (
155  const polyMesh&,
156  const polyPatch& patch,
157  const label patchFacei,
158  const point& faceCentre,
159  TrackingData& td
160 )
161 {}
162 
163 
164 template<class TrackingData>
165 inline bool Foam::cellInfo::updateCell
166 (
167  const polyMesh&,
168  const label thisCelli,
169  const label neighbourFacei,
170  const cellInfo& neighbourInfo,
171  const scalar tol,
172  TrackingData& td
173 )
174 {
175  return update
176  (
177  neighbourInfo,
178  -1,
179  thisCelli,
180  neighbourFacei,
181  -1,
182  td
183  );
184 }
185 
186 
187 template<class TrackingData>
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  TrackingData& td
196 )
197 {
198  return update
199  (
200  neighbourInfo,
201  thisFacei,
202  -1,
203  -1,
204  neighbourCelli,
205  td
206  );
207 }
208 
209 
210 template<class TrackingData>
211 inline bool Foam::cellInfo::updateFace
212 (
213  const polyMesh&,
214  const label thisFacei,
215  const cellInfo& neighbourInfo,
216  const scalar tol,
217  TrackingData& td
218 )
219 {
220  return update
221  (
222  neighbourInfo,
223  thisFacei,
224  -1,
225  -1,
226  -1,
227  td
228  );
229 }
230 
231 
232 template<class TrackingData>
233 inline bool Foam::cellInfo::equal
234 (
235  const cellInfo& rhs,
236  TrackingData& td
237 ) const
238 {
239  return operator==(rhs);
240 }
241 
242 
243 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
244 
245 inline bool Foam::cellInfo::operator==(const Foam::cellInfo& rhs) const
246 {
247  return type() == rhs.type();
248 }
249 
250 
251 inline bool Foam::cellInfo::operator!=(const Foam::cellInfo& rhs) const
252 {
253  return !(*this == rhs);
254 }
255 
256 
257 // ************************************************************************* //
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:100
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:323
cellInfo()
Construct null.
Definition: cellInfoI.H:95
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
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:154
bool equal(const cellInfo &, TrackingData &td) const
Same (like operator==)
Definition: cellInfoI.H:234
bool operator==(const cellInfo &) const
Definition: cellInfoI.H:245
&#39;Cuts&#39; a mesh with a surface.
bool operator!=(const cellInfo &) const
Definition: cellInfoI.H:251
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
Definition: cellInfoI.H:110
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:166
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:132
bool sameGeometry(const polyMesh &, const cellInfo &, const scalar, TrackingData &td) const
Check for identical geometrical data. Used for cyclics checking.
Definition: cellInfoI.H:118
void transform(const polyMesh &, const tensor &rotTensor, TrackingData &td)
Apply rotation matrix to any coordinates.
Definition: cellInfoI.H:144
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:189
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