topoDistanceData.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::topoDistanceData
26 
27 Description
28  For use with FaceCellWave. Determines topological distance to starting faces
29 
30 SourceFiles
31  topoDistanceDataI.H
32  topoDistanceData.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef topoDistanceData_H
37 #define topoDistanceData_H
38 
39 #include "point.H"
40 #include "tensor.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 class polyPatch;
48 class polyMesh;
49 
50 
51 // Forward declaration of friend functions and operators
52 
53 class topoDistanceData;
54 
55 Istream& operator>>(Istream&, topoDistanceData&);
56 Ostream& operator<<(Ostream&, const topoDistanceData&);
57 
58 
59 /*---------------------------------------------------------------------------*\
60  Class topoDistanceData Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 class topoDistanceData
64 {
65  // Private Data
66 
67  //- Starting data
68  label data_;
69 
70  //- Distance
71  label distance_;
72 
73 
74 public:
75 
76  // Constructors
77 
78  //- Construct null
79  inline topoDistanceData();
80 
81  //- Construct from count
82  inline topoDistanceData
83  (
84  const label data,
85  const label distance
86  );
87 
88 
89  // Member Functions
90 
91  // Access
92 
93 
94  inline label data() const
95  {
96  return data_;
97  }
98  inline label distance() const
99  {
100  return distance_;
101  }
102 
103 
104  // Needed by FaceCellWave
105 
106  //- Check whether origin has been changed at all or
107  // still contains original (invalid) value.
108  template<class TrackingData>
109  inline bool valid(TrackingData& td) const;
110 
111  //- Check for identical geometrical data. Used for cyclics checking.
112  template<class TrackingData>
113  inline bool sameGeometry
114  (
115  const polyMesh&,
116  const topoDistanceData&,
117  const scalar,
118  TrackingData& td
119  ) const;
120 
121  //- Convert any absolute coordinates into relative to (patch)face
122  // centre
123  template<class TrackingData>
124  inline void leaveDomain
125  (
126  const polyMesh&,
127  const polyPatch&,
128  const label patchFacei,
129  const point& faceCentre,
130  TrackingData& td
131  );
132 
133  //- Reverse of leaveDomain
134  template<class TrackingData>
135  inline void enterDomain
136  (
137  const polyMesh&,
138  const polyPatch&,
139  const label patchFacei,
140  const point& faceCentre,
141  TrackingData& td
142  );
143 
144  //- Apply rotation matrix to any coordinates
145  template<class TrackingData>
146  inline void transform
147  (
148  const polyMesh&,
149  const tensor&,
150  TrackingData& td
151  );
152 
153  //- Influence of neighbouring face.
154  template<class TrackingData>
155  inline bool updateCell
156  (
157  const polyMesh&,
158  const label thisCelli,
159  const label neighbourFacei,
160  const topoDistanceData& neighbourInfo,
161  const scalar tol,
162  TrackingData& td
163  );
164 
165  //- Influence of neighbouring cell.
166  template<class TrackingData>
167  inline bool updateFace
168  (
169  const polyMesh&,
170  const label thisFacei,
171  const label neighbourCelli,
172  const topoDistanceData& neighbourInfo,
173  const scalar tol,
174  TrackingData& td
175  );
176 
177  //- Influence of different value on same face.
178  template<class TrackingData>
179  inline bool updateFace
180  (
181  const polyMesh&,
182  const label thisFacei,
183  const topoDistanceData& neighbourInfo,
184  const scalar tol,
185  TrackingData& td
186  );
187 
188  //- Same (like operator==)
189  template<class TrackingData>
190  inline bool equal(const topoDistanceData&, TrackingData& td) const;
191 
192  // Member Operators
193 
194  // Needed for List IO
195  inline bool operator==(const topoDistanceData&) const;
196 
197  inline bool operator!=(const topoDistanceData&) const;
198 
199 
200  // IOstream Operators
201 
202  friend Ostream& operator<<(Ostream&, const topoDistanceData&);
204 };
205 
206 
207 //- Data associated with topoDistanceData type are contiguous
208 template<>
209 inline bool contiguous<topoDistanceData>()
210 {
211  return true;
212 }
213 
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 } // End namespace Foam
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 #include "topoDistanceDataI.H"
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 #endif
226 
227 // ************************************************************************* //
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
bool contiguous< topoDistanceData >()
Data associated with topoDistanceData type are contiguous.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
friend Istream & operator>>(Istream &, topoDistanceData &)
bool updateCell(const polyMesh &, const label thisCelli, const label neighbourFacei, const topoDistanceData &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
bool equal(const topoDistanceData &, TrackingData &td) const
Same (like operator==)
bool sameGeometry(const polyMesh &, const topoDistanceData &, const scalar, TrackingData &td) const
Check for identical geometrical data. Used for cyclics checking.
void transform(const polyMesh &, const tensor &, TrackingData &td)
Apply rotation matrix to any coordinates.
Istream & operator>>(Istream &, directionInfo &)
bool updateFace(const polyMesh &, const label thisFacei, const label neighbourCelli, const topoDistanceData &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
bool operator==(const topoDistanceData &) const
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
Database for solution and other reduced data.
Definition: data.H:51
topoDistanceData()
Construct null.
Ostream & operator<<(Ostream &, const ensightPart &)
For use with FaceCellWave. Determines topological distance to starting faces.
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:66
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
bool operator!=(const topoDistanceData &) const
Namespace for OpenFOAM.
friend Ostream & operator<<(Ostream &, const topoDistanceData &)
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Convert any absolute coordinates into relative to (patch)face.