pointTopoDistanceDataI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "polyMesh.H"
27 
28 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
29 
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
33 // Null constructor
35 :
36  data_(-1),
37  distance_(-1)
38 {}
39 
40 
41 // Construct from components
43 (
44  const label data,
45  const label distance
46 )
47 :
48  data_(data),
49  distance_(distance)
50 {}
51 
52 
53 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
54 
55 template<class TrackingData>
56 inline bool Foam::pointTopoDistanceData::valid(TrackingData& td) const
57 {
58  return distance_ != -1;
59 }
60 
61 
62 // No geometric data so never any problem on cyclics
63 template<class TrackingData>
65 (
66  const pointTopoDistanceData&,
67  const scalar tol,
68  TrackingData& td
69 ) const
70 {
71  return true;
72 }
73 
74 
75 // No geometric data.
76 template<class TrackingData>
78 (
79  const polyPatch& patch,
80  const label patchPointi,
81  const point& coord,
82  TrackingData& td
83 )
84 {}
85 
86 
87 // No geometric data.
88 template<class TrackingData>
90 (
91  const tensor& rotTensor,
92  TrackingData& td
93 )
94 {}
95 
96 
97 // No geometric data.
98 template<class TrackingData>
100 (
101  const polyPatch& patch,
102  const label patchPointi,
103  const point& coord,
104  TrackingData& td
105 )
106 {}
107 
108 
109 // Update this with information from connected edge
110 template<class TrackingData>
112 (
113  const polyMesh& mesh,
114  const label pointi,
115  const label edgeI,
116  const pointTopoDistanceData& edgeInfo,
117  const scalar tol,
118  TrackingData& td
119 )
120 {
121  if (distance_ == -1)
122  {
123  data_ = edgeInfo.data_;
124  distance_ = edgeInfo.distance_ + 1;
125  return true;
126  }
127  else
128  {
129  return false;
130  }
131 }
132 
133 
134 // Update this with new information on same point
135 template<class TrackingData>
137 (
138  const polyMesh& mesh,
139  const label pointi,
140  const pointTopoDistanceData& newPointInfo,
141  const scalar tol,
142  TrackingData& td
143 )
144 {
145  if (distance_ == -1)
146  {
147  operator=(newPointInfo);
148  return true;
149  }
150  else
151  {
152  return false;
153  }
154 }
155 
156 
157 // Update this with new information on same point. No extra information.
158 template<class TrackingData>
160 (
161  const pointTopoDistanceData& newPointInfo,
162  const scalar tol,
163  TrackingData& td
164 )
165 {
166  if (distance_ == -1)
167  {
168  operator=(newPointInfo);
169  return true;
170  }
171  else
172  {
173  return false;
174  }
175 }
176 
177 
178 // Update this with information from connected point
179 template<class TrackingData>
181 (
182  const polyMesh& mesh,
183  const label edgeI,
184  const label pointi,
185  const pointTopoDistanceData& pointInfo,
186  const scalar tol,
187  TrackingData& td
188 )
189 {
190  if (distance_ == -1)
191  {
192  operator=(pointInfo);
193  return true;
194  }
195  else
196  {
197  return false;
198  }
199 }
200 
201 
202 template<class TrackingData>
204 (
205  const pointTopoDistanceData& rhs,
206  TrackingData& td
207 ) const
208 {
209  return operator==(rhs);
210 }
211 
212 
213 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
214 
215 inline bool Foam::pointTopoDistanceData::operator==
216 (
217  const Foam::pointTopoDistanceData& rhs
218 ) const
219 {
220  return data() == rhs.data() && distance() == rhs.distance();
221 }
222 
223 
224 inline bool Foam::pointTopoDistanceData::operator!=
225 (
226  const Foam::pointTopoDistanceData& rhs
227 ) const
228 {
229  return !(*this == rhs);
230 }
231 
232 
233 // ************************************************************************* //
bool equal(const pointTopoDistanceData &, TrackingData &) const
Same (like operator==)
void transform(const tensor &rotTensor, TrackingData &td)
Apply rotation matrix to origin.
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:59
void leaveDomain(const polyPatch &patch, const label patchPointi, const point &pos, TrackingData &td)
Convert origin to relative vector to leaving point.
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
For use with PointEdgeWave. Determines topological distance to starting points.
bool updateEdge(const polyMesh &mesh, const label edgeI, const label pointi, const pointTopoDistanceData &pointInfo, const scalar tol, TrackingData &td)
Influence of point on edge.
bool sameGeometry(const pointTopoDistanceData &, const scalar tol, TrackingData &td) const
Check for identical geometrical data. Used for cyclics checking.
bool updatePoint(const polyMesh &mesh, const label pointi, const label edgeI, const pointTopoDistanceData &edgeInfo, const scalar tol, TrackingData &td)
Influence of edge on point.
void enterDomain(const polyPatch &patch, const label patchPointi, const point &pos, TrackingData &td)
Convert relative origin to absolute by adding entering point.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
bool operator==(const pointTopoDistanceData &) const