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  }
117  inline const Type& data() const
118  {
119  return data_;
120  }
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
241 #ifdef NoRepository
242  #include "edgeTopoDistanceData.C"
243 #endif
244 
245 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246 
248 
249 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250 
251 #endif
252 
253 // ************************************************************************* //
void transform(const polyMesh &mesh, const PrimitivePatchType &patch, const tensor &rotTensor, const scalar tol, TrackingData &td)
Apply rotation matrix.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
dynamicFvMesh & mesh
edgeTopoDistanceData()
Construct null with invalid (-1) for distance, null constructor.
bool equal(const edgeTopoDistanceData< Type, PrimitivePatchType > &, TrackingData &) const
Same (like operator==)
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.
For use with PatchEdgeFaceWave. Determines topological distance to starting edges. Templated on passive transported data.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
A template class to specify that a data type can be considered as being contiguous in memory...
Definition: contiguous.H:70
const std::string patch
OpenFOAM patch number as a std::string.
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:69
Tensor of scalars, i.e. Tensor<scalar>.
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.
Namespace for OpenFOAM.
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.