topoDistanceDataI.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) 2011-2022 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 polyPatch& patch,
81  const label patchFacei,
82  const transformer& transform,
83  TrackingData& td
84 )
85 {}
86 
87 
88 // Update cell with neighbouring face information
89 template<class TrackingData>
91 (
92  const polyMesh&,
93  const label thisCelli,
94  const label neighbourFacei,
95  const topoDistanceData& neighbourInfo,
96  const scalar tol,
97  TrackingData&
98 )
99 {
100  if (distance_ == -1)
101  {
102  operator=(neighbourInfo);
103  return true;
104  }
105  else
106  {
107  return false;
108  }
109 }
110 
111 
112 // Update face with neighbouring cell information
113 template<class TrackingData>
115 (
116  const polyMesh& mesh,
117  const label thisFacei,
118  const label neighbourCelli,
119  const topoDistanceData& neighbourInfo,
120  const scalar tol,
121  TrackingData&
122 )
123 {
124  // From cell to its faces.
125 
126  if (distance_ == -1)
127  {
128  data_ = neighbourInfo.data_;
129  distance_ = neighbourInfo.distance_ + 1;
130  return true;
131  }
132  else
133  {
134  return false;
135  }
136 }
137 
138 
139 // Update face with coupled face information
140 template<class TrackingData>
142 (
143  const polyMesh&,
144  const label thisFacei,
145  const topoDistanceData& neighbourInfo,
146  const scalar tol,
147  TrackingData&
148 )
149 {
150  // From face to face (e.g. coupled faces)
151  if (distance_ == -1)
152  {
153  operator=(neighbourInfo);
154  return true;
155  }
156  else
157  {
158  return false;
159  }
160 }
161 
162 
163 template<class TrackingData>
165 (
166  const topoDistanceData& rhs,
167  TrackingData& td
168 ) const
169 {
170  return operator==(rhs);
171 }
172 
173 
174 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
175 
176 inline bool Foam::topoDistanceData::operator==
177 (
178  const Foam::topoDistanceData& rhs
179 ) const
180 {
181  return data() == rhs.data() && distance() == rhs.distance();
182 }
183 
184 
185 inline bool Foam::topoDistanceData::operator!=
186 (
187  const Foam::topoDistanceData& rhs
188 ) const
189 {
190  return !(*this == rhs);
191 }
192 
193 
194 // ************************************************************************* //
Database for solution and other reduced data.
Definition: data.H:54
data(const objectRegistry &obr)
Construct for objectRegistry.
Definition: data.C:38
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:70
For use with FaceCellWave. Determines topological distance to starting faces.
bool updateCell(const polyMesh &, const label thisCelli, const label neighbourFacei, const topoDistanceData &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
bool updateFace(const polyMesh &, const label thisFacei, const label neighbourCelli, const topoDistanceData &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
bool sameGeometry(const polyMesh &, const topoDistanceData &, const scalar, TrackingData &td) const
Check for identical geometrical data. Used for cyclics checking.
bool equal(const topoDistanceData &, TrackingData &td) const
Same (like operator==)
topoDistanceData()
Construct null.
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
void transform(const polyPatch &patch, const label patchFacei, const transformer &transform, TrackingData &td)
Transform across an interface.
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space.
Definition: transformer.H:84
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
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:483