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 | Copyright (C) 2011-2016 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::topoDistanceData::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 polyMesh&,
67  const topoDistanceData&,
68  const scalar,
69  TrackingData&
70 ) const
71 {
72  return true;
73 }
74 
75 
76 // No geometric data.
77 template<class TrackingData>
79 (
80  const polyMesh&,
81  const polyPatch& patch,
82  const label patchFacei,
83  const point& faceCentre,
84  TrackingData&
85 )
86 {}
87 
88 
89 // No geometric data.
90 template<class TrackingData>
92 (
93  const polyMesh&,
94  const tensor& rotTensor,
95  TrackingData&
96 )
97 {}
98 
99 
100 // No geometric data.
101 template<class TrackingData>
103 (
104  const polyMesh&,
105  const polyPatch& patch,
106  const label patchFacei,
107  const point& faceCentre,
108  TrackingData&
109 )
110 {}
111 
112 
113 // Update cell with neighbouring face information
114 template<class TrackingData>
116 (
117  const polyMesh&,
118  const label thisCelli,
119  const label neighbourFacei,
120  const topoDistanceData& neighbourInfo,
121  const scalar tol,
122  TrackingData&
123 )
124 {
125  if (distance_ == -1)
126  {
127  operator=(neighbourInfo);
128  return true;
129  }
130  else
131  {
132  return false;
133  }
134 }
135 
136 
137 // Update face with neighbouring cell information
138 template<class TrackingData>
140 (
141  const polyMesh& mesh,
142  const label thisFacei,
143  const label neighbourCelli,
144  const topoDistanceData& neighbourInfo,
145  const scalar tol,
146  TrackingData&
147 )
148 {
149  // From cell to its faces.
150 
151  if (distance_ == -1)
152  {
153  data_ = neighbourInfo.data_;
154  distance_ = neighbourInfo.distance_ + 1;
155  return true;
156  }
157  else
158  {
159  return false;
160  }
161 }
162 
163 
164 // Update face with coupled face information
165 template<class TrackingData>
167 (
168  const polyMesh&,
169  const label thisFacei,
170  const topoDistanceData& neighbourInfo,
171  const scalar tol,
172  TrackingData&
173 )
174 {
175  // From face to face (e.g. coupled faces)
176  if (distance_ == -1)
177  {
178  operator=(neighbourInfo);
179  return true;
180  }
181  else
182  {
183  return false;
184  }
185 }
186 
187 
188 template<class TrackingData>
190 (
191  const topoDistanceData& rhs,
192  TrackingData& td
193 ) const
194 {
195  return operator==(rhs);
196 }
197 
198 
199 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
200 
201 inline bool Foam::topoDistanceData::operator==
202 (
203  const Foam::topoDistanceData& rhs
204 ) const
205 {
206  return data() == rhs.data() && distance() == rhs.distance();
207 }
208 
209 
210 inline bool Foam::topoDistanceData::operator!=
211 (
212  const Foam::topoDistanceData& rhs
213 ) const
214 {
215  return !(*this == rhs);
216 }
217 
218 
219 // ************************************************************************* //
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
bool updateCell(const polyMesh &, const label thisCelli, const label neighbourFacei, const topoDistanceData &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
bool equal(const topoDistanceData &, TrackingData &td) const
Same (like operator==)
bool sameGeometry(const polyMesh &, const topoDistanceData &, const scalar, TrackingData &td) const
Check for identical geometrical data. Used for cyclics checking.
void transform(const polyMesh &, const tensor &, TrackingData &td)
Apply rotation matrix to any coordinates.
bool updateFace(const polyMesh &, const label thisFacei, const label neighbourCelli, const topoDistanceData &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
bool operator==(const topoDistanceData &) const
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
topoDistanceData()
Construct null.
For use with FaceCellWave. Determines topological distance to starting faces.
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
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Convert any absolute coordinates into relative to (patch)face.