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 -------------------------------------------------------------------------------
11 License
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 
33 template<class Type>
35 :
36  distance_(-1),
37  data_()
38 {}
39 
40 
41 template<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 
55 template<class Type>
56 template<class TrackingData>
57 inline 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
64 template<class Type>
65 template<class TrackingData>
67 (
69  const scalar tol,
70  TrackingData& td
71 ) const
72 {
73  return true;
74 }
75 
76 
77 // No geometric data.
78 template<class Type>
79 template<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.
91 template<class Type>
92 template<class TrackingData>
94 (
95  const tensor& rotTensor,
96  TrackingData& td
97 )
98 {}
99 
100 
101 // No geometric data.
102 template<class Type>
103 template<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
115 template<class Type>
116 template<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
139 template<class Type>
140 template<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.
162 template<class Type>
163 template<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
183 template<class Type>
184 template<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 
206 template<class Type>
207 template<class TrackingData>
209 (
210  const pointTopoDistanceData<Type>& rhs,
211  TrackingData& td
212 ) const
213 {
214  return operator==(rhs);
215 }
216 
217 
218 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
219 
220 template<class Type>
222 (
224 ) const
225 {
226  return distance() == rhs.distance() && data() == rhs.data();
227 }
228 
229 
230 template<class Type>
232 (
234 ) const
235 {
236  return !(*this == rhs);
237 }
238 
239 
240 // ************************************************************************* //
Foam::pointTopoDistanceData::leaveDomain
void leaveDomain(const polyPatch &patch, const label patchPointi, const point &pos, TrackingData &td)
Convert origin to relative vector to leaving point.
Definition: pointTopoDistanceDataI.H:81
Foam::Tensor< scalar >
Foam::pointTopoDistanceData::updatePoint
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.
Definition: pointTopoDistanceDataI.H:118
Foam::pointTopoDistanceData::data
const Type & data() const
Definition: pointTopoDistanceData.H:104
Foam::pointTopoDistanceData::updateEdge
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.
Definition: pointTopoDistanceDataI.H:186
polyMesh.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::pointTopoDistanceData
For use with PointEdgeWave. Determines topological distance to starting points. Templated on passive ...
Definition: pointTopoDistanceData.H:53
Foam::operator==
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:68
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::pointTopoDistanceData::equal
bool equal(const pointTopoDistanceData< Type > &, TrackingData &) const
Test for equality, with TrackingData.
Definition: pointTopoDistanceDataI.H:209
Foam::distance
scalar distance(const vector &p1, const vector &p2)
Definition: curveTools.C:12
Foam::pointTopoDistanceData::enterDomain
void enterDomain(const polyPatch &patch, const label patchPointi, const point &pos, TrackingData &td)
Convert relative origin to absolute by adding entering point.
Definition: pointTopoDistanceDataI.H:105
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::Vector< scalar >
Foam::pointTopoDistanceData::pointTopoDistanceData
pointTopoDistanceData()
Construct null with invalid (-1) for distance, null constructor.
Definition: pointTopoDistanceDataI.H:34
Foam::pointTopoDistanceData::distance
label distance() const
Definition: pointTopoDistanceData.H:99
Foam::pointTopoDistanceData::transform
void transform(const tensor &rotTensor, TrackingData &td)
Apply rotation matrix to origin.
Definition: pointTopoDistanceDataI.H:94
Foam::data
Database for solution data, solver performance and other reduced data.
Definition: data.H:55
Foam::pointTopoDistanceData::sameGeometry
bool sameGeometry(const pointTopoDistanceData< Type > &, const scalar tol, TrackingData &td) const
Check for identical geometrical data (eg, cyclics checking)
Definition: pointTopoDistanceDataI.H:67
Foam::pointTopoDistanceData::valid
bool valid(TrackingData &td) const
Changed or contains original (invalid) value.
Definition: pointTopoDistanceDataI.H:57