topoDistanceData.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 Class
28  Foam::topoDistanceData
29 
30 Description
31  For use with FaceCellWave. Determines topological distance to starting
32  faces. Templated on passive transported data.
33 
34 SourceFiles
35  topoDistanceDataI.H
36  topoDistanceData.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef topoDistanceData_H
41 #define topoDistanceData_H
42 
43 #include "point.H"
44 #include "tensor.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 // Forward Declarations
52 class polyPatch;
53 class polyMesh;
54 template<class Type> class topoDistanceData;
55 
56 template<class Type>
58 template<class Type>
60 
61 /*---------------------------------------------------------------------------*\
62  Class topoDistanceData Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 template<class Type>
66 class topoDistanceData
67 {
68  // Private Data
69 
70  //- Distance
71  label distance_;
72 
73  //- Starting data
74  Type data_;
75 
76 
77 public:
78 
79  // Constructors
80 
81  //- Construct null with invalid (-1) for distance, null constructor
82  // for data
83  inline topoDistanceData();
84 
85  //- Construct from components
86  inline topoDistanceData
87  (
88  const label distance,
89  const Type& data
90  );
91 
92 
93  // Member Functions
94 
95  // Access
96 
97  inline label distance() const
98  {
99  return distance_;
100  }
101 
102  inline const Type& data() const
103  {
104  return data_;
105  }
106 
107 
108  // Needed by FaceCellWave
109 
110  //- Changed or contains original (invalid) value
111  template<class TrackingData>
112  inline bool valid(TrackingData& td) const;
113 
114  //- Check for identical geometrical data (eg, cyclics checking)
115  template<class TrackingData>
116  inline bool sameGeometry
117  (
118  const polyMesh&,
119  const topoDistanceData<Type>&,
120  const scalar,
121  TrackingData& td
122  ) const;
123 
124  //- Convert any absolute coordinates into relative to (patch)face
125  // centre
126  template<class TrackingData>
127  inline void leaveDomain
128  (
129  const polyMesh&,
130  const polyPatch&,
131  const label patchFacei,
132  const point& faceCentre,
133  TrackingData& td
134  );
135 
136  //- Reverse of leaveDomain
137  template<class TrackingData>
138  inline void enterDomain
139  (
140  const polyMesh&,
141  const polyPatch&,
142  const label patchFacei,
143  const point& faceCentre,
144  TrackingData& td
145  );
146 
147  //- Apply rotation matrix to any coordinates
148  template<class TrackingData>
149  inline void transform
150  (
151  const polyMesh&,
152  const tensor&,
153  TrackingData& td
154  );
155 
156  //- Influence of neighbouring face.
157  template<class TrackingData>
158  inline bool updateCell
159  (
160  const polyMesh&,
161  const label thisCelli,
162  const label neighbourFacei,
163  const topoDistanceData<Type>& neighbourInfo,
164  const scalar tol,
165  TrackingData& td
166  );
167 
168  //- Influence of neighbouring cell.
169  template<class TrackingData>
170  inline bool updateFace
171  (
172  const polyMesh&,
173  const label thisFacei,
174  const label neighbourCelli,
175  const topoDistanceData<Type>& neighbourInfo,
176  const scalar tol,
177  TrackingData& td
178  );
179 
180  //- Influence of different value on same face.
181  template<class TrackingData>
182  inline bool updateFace
183  (
184  const polyMesh&,
185  const label thisFacei,
186  const topoDistanceData<Type>& neighbourInfo,
187  const scalar tol,
188  TrackingData& td
189  );
190 
191  //- Test for equality, with TrackingData
192  template<class TrackingData>
193  inline bool equal
194  (
195  const topoDistanceData<Type>&,
196  TrackingData& td
197  ) const;
198 
199 
200  // Member Operators
201 
202  // Needed for List IO
203  inline bool operator==(const topoDistanceData<Type>&) const;
204 
205  inline bool operator!=(const topoDistanceData<Type>&) const;
206 
207 
208  // IOstream Operators
209 
210  friend Ostream& operator<< <Type>
211  (
212  Ostream&,
214  );
215  friend Istream& operator>> <Type>
216  (
217  Istream&,
219  );
220 };
221 
222 
223 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
224 
225 //- Data are contiguous if data type is contiguous
226 template<class Type>
227 struct is_contiguous<topoDistanceData<Type>> : is_contiguous<Type> {};
228 
229 //- Data are contiguous label if data type is label
230 template<class Type>
232  is_contiguous_label<Type> {};
233 
234 //- Data are contiguous scalar if data type is scalar
235 template<class Type>
237  is_contiguous_scalar<Type>{};
238 
239 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
240 
241 } // End namespace Foam
242 
243 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
244 
245 #ifdef NoRepository
246  #include "topoDistanceData.C"
247 #endif
248 
249 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250 
251 #include "topoDistanceDataI.H"
252 
253 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
254 
255 #endif
256 
257 // ************************************************************************* //
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
point.H
Foam::topoDistanceData::topoDistanceData
topoDistanceData()
Construct null with invalid (-1) for distance, null constructor.
Definition: topoDistanceDataI.H:34
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:230
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::topoDistanceData::enterDomain
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
Definition: topoDistanceDataI.H:108
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::topoDistanceData::data
const Type & data() const
Definition: topoDistanceData.H:101
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:68
Foam::topoDistanceData::operator==
bool operator==(const topoDistanceData< Type > &) const
Definition: topoDistanceDataI.H:206
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::topoDistanceData::operator!=
bool operator!=(const topoDistanceData< Type > &) const
Definition: topoDistanceDataI.H:216
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::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
topoDistanceData.C
topoDistanceDataI.H
Foam::Vector< scalar >
Foam::topoDistanceData::valid
bool valid(TrackingData &td) const
Changed or contains original (invalid) value.
Definition: topoDistanceDataI.H:57
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
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::is_contiguous
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:75
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