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-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 "polyMesh.H"
30
31// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32
33template<class Type>
35:
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>
83 const polyMesh&,
84 const polyPatch& patch,
85 const label patchFacei,
86 const point& faceCentre,
87 TrackingData&
88)
89{}
90
91
92// No geometric data.
93template<class Type>
94template<class TrackingData>
96(
97 const polyMesh&,
98 const tensor& rotTensor,
99 TrackingData&
100)
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&
114)
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;
138}
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)
158 distance_ = neighbourInfo.distance_ + 1;
159 data_ = neighbourInfo.data_;
160 return true;
161 }
162
163 return false;
164}
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)
182 this->operator=(neighbourInfo);
183 return true;
184 }
185
186 return false;
187}
188
189
190template<class Type>
191template<class TrackingData>
193(
194 const topoDistanceData<Type>& rhs,
195 TrackingData& td
196) const
197{
198 return operator==(rhs);
199}
200
201
202// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
203
204template<class Type>
206(
208) const
209{
210 return distance() == rhs.distance() && data() == rhs.data();
211}
212
213
214template<class Type>
216(
218) const
219{
220 return !(*this == rhs);
221}
222
223
224// ************************************************************************* //
bool valid() const
True if all internal ids are non-negative.
Database for solution data, solver performance and other reduced data.
Definition: data.H:58
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
For use with FaceCellWave. Determines topological distance to starting faces. Templated on passive tr...
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.
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Convert any absolute coordinates into relative to (patch)face.
dynamicFvMesh & mesh
scalar distance(const vector &p1, const vector &p2)
Definition: curveTools.C:12
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)