edgeTopoDistanceDataI.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) 2012-2016 OpenFOAM Foundation
9  Copyright (C) 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 #include "transform.H"
31 
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 
34 template<class Type, class PrimitivePatchType>
35 inline
37 :
38  distance_(-1),
39  data_()
40 {}
41 
42 
43 template<class Type, class PrimitivePatchType>
44 inline
46 (
47  const label distance,
48  const Type& data
49 )
50 :
51  distance_(distance),
52  data_(data)
53 {}
54 
55 
56 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
57 
58 template<class Type, class PrimitivePatchType>
59 template<class TrackingData>
61 (
62  TrackingData& td
63 ) const
64 {
65  return distance_ != -1;
66 }
67 
68 
69 template<class Type, class PrimitivePatchType>
70 template<class TrackingData>
72 (
73  const polyMesh& mesh,
74  const PrimitivePatchType& patch,
75  const tensor& rotTensor,
76  const scalar tol,
77  TrackingData& td
78 )
79 {}
80 
81 
82 template<class Type, class PrimitivePatchType>
83 template<class TrackingData>
85 (
86  const polyMesh& mesh,
87  const PrimitivePatchType& patch,
88  const label edgeI,
89  const label facei,
91  const scalar tol,
92  TrackingData& td
93 )
94 {
95  // From face to edge
96  if (distance_ == -1)
97  {
98  data_ = faceInfo.data_;
99  distance_ = faceInfo.distance_ + 1;
100  return true;
101  }
102 
103  return false;
104 }
105 
106 
107 template<class Type, class PrimitivePatchType>
108 template<class TrackingData>
110 (
111  const polyMesh& mesh,
112  const PrimitivePatchType& patch,
114  const bool sameOrientation,
115  const scalar tol,
116  TrackingData& td
117 )
118 {
119  // From edge to edge (e.g. coupled edges)
120  if (distance_ == -1)
121  {
122  this->operator=(edgeInfo);
123  return true;
124  }
125 
126  return false;
127 }
128 
129 
130 template<class Type, class PrimitivePatchType>
131 template<class TrackingData>
133 (
134  const polyMesh& mesh,
135  const PrimitivePatchType& patch,
136  const label facei,
137  const label edgeI,
139  const scalar tol,
140  TrackingData& td
141 )
142 {
143  // From edge to face
144  if (distance_ == -1)
145  {
146  this->operator=(edgeInfo);
147  return true;
148  }
149 
150  return false;
151 }
152 
153 
154 template<class Type, class PrimitivePatchType>
155 template<class TrackingData>
157 (
159  TrackingData& td
160 ) const
161 {
162  return operator==(rhs);
163 }
164 
165 
166 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
167 
168 template<class Type, class PrimitivePatchType>
170 (
172 ) const
173 {
174  return distance() == rhs.distance() && data() == rhs.data();
175 }
176 
177 
178 template<class Type, class PrimitivePatchType>
180 (
182 ) const
183 {
184  return !(*this == rhs);
185 }
186 
187 
188 // ************************************************************************* //
Foam::Tensor< scalar >
Foam::edgeTopoDistanceData::equal
bool equal(const edgeTopoDistanceData< Type, PrimitivePatchType > &, TrackingData &) const
Same (like operator==)
Definition: edgeTopoDistanceDataI.H:157
Foam::edgeTopoDistanceData::edgeTopoDistanceData
edgeTopoDistanceData()
Construct null with invalid (-1) for distance, null constructor.
Definition: edgeTopoDistanceDataI.H:36
Foam::edgeTopoDistanceData::updateFace
bool updateFace(const polyMesh &mesh, const PrimitivePatchType &patch, const label facei, const label edgeI, const edgeTopoDistanceData< Type, PrimitivePatchType > &edgeInfo, const scalar tol, TrackingData &td)
Influence of edge on face.
Definition: edgeTopoDistanceDataI.H:133
polyMesh.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::edgeTopoDistanceData::data_
Type data_
Starting data.
Definition: edgeTopoDistanceData.H:86
Foam::operator==
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Foam::edgeTopoDistanceData::updateEdge
bool updateEdge(const polyMesh &mesh, const PrimitivePatchType &patch, const label edgeI, const label facei, const edgeTopoDistanceData< Type, PrimitivePatchType > &faceInfo, const scalar tol, TrackingData &td)
Influence of face on edge.
Definition: edgeTopoDistanceDataI.H:85
Foam::edgeTopoDistanceData
For use with PatchEdgeFaceWave. Determines topological distance to starting edges....
Definition: edgeTopoDistanceData.H:55
Foam::edgeTopoDistanceData::valid
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
Definition: edgeTopoDistanceDataI.H:61
Foam::edgeTopoDistanceData::transform
void transform(const polyMesh &mesh, const PrimitivePatchType &patch, const tensor &rotTensor, const scalar tol, TrackingData &td)
Apply rotation matrix.
Definition: edgeTopoDistanceDataI.H:72
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::distance
scalar distance(const vector &p1, const vector &p2)
Definition: curveTools.C:12
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::edgeTopoDistanceData::distance_
label distance_
Distance.
Definition: edgeTopoDistanceData.H:83
Foam::edgeTopoDistanceData::distance
label distance() const
Definition: edgeTopoDistanceData.H:111
transform.H
3D tensor transformation operations.
Foam::edgeTopoDistanceData::data
const Type & data() const
Definition: edgeTopoDistanceData.H:116
Foam::data
Database for solution data, solver performance and other reduced data.
Definition: data.H:55