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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-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::topoDistanceData<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 (
68  const polyMesh&,
70  const scalar,
71  TrackingData&
72 ) const
73 {
74  return true;
75 }
76 
77 
78 // No geometric data.
79 template<class Type>
80 template<class TrackingData>
82 (
83  const polyMesh&,
84  const polyPatch& patch,
85  const label patchFacei,
86  const point& faceCentre,
87  TrackingData&
88 )
89 {}
90 
91 
92 // No geometric data.
93 template<class Type>
94 template<class TrackingData>
96 (
97  const polyMesh&,
98  const tensor& rotTensor,
99  TrackingData&
100 )
101 {}
102 
103 
104 // No geometric data.
105 template<class Type>
106 template<class TrackingData>
108 (
109  const polyMesh&,
110  const polyPatch& patch,
111  const label patchFacei,
112  const point& faceCentre,
113  TrackingData&
114 )
115 {}
116 
117 
118 // Update cell with neighbouring face information
119 template<class Type>
120 template<class TrackingData>
122 (
123  const polyMesh&,
124  const label thisCelli,
125  const label neighbourFacei,
126  const topoDistanceData<Type>& neighbourInfo,
127  const scalar tol,
128  TrackingData&
129 )
130 {
131  if (distance_ == -1)
132  {
133  this->operator=(neighbourInfo);
134  return true;
135  }
136 
137  return false;
138 }
139 
140 
141 // Update face with neighbouring cell information
142 template<class Type>
143 template<class TrackingData>
145 (
146  const polyMesh& mesh,
147  const label thisFacei,
148  const label neighbourCelli,
149  const topoDistanceData<Type>& neighbourInfo,
150  const scalar tol,
151  TrackingData&
152 )
153 {
154  // From cell to its faces.
155 
156  if (distance_ == -1)
157  {
158  distance_ = neighbourInfo.distance_ + 1;
159  data_ = neighbourInfo.data_;
160  return true;
161  }
162 
163  return false;
164 }
165 
166 
167 // Update face with coupled face information
168 template<class Type>
169 template<class TrackingData>
171 (
172  const polyMesh&,
173  const label thisFacei,
174  const topoDistanceData<Type>& neighbourInfo,
175  const scalar tol,
176  TrackingData&
177 )
178 {
179  // From face to face (e.g. coupled faces)
180  if (distance_ == -1)
181  {
182  this->operator=(neighbourInfo);
183  return true;
184  }
185 
186  return false;
187 }
188 
189 
190 template<class Type>
191 template<class TrackingData>
193 (
194  const topoDistanceData<Type>& rhs,
195  TrackingData& td
196 ) const
197 {
198  return operator==(rhs);
199 }
200 
201 
202 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
203 
204 template<class Type>
206 (
208 ) const
209 {
210  return distance() == rhs.distance() && data() == rhs.data();
211 }
212 
213 
214 template<class Type>
216 (
218 ) const
219 {
220  return !(*this == rhs);
221 }
222 
223 
224 // ************************************************************************* //
Foam::topoDistanceData::sameGeometry
bool sameGeometry(const polyMesh &, const topoDistanceData< Type > &, const scalar, TrackingData &td) const
Check for identical geometrical data (eg, cyclics checking)
Definition: topoDistanceDataI.H:67
Foam::Tensor< scalar >
Foam::topoDistanceData::transform
void transform(const polyMesh &, const tensor &, TrackingData &td)
Apply rotation matrix to any coordinates.
Definition: topoDistanceDataI.H:96
Foam::topoDistanceData
For use with FaceCellWave. Determines topological distance to starting faces. Templated on passive tr...
Definition: topoDistanceData.H:53
Foam::topoDistanceData::topoDistanceData
topoDistanceData()
Construct null with invalid (-1) for distance, null constructor.
Definition: topoDistanceDataI.H:34
polyMesh.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::topoDistanceData::enterDomain
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
Definition: topoDistanceDataI.H:108
Foam::topoDistanceData::data
const Type & data() const
Definition: topoDistanceData.H:101
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::distance
scalar distance(const vector &p1, const vector &p2)
Definition: curveTools.C:12
Foam::topoDistanceData::updateFace
bool updateFace(const polyMesh &, const label thisFacei, const label neighbourCelli, const topoDistanceData< Type > &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
Definition: topoDistanceDataI.H:145
Foam::topoDistanceData::distance
label distance() const
Definition: topoDistanceData.H:96
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::Vector< scalar >
Foam::topoDistanceData::valid
bool valid(TrackingData &td) const
Changed or contains original (invalid) value.
Definition: topoDistanceDataI.H:57
Foam::topoDistanceData::leaveDomain
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Convert any absolute coordinates into relative to (patch)face.
Definition: topoDistanceDataI.H:82
Foam::topoDistanceData::equal
bool equal(const topoDistanceData< Type > &, TrackingData &td) const
Test for equality, with TrackingData.
Definition: topoDistanceDataI.H:193
Foam::data
Database for solution data, solver performance and other reduced data.
Definition: data.H:55
Foam::topoDistanceData::updateCell
bool updateCell(const polyMesh &, const label thisCelli, const label neighbourFacei, const topoDistanceData< Type > &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
Definition: topoDistanceDataI.H:122