Loading...
Searching...
No Matches
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 Copyright (C) 2020,2025 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27\*---------------------------------------------------------------------------*/
28
29#include "cellClassification.H"
30#include "polyMesh.H"
31
32// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
33
34// Update this with w2 information
35template<class TrackingData>
36inline bool Foam::cellInfo::update
37(
38 const cellInfo& w2,
39 const label thisFacei,
40 const label thisCelli,
41 const label neighbourFacei,
42 const label neighbourCelli,
43 TrackingData& td
44)
45{
46 if
47 (
49 || (w2.type() == cellClassification::CUT)
50 )
51 {
53 << "Problem: trying to propagate NOTSET or CUT type:" << w2.type()
54 << " into cell/face with type:" << type() << endl
55 << "thisFacei:" << thisFacei
56 << " thisCelli:" << thisCelli
57 << " neighbourFacei:" << neighbourFacei
58 << " neighbourCelli:" << neighbourCelli
59 << abort(FatalError);
60 return false;
61 }
62
64 {
65 type_ = w2.type();
66
67 return true;
68 }
69
71 {
72 // Reached boundary. Stop.
73 return false;
74 }
75
76 if (type() == w2.type())
77 {
78 // Should never happen; already checked in meshWave
79 return false;
80 }
81
82 // Two conflicting types
84 << "Problem: trying to propagate conflicting types:" << w2.type()
85 << " into cell/face with type:" << type() << endl
86 << "thisFacei:" << thisFacei
87 << " thisCelli:" << thisCelli
88 << " neighbourFacei:" << neighbourFacei
89 << " neighbourCelli:" << neighbourCelli
90 << abort(FatalError);
92 return false;
93}
94
95
96// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
99:
100 type_(cellClassification::NOTSET)
101{}
102
103
104inline Foam::cellInfo::cellInfo(const label ctype)
105:
106 type_(ctype)
107{}
108
109
110// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
111
112template<class TrackingData>
113inline bool Foam::cellInfo::valid(TrackingData& td) const
115 return type_ != cellClassification::NOTSET;
116}
117
118
119// No geometric data so never any problem on cyclics
120template<class TrackingData>
122(
123 const polyMesh&,
124 const cellInfo& w2,
125 const scalar tol,
126 TrackingData& td
127) const
129 return true;
130}
131
132
133// No geometric data.
134template<class TrackingData>
136(
137 const polyMesh&,
138 const polyPatch& patch,
139 const label patchFacei,
140 const point& faceCentre,
141 TrackingData& td
142)
143{}
144
145
146// No geometric data.
147template<class TrackingData>
149(
150 const polyMesh&,
151 const tensor& rotTensor,
152 TrackingData& td
153)
154{}
155
156
157// No geometric data.
158template<class TrackingData>
160(
161 const polyMesh&,
162 const polyPatch& patch,
163 const label patchFacei,
164 const point& faceCentre,
165 TrackingData& td
166)
167{}
168
169
170// Update this with neighbour information
171template<class TrackingData>
173(
174 const polyMesh&,
175 const label thisCelli,
176 const label neighbourFacei,
177 const cellInfo& neighbourInfo,
178 const scalar tol,
179 TrackingData& td
180)
181{
182 return update
183 (
184 neighbourInfo,
185 -1,
186 thisCelli,
187 neighbourFacei,
188 -1,
190 );
191}
192
193
194// Update this with neighbour information
195template<class TrackingData>
197(
198 const polyMesh&,
199 const label thisFacei,
200 const label neighbourCelli,
201 const cellInfo& neighbourInfo,
202 const scalar tol,
203 TrackingData& td
204)
205{
206 return update
207 (
208 neighbourInfo,
209 thisFacei,
210 -1,
211 -1,
212 neighbourCelli,
214 );
215}
216
217
218// Update this with neighbour information
219template<class TrackingData>
221(
222 const polyMesh&,
223 const label thisFacei,
224 const cellInfo& neighbourInfo,
225 const scalar tol,
226 TrackingData& td
227)
228{
229 return update
230 (
231 neighbourInfo,
232 thisFacei,
233 -1,
234 -1,
235 -1,
236 td
237 );
238}
239
240
241template<class TrackingData>
242inline bool Foam::cellInfo::equal
243(
244 const cellInfo& rhs,
245 TrackingData& td
246) const
247{
248 return operator==(rhs);
249}
250
251
252template<class TrackingData>
254(
255 const polyMesh&,
256 const point& pt,
257 const label i0,
258 const cellInfo& f0,
259 const label i1,
260 const cellInfo& f1,
261 const scalar weight,
262 const scalar tol,
263 TrackingData& td
264)
265{
266 if (!f0.valid(td))
267 {
268 return update(f1, -1, -1, -1, -1, td);
269 }
270 else
271 {
272 return update(f0, -1, -1, -1, -1, td);
273 }
274}
275
276
277// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
278
279inline bool Foam::cellInfo::operator==
280(
282) const
283{
284 return type_ == rhs.type_;
285}
286
287
288inline bool Foam::cellInfo::operator!=
289(
290 const cellInfo& rhs
291) const
292{
293 return !(*this == rhs);
294}
295
296
297// ************************************************************************* //
#define w2
Definition blockCreate.C:28
'Cuts' a mesh with a surface.
Holds information regarding type of cell. Used in inside/outside determination in cellClassification.
Definition cellInfo.H:61
void transform(const polyMesh &, const tensor &rotTensor, TrackingData &td)
Apply rotation matrix to any coordinates.
Definition cellInfoI.H:142
bool interpolate(const polyMesh &, const point &pt, const label i0, const cellInfo &f0, const label i1, const cellInfo &f1, const scalar weight, const scalar tol, TrackingData &td)
Interpolate between two values (lerp). Returns true if causes changes. Not sure if needs to be specia...
Definition cellInfoI.H:247
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
bool equal(const cellInfo &, TrackingData &td) const
Test for equality, with TrackingData.
Definition cellInfoI.H:236
cellInfo()
Default construct - as cellClassification::NOTSET.
Definition cellInfoI.H:91
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:190
bool valid(TrackingData &td) const
Changed or contains original (invalid) value.
Definition cellInfoI.H:106
void enterDomain(const polyMesh &, const polyPatch &patch, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
Definition cellInfoI.H:153
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:129
label type() const
Definition cellInfo.H:105
bool sameGeometry(const polyMesh &, const cellInfo &, const scalar, TrackingData &td) const
Check for identical geometrical data (eg, cyclics checking).
Definition cellInfoI.H:115
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
A patch is a list of labels that address the faces in the global face list.
Definition polyPatch.H:73
mesh update()
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition error.H:600
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
Tensor< scalar > tensor
Definition symmTensor.H:57
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
errorManip< error > abort(error &err)
Definition errorManip.H:139
vector point
Point is a vector.
Definition point.H:37
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...