Loading...
Searching...
No Matches
topoDistanceDataI.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) 2019-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 "polyMesh.H"
30
31// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32
33template<class Type>
36 distance_(-1),
37 data_()
38{}
39
40
41template<class Type>
43(
44 const label distance,
45 const Type& data
46)
47:
48 distance_(distance),
49 data_(data)
50{}
51
52
53// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
54
55template<class Type>
56template<class TrackingData>
57inline bool Foam::topoDistanceData<Type>::valid(TrackingData& td) const
58{
59 return distance_ != -1;
60}
61
62
63// No geometric data so never any problem on cyclics
64template<class Type>
65template<class TrackingData>
67(
68 const polyMesh&,
70 const scalar,
71 TrackingData&
72) const
73{
74 return true;
75}
76
77
78// No geometric data.
79template<class Type>
80template<class TrackingData>
82(
83 const polyMesh&,
84 const polyPatch& patch,
85 const label patchFacei,
86 const point& faceCentre,
87 TrackingData&
89{}
90
91
92// No geometric data.
93template<class Type>
94template<class TrackingData>
96(
97 const polyMesh&,
98 const tensor& rotTensor,
99 TrackingData&
101{}
102
103
104// No geometric data.
105template<class Type>
106template<class TrackingData>
108(
109 const polyMesh&,
110 const polyPatch& patch,
111 const label patchFacei,
112 const point& faceCentre,
113 TrackingData&
115{}
116
117
118// Update cell with neighbouring face information
119template<class Type>
120template<class TrackingData>
122(
123 const polyMesh&,
124 const label thisCelli,
125 const label neighbourFacei,
126 const topoDistanceData<Type>& neighbourInfo,
127 const scalar tol,
128 TrackingData&
129)
130{
131 if (distance_ == -1)
132 {
133 this->operator=(neighbourInfo);
134 return true;
135 }
136
137 return false;
139
140
141// Update face with neighbouring cell information
142template<class Type>
143template<class TrackingData>
145(
146 const polyMesh& mesh,
147 const label thisFacei,
148 const label neighbourCelli,
149 const topoDistanceData<Type>& neighbourInfo,
150 const scalar tol,
151 TrackingData&
152)
153{
154 // From cell to its faces.
155
156 if (distance_ == -1)
157 {
158 distance_ = neighbourInfo.distance_ + 1;
159 data_ = neighbourInfo.data_;
160 return true;
161 }
162
163 return false;
165
166
167// Update face with coupled face information
168template<class Type>
169template<class TrackingData>
171(
172 const polyMesh&,
173 const label thisFacei,
174 const topoDistanceData<Type>& neighbourInfo,
175 const scalar tol,
176 TrackingData&
177)
178{
179 // From face to face (e.g. coupled faces)
180 if (distance_ == -1)
181 {
182 this->operator=(neighbourInfo);
183 return true;
184 }
186 return false;
187}
188
190template<class Type>
191template<class TrackingData>
193(
195 TrackingData& td
196) const
198 return operator==(rhs);
199}
200
201
202template<class Type>
203template<class TrackingData>
205(
206 const polyMesh&,
207 const point& pt,
208 const label i0,
209 const topoDistanceData<Type>& f0,
210 const label i1,
211 const topoDistanceData<Type>& f1,
212 const scalar weight,
213 const scalar tol,
214 TrackingData& td
215)
217 // Topological distance - how to interpolate?
218 if (!valid(td))
219 {
220 if (f0.valid(td))
221 {
222 this->operator=(f0);
223 }
224 else
225 {
226 this->operator=(f1);
227 }
228 return true;
229 }
230 return false;
231}
232
233
234// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
235
236template<class Type>
238(
240) const
241{
242 return distance() == rhs.distance() && data() == rhs.data();
243}
244
246template<class Type>
248(
250) const
251{
252 return !(*this == rhs);
253}
254
255
256// ************************************************************************* //
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
For use with FaceCellWave. Determines topological distance to starting faces. Templated on passive tr...
void transform(const polyMesh &, const tensor &, TrackingData &td)
Apply rotation matrix to any coordinates.
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
bool updateFace(const polyMesh &, const label thisFacei, const label neighbourCelli, const topoDistanceData< Type > &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
bool updateCell(const polyMesh &, const label thisCelli, const label neighbourFacei, const topoDistanceData< Type > &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
bool sameGeometry(const polyMesh &, const topoDistanceData< Type > &, const scalar, TrackingData &td) const
Check for identical geometrical data (eg, cyclics checking).
topoDistanceData()
Construct null with invalid (-1) for distance, null constructor.
bool equal(const topoDistanceData< Type > &, TrackingData &td) const
Test for equality, with TrackingData.
bool valid(TrackingData &td) const
Changed or contains original (invalid) value.
bool interpolate(const polyMesh &, const point &pt, const label i0, const topoDistanceData< Type > &f0, const label i1, const topoDistanceData< Type > &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...
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Convert any absolute coordinates into relative to (patch)face.
const Type & data() const
bool operator==(const topoDistanceData< Type > &) const
dynamicFvMesh & mesh
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
scalar distance(const vector &p1, const vector &p2)
Definition curveTools.C:12
Tensor< scalar > tensor
Definition symmTensor.H:57
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
vector point
Point is a vector.
Definition point.H:37
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)