pointTopoDistanceDataI.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) 2013-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::pointTopoDistanceData<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(
69 const scalar tol,
70 TrackingData& td
71) const
72{
73 return true;
74}
75
76
77// No geometric data.
78template<class Type>
79template<class TrackingData>
81(
82 const polyPatch& patch,
83 const label patchPointi,
84 const point& coord,
85 TrackingData& td
86)
87{}
88
89
90// No geometric data.
91template<class Type>
92template<class TrackingData>
94(
95 const tensor& rotTensor,
96 TrackingData& td
97)
98{}
99
100
101// No geometric data.
102template<class Type>
103template<class TrackingData>
105(
106 const polyPatch& patch,
107 const label patchPointi,
108 const point& coord,
109 TrackingData& td
110)
111{}
112
113
114// Update this with information from connected edge
115template<class Type>
116template<class TrackingData>
118(
119 const polyMesh& mesh,
120 const label pointi,
121 const label edgeI,
122 const pointTopoDistanceData<Type>& edgeInfo,
123 const scalar tol,
124 TrackingData& td
125)
126{
127 if (distance_ == -1)
128 {
129 distance_ = edgeInfo.distance_ + 1;
130 data_ = edgeInfo.data_;
131 return true;
132 }
133
134 return false;
135}
136
137
138// Update this with new information on same point
139template<class Type>
140template<class TrackingData>
142(
143 const polyMesh& mesh,
144 const label pointi,
145 const pointTopoDistanceData<Type>& newPointInfo,
146 const scalar tol,
147 TrackingData& td
148)
149{
150 if (distance_ == -1)
151 {
152 distance_ = newPointInfo.distance_;
153 data_ = newPointInfo.data_;
154 return true;
155 }
156
157 return false;
158}
159
160
161// Update this with new information on same point. No extra information.
162template<class Type>
163template<class TrackingData>
165(
166 const pointTopoDistanceData<Type>& newPointInfo,
167 const scalar tol,
168 TrackingData& td
169)
170{
171 if (distance_ == -1)
172 {
173 distance_ = newPointInfo.distance_;
174 data_ = newPointInfo.data_;
175 return true;
176 }
177
178 return false;
179}
180
181
182// Update this with information from connected point
183template<class Type>
184template<class TrackingData>
186(
187 const polyMesh& mesh,
188 const label edgeI,
189 const label pointi,
190 const pointTopoDistanceData<Type>& pointInfo,
191 const scalar tol,
192 TrackingData& td
193)
194{
195 if (distance_ == -1)
196 {
197 distance_ = pointInfo.distance_;
198 data_ = pointInfo.data_;
199 return true;
200 }
201
202 return false;
203}
204
205
206template<class Type>
207template<class TrackingData>
209(
211 TrackingData& td
212) const
213{
214 return operator==(rhs);
215}
216
217
218// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
219
220template<class Type>
222(
224) const
225{
226 return distance() == rhs.distance() && data() == rhs.data();
227}
228
229
230template<class Type>
232(
234) const
235{
236 return !(*this == rhs);
237}
238
239
240// ************************************************************************* //
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.
For use with PointEdgeWave. Determines topological distance to starting points. Templated on passive ...
bool updatePoint(const polyMesh &mesh, const label pointi, const label edgeI, const pointTopoDistanceData< Type > &edgeInfo, const scalar tol, TrackingData &td)
Influence of edge on point.
bool updateEdge(const polyMesh &mesh, const label edgeI, const label pointi, const pointTopoDistanceData< Type > &pointInfo, const scalar tol, TrackingData &td)
Influence of point on edge.
bool equal(const pointTopoDistanceData< Type > &, TrackingData &) const
Test for equality, with TrackingData.
void leaveDomain(const polyPatch &patch, const label patchPointi, const point &pos, TrackingData &td)
Convert origin to relative vector to leaving point.
void enterDomain(const polyPatch &patch, const label patchPointi, const point &pos, TrackingData &td)
Convert relative origin to absolute by adding entering point.
bool sameGeometry(const pointTopoDistanceData< Type > &, const scalar tol, TrackingData &td) const
Check for identical geometrical data (eg, cyclics checking)
pointTopoDistanceData()
Construct null with invalid (-1) for distance, null constructor.
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
dynamicFvMesh & mesh
scalar distance(const vector &p1, const vector &p2)
Definition: curveTools.C:12
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)