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 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);
91
92 return false;
93}
94
95
96// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
97
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
114{
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
128{
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,
189 td
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,
213 td
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>
243(
244 const cellInfo& rhs,
245 TrackingData& td
246) const
247{
248 return operator==(rhs);
249}
250
251
252// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
253
255(
256 const cellInfo& rhs
257) const
258{
259 return type_ == rhs.type_;
260}
261
262
264(
265 const cellInfo& rhs
266) const
267{
268 return !(*this == rhs);
269}
270
271
272// ************************************************************************* //
#define w2
Definition: blockCreate.C:35
bool valid() const
True if all internal ids are non-negative.
'Cuts' a mesh with a surface.
Holds information regarding type of cell. Used in inside/outside determination in cellClassification.
Definition: cellInfo.H:65
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:173
bool equal(const cellInfo &, TrackingData &td) const
Test for equality, with TrackingData.
Definition: cellInfoI.H:243
cellInfo()
Default construct - as cellClassification::NOTSET.
Definition: cellInfoI.H:98
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:197
void enterDomain(const polyMesh &, const polyPatch &patch, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
Definition: cellInfoI.H:160
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:136
label type() const
Definition: cellInfo.H:102
bool sameGeometry(const polyMesh &, const cellInfo &, const scalar, TrackingData &td) const
Check for identical geometrical data (eg, cyclics checking)
Definition: cellInfoI.H:122
friend Ostream & operator(Ostream &, const faMatrix< Type > &)
virtual bool update()
Update the mesh for both mesh motion and topology change.
Default transformation behaviour.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:75
mesh update()
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
errorManip< error > abort(error &err)
Definition: errorManip.H:144
error FatalError