edgeTopoDistanceData.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) 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 Class
28  Foam::edgeTopoDistanceData
29 
30 Description
31  For use with PatchEdgeFaceWave. Determines topological distance to
32  starting edges. Templated on passive transported data.
33 
34 SourceFiles
35  edgeTopoDistanceDataI.H
36  edgeTopoDistanceData.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef edgeTopoDistanceData_H
41 #define edgeTopoDistanceData_H
42 
43 #include "point.H"
44 #include "tensor.H"
45 #include "indirectPrimitivePatch.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 // Forward Declarations
53 class polyPatch;
54 class polyMesh;
55 template<class Type, class PrimitivePatchType>
57 
58 template<class Type, class PrimitivePatchType>
59 Istream& operator>>
60 (
61  Istream&,
63 );
64 template<class Type, class PrimitivePatchType>
65 Ostream& operator<<
66 (
67  Ostream&,
69 );
70 
71 
72 /*---------------------------------------------------------------------------*\
73  Class edgeTopoDistanceData Declaration
74 \*---------------------------------------------------------------------------*/
75 
76 template<class Type, class PrimitivePatchType = indirectPrimitivePatch>
78 {
79 protected:
80 
81  // Protected data
82 
83  //- Distance
84  label distance_;
85 
86  //- Starting data
87  Type data_;
88 
89 
90 public:
91 
92  typedef Type dataType;
93 
94  // Constructors
95 
96  //- Construct null with invalid (-1) for distance, null constructor
97  // for data
98  inline edgeTopoDistanceData();
99 
100  //- Construct from distance, data
101  inline edgeTopoDistanceData
102  (
103  const label distance,
104  const Type& data
105  );
106 
107 
108  // Member Functions
109 
110  // Access
111 
112  inline label distance() const
113  {
114  return distance_;
115  }
116 
117  inline const Type& data() const
118  {
119  return data_;
120  }
121 
122 
123  // Needed by PatchEdgeFaceWave
124 
125  //- Check whether origin has been changed at all or
126  // still contains original (invalid) value.
127  template<class TrackingData>
128  inline bool valid(TrackingData& td) const;
129 
130  //- Apply rotation matrix
131  template<class TrackingData>
132  inline void transform
133  (
134  const polyMesh& mesh,
135  const PrimitivePatchType& patch,
136  const tensor& rotTensor,
137  const scalar tol,
138  TrackingData& td
139  );
140 
141  //- Influence of face on edge
142  template<class TrackingData>
143  inline bool updateEdge
144  (
145  const polyMesh& mesh,
146  const PrimitivePatchType& patch,
147  const label edgeI,
148  const label facei,
150  const scalar tol,
151  TrackingData& td
152  );
153 
154  //- New information for edge (from e.g. coupled edge)
155  template<class TrackingData>
156  inline bool updateEdge
157  (
158  const polyMesh& mesh,
159  const PrimitivePatchType& patch,
161  const bool sameOrientation,
162  const scalar tol,
163  TrackingData& td
164  );
165 
166  //- Influence of edge on face.
167  template<class TrackingData>
168  inline bool updateFace
169  (
170  const polyMesh& mesh,
171  const PrimitivePatchType& patch,
172  const label facei,
173  const label edgeI,
175  const scalar tol,
176  TrackingData& td
177  );
178 
179  //- Same (like operator==)
180  template<class TrackingData>
181  inline bool equal
182  (
184  TrackingData&
185  ) const;
186 
187 
188  // Member Operators
189 
190  // Needed for List IO
191  inline bool operator==
192  (
194  ) const;
195  inline bool operator!=
196  (
198  ) const;
199 
200 
201  // IOstream Operators
202 
203  friend Ostream& operator<< <Type, PrimitivePatchType>
204  (
205  Ostream&,
207  );
208  friend Istream& operator>> <Type, PrimitivePatchType>
209  (
210  Istream&,
212  );
213 };
214 
215 
216 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
217 
218 
219 //- Data are contiguous if data type is contiguous
220 template<class Type, class PrimitivePatchType>
221 struct is_contiguous<edgeTopoDistanceData<Type, PrimitivePatchType>> :
222  is_contiguous<Type> {};
223 
224 //- Data are contiguous label if data type is label
225 template<class Type, class PrimitivePatchType>
226 struct is_contiguous_label<edgeTopoDistanceData<Type, PrimitivePatchType>> :
227  is_contiguous_label<Type> {};
228 
229 //- Data are contiguous scalar if data type is scalar
230 template<class Type, class PrimitivePatchType>
231 struct is_contiguous_scalar<edgeTopoDistanceData<Type, PrimitivePatchType>> :
232  is_contiguous_scalar<Type>{};
233 
234 
235 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
236 
237 } // End namespace Foam
238 
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240 
241 #ifdef NoRepository
242  #include "edgeTopoDistanceData.C"
243 #endif
244 
245 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246 
247 #include "edgeTopoDistanceDataI.H"
248 
249 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250 
251 #endif
252 
253 // ************************************************************************* //
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
point.H
tensor.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::is_contiguous_label
A template class to specify if a data type is composed solely of Foam::label elements.
Definition: contiguous.H:83
Foam::edgeTopoDistanceData::data_
Type data_
Starting data.
Definition: edgeTopoDistanceData.H:86
Foam::edgeTopoDistanceData::dataType
Type dataType
Definition: edgeTopoDistanceData.H:91
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
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::valid
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
Definition: edgeTopoDistanceDataI.H:61
Foam::edgeTopoDistanceData
For use with PatchEdgeFaceWave. Determines topological distance to starting edges....
Definition: edgeTopoDistanceData.H:55
edgeTopoDistanceData.C
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
indirectPrimitivePatch.H
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::is_contiguous_scalar
A template class to specify if a data type is composed solely of Foam::scalar elements.
Definition: contiguous.H:91
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::edgeTopoDistanceData::distance_
label distance_
Distance.
Definition: edgeTopoDistanceData.H:83
edgeTopoDistanceDataI.H
Foam::edgeTopoDistanceData::distance
label distance() const
Definition: edgeTopoDistanceData.H:111
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
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
Foam::is_contiguous
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:75