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-2022 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::transform
132 (
133  const polyPatch& patch,
134  const label patchFacei,
135  const transformer& transform,
136  TrackingData& td
137 )
138 {}
139 
140 
141 template<class TrackingData>
142 inline bool Foam::cellInfo::updateCell
143 (
144  const polyMesh&,
145  const label thisCelli,
146  const label neighbourFacei,
147  const cellInfo& neighbourInfo,
148  const scalar tol,
149  TrackingData& td
150 )
151 {
152  return update
153  (
154  neighbourInfo,
155  -1,
156  thisCelli,
157  neighbourFacei,
158  -1,
159  td
160  );
161 }
162 
163 
164 template<class TrackingData>
165 inline bool Foam::cellInfo::updateFace
166 (
167  const polyMesh&,
168  const label thisFacei,
169  const label neighbourCelli,
170  const cellInfo& neighbourInfo,
171  const scalar tol,
172  TrackingData& td
173 )
174 {
175  return update
176  (
177  neighbourInfo,
178  thisFacei,
179  -1,
180  -1,
181  neighbourCelli,
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 cellInfo& neighbourInfo,
193  const scalar tol,
194  TrackingData& td
195 )
196 {
197  return update
198  (
199  neighbourInfo,
200  thisFacei,
201  -1,
202  -1,
203  -1,
204  td
205  );
206 }
207 
208 
209 template<class TrackingData>
210 inline bool Foam::cellInfo::equal
211 (
212  const cellInfo& rhs,
213  TrackingData& td
214 ) const
215 {
216  return operator==(rhs);
217 }
218 
219 
220 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
221 
222 inline bool Foam::cellInfo::operator==(const Foam::cellInfo& rhs) const
223 {
224  return type() == rhs.type();
225 }
226 
227 
228 inline bool Foam::cellInfo::operator!=(const Foam::cellInfo& rhs) const
229 {
230  return !(*this == rhs);
231 }
232 
233 
234 // ************************************************************************* //
FvWallInfoData< WallInfo, label > label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space...
Definition: transformer.H:83
label type() const
Definition: cellInfo.H:103
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:306
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:66
bool equal(const cellInfo &, TrackingData &td) const
Same (like operator==)
Definition: cellInfoI.H:211
void transform(const polyPatch &patch, const label patchFacei, const transformer &transform, TrackingData &td)
Transform across an interface.
Definition: cellInfoI.H:132
bool operator==(const cellInfo &) const
Definition: cellInfoI.H:222
&#39;Cuts&#39; a mesh with a surface.
bool operator!=(const cellInfo &) const
Definition: cellInfoI.H:228
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:143
errorManip< error > abort(error &err)
Definition: errorManip.H:131
bool sameGeometry(const polyMesh &, const cellInfo &, const scalar, TrackingData &td) const
Check for identical geometrical data. Used for cyclics checking.
Definition: cellInfoI.H:118
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:166
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:76
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66