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 | Copyright (C) 2011-2013 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  Class topoDistanceData Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class topoDistanceData
55 {
56  // Private data
57 
58  //- Starting data
59  label data_;
60 
61  //- Distance
62  label distance_;
63 
64 
65 public:
66 
67  // Constructors
68 
69  //- Construct null
70  inline topoDistanceData();
71 
72  //- Construct from count
73  inline topoDistanceData
74  (
75  const label data,
76  const label distance
77  );
78 
79 
80  // Member Functions
81 
82  // Access
83 
84 
85  inline label data() const
86  {
87  return data_;
88  }
89  inline label distance() const
90  {
91  return distance_;
92  }
93 
94 
95  // Needed by FaceCellWave
96 
97  //- Check whether origin has been changed at all or
98  // still contains original (invalid) value.
99  template<class TrackingData>
100  inline bool valid(TrackingData& td) const;
101 
102  //- Check for identical geometrical data. Used for cyclics checking.
103  template<class TrackingData>
104  inline bool sameGeometry
105  (
106  const polyMesh&,
107  const topoDistanceData&,
108  const scalar,
109  TrackingData& td
110  ) const;
111 
112  //- Convert any absolute coordinates into relative to (patch)face
113  // centre
114  template<class TrackingData>
115  inline void leaveDomain
116  (
117  const polyMesh&,
118  const polyPatch&,
119  const label patchFaceI,
120  const point& faceCentre,
121  TrackingData& td
122  );
123 
124  //- Reverse of leaveDomain
125  template<class TrackingData>
126  inline void enterDomain
127  (
128  const polyMesh&,
129  const polyPatch&,
130  const label patchFaceI,
131  const point& faceCentre,
132  TrackingData& td
133  );
134 
135  //- Apply rotation matrix to any coordinates
136  template<class TrackingData>
137  inline void transform
138  (
139  const polyMesh&,
140  const tensor&,
141  TrackingData& td
142  );
143 
144  //- Influence of neighbouring face.
145  template<class TrackingData>
146  inline bool updateCell
147  (
148  const polyMesh&,
149  const label thisCellI,
150  const label neighbourFaceI,
151  const topoDistanceData& neighbourInfo,
152  const scalar tol,
153  TrackingData& td
154  );
155 
156  //- Influence of neighbouring cell.
157  template<class TrackingData>
158  inline bool updateFace
159  (
160  const polyMesh&,
161  const label thisFaceI,
162  const label neighbourCellI,
163  const topoDistanceData& neighbourInfo,
164  const scalar tol,
165  TrackingData& td
166  );
167 
168  //- Influence of different value on same face.
169  template<class TrackingData>
170  inline bool updateFace
171  (
172  const polyMesh&,
173  const label thisFaceI,
174  const topoDistanceData& neighbourInfo,
175  const scalar tol,
176  TrackingData& td
177  );
178 
179  //- Same (like operator==)
180  template<class TrackingData>
181  inline bool equal(const topoDistanceData&, TrackingData& td) const;
182 
183  // Member Operators
184 
185  // Needed for List IO
186  inline bool operator==(const topoDistanceData&) const;
187 
188  inline bool operator!=(const topoDistanceData&) const;
189 
190 
191  // IOstream Operators
192 
193  friend Ostream& operator<<(Ostream&, const topoDistanceData&);
195 };
196 
197 
198 //- Data associated with topoDistanceData type are contiguous
199 template<>
200 inline bool contiguous<topoDistanceData>()
201 {
202  return true;
203 }
204 
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 } // End namespace Foam
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 #include "topoDistanceDataI.H"
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 #endif
217 
218 // ************************************************************************* //
bool updateFace(const polyMesh &, const label thisFaceI, const label neighbourCellI, const topoDistanceData &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
bool updateCell(const polyMesh &, const label thisCellI, const label neighbourFaceI, const topoDistanceData &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFaceI, const point &faceCentre, TrackingData &td)
Convert any absolute coordinates into relative to (patch)face.
For use with FaceCellWave. Determines topological distance to starting faces.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
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
Database for solution data, solver performance and other reduced data.
Definition: data.H:52
Namespace for OpenFOAM.
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
bool contiguous< topoDistanceData >()
Data associated with topoDistanceData type are contiguous.
void transform(const polyMesh &, const tensor &, TrackingData &td)
Apply rotation matrix to any coordinates.
bool operator==(const topoDistanceData &) const
friend Istream & operator>>(Istream &, topoDistanceData &)
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
bool sameGeometry(const polyMesh &, const topoDistanceData &, const scalar, TrackingData &td) const
Check for identical geometrical data. Used for cyclics checking.
bool operator!=(const topoDistanceData &) const
topoDistanceData()
Construct null.
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
friend Ostream & operator<<(Ostream &, const topoDistanceData &)
bool equal(const topoDistanceData &, TrackingData &td) const
Same (like operator==)
void enterDomain(const polyMesh &, const polyPatch &, const label patchFaceI, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.