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 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 
34 :
35  data_(-1),
36  distance_(-1)
37 {}
38 
39 
41 (
42  const label data,
43  const label distance
44 )
45 :
46  data_(data),
47  distance_(distance)
48 {}
49 
50 
51 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
52 
53 template<class TrackingData>
54 inline bool Foam::pointTopoDistanceData::valid(TrackingData& td) const
55 {
56  return distance_ != -1;
57 }
58 
59 
60 // No geometric data so never any problem on cyclics
61 template<class TrackingData>
63 (
64  const pointTopoDistanceData&,
65  const scalar tol,
66  TrackingData& td
67 ) const
68 {
69  return true;
70 }
71 
72 
73 // No geometric data.
74 template<class TrackingData>
76 (
77  const polyPatch& patch,
78  const label patchPointi,
79  const point& coord,
80  TrackingData& td
81 )
82 {}
83 
84 
85 // No geometric data.
86 template<class TrackingData>
88 (
89  const tensor& rotTensor,
90  TrackingData& td
91 )
92 {}
93 
94 
95 // No geometric data.
96 template<class TrackingData>
98 (
99  const polyPatch& patch,
100  const label patchPointi,
101  const point& coord,
102  TrackingData& td
103 )
104 {}
105 
106 
107 // Update this with information from connected edge
108 template<class TrackingData>
110 (
111  const polyMesh& mesh,
112  const label pointi,
113  const label edgeI,
114  const pointTopoDistanceData& edgeInfo,
115  const scalar tol,
116  TrackingData& td
117 )
118 {
119  if (distance_ == -1)
120  {
121  data_ = edgeInfo.data_;
122  distance_ = edgeInfo.distance_ + 1;
123  return true;
124  }
125 
126  return false;
127 }
128 
129 
130 // Update this with new information on same point
131 template<class TrackingData>
133 (
134  const polyMesh& mesh,
135  const label pointi,
136  const pointTopoDistanceData& newPointInfo,
137  const scalar tol,
138  TrackingData& td
139 )
140 {
141  if (distance_ == -1)
142  {
143  operator=(newPointInfo);
144  return true;
145  }
146 
147  return false;
148 }
149 
150 
151 // Update this with new information on same point. No extra information.
152 template<class TrackingData>
154 (
155  const pointTopoDistanceData& newPointInfo,
156  const scalar tol,
157  TrackingData& td
158 )
159 {
160  if (distance_ == -1)
161  {
162  operator=(newPointInfo);
163  return true;
164  }
165 
166  return false;
167 }
168 
169 
170 // Update this with information from connected point
171 template<class TrackingData>
173 (
174  const polyMesh& mesh,
175  const label edgeI,
176  const label pointi,
177  const pointTopoDistanceData& pointInfo,
178  const scalar tol,
179  TrackingData& td
180 )
181 {
182  if (distance_ == -1)
183  {
184  operator=(pointInfo);
185  return true;
186  }
187 
188  return false;
189 }
190 
191 
192 template<class TrackingData>
194 (
195  const pointTopoDistanceData& rhs,
196  TrackingData& td
197 ) const
198 {
199  return operator==(rhs);
200 }
201 
202 
203 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
204 
205 inline bool Foam::pointTopoDistanceData::operator==
206 (
207  const Foam::pointTopoDistanceData& rhs
208 ) const
209 {
210  return data() == rhs.data() && distance() == rhs.distance();
211 }
212 
213 
214 inline bool Foam::pointTopoDistanceData::operator!=
215 (
216  const Foam::pointTopoDistanceData& rhs
217 ) const
218 {
219  return !(*this == rhs);
220 }
221 
222 
223 // ************************************************************************* //
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:76
Foam::Tensor< scalar >
Foam::pointTopoDistanceData::data
label data() const
Definition: pointTopoDistanceData.H:93
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.
Definition: pointTopoDistanceData.H:63
Foam::pointTopoDistanceData::updateEdge
bool updateEdge(const polyMesh &mesh, const label edgeI, const label pointi, const pointTopoDistanceData &pointInfo, const scalar tol, TrackingData &td)
Influence of point on edge.
Definition: pointTopoDistanceDataI.H:173
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
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:66
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
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:98
Foam::pointTopoDistanceData::sameGeometry
bool sameGeometry(const pointTopoDistanceData &, const scalar tol, TrackingData &td) const
Check for identical geometrical data. Used for cyclics checking.
Definition: pointTopoDistanceDataI.H:63
Foam::pointTopoDistanceData::updatePoint
bool updatePoint(const polyMesh &mesh, const label pointi, const label edgeI, const pointTopoDistanceData &edgeInfo, const scalar tol, TrackingData &td)
Influence of edge on point.
Definition: pointTopoDistanceDataI.H:110
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 data and distance.
Definition: pointTopoDistanceDataI.H:33
Foam::pointTopoDistanceData::distance
label distance() const
Definition: pointTopoDistanceData.H:97
Foam::pointTopoDistanceData::transform
void transform(const tensor &rotTensor, TrackingData &td)
Apply rotation matrix to origin.
Definition: pointTopoDistanceDataI.H:88
Foam::data
Database for solution data, solver performance and other reduced data.
Definition: data.H:54
Foam::pointTopoDistanceData::equal
bool equal(const pointTopoDistanceData &, TrackingData &) const
Same (like operator==)
Definition: pointTopoDistanceDataI.H:194
Foam::pointTopoDistanceData::valid
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
Definition: pointTopoDistanceDataI.H:54