refinementDistanceData.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::refinementDistanceData
26 
27 Description
28  Transfers refinement levels such that slow transition between levels is
29  maintained. Used in FaceCellWave.
30 
31 SourceFiles
32  refinementDistanceDataI.H
33  refinementDistanceData.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef refinementDistanceData_H
38 #define refinementDistanceData_H
39 
40 #include "point.H"
41 #include "tensor.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 class polyPatch;
49 class polyMesh;
50 
51 
52 // Forward declaration of friend functions and operators
53 
54 class refinementDistanceData;
55 
56 Istream& operator>>(Istream&, refinementDistanceData&);
57 Ostream& operator<<(Ostream&, const refinementDistanceData&);
58 
59 
60 /*---------------------------------------------------------------------------*\
61  Class refinementDistanceData Declaration
62 \*---------------------------------------------------------------------------*/
63 
65 {
66 
67  // Private Data
68 
69  //- Unrefined (level0) buffer size (nBufferLayers*level0Size)
70  scalar level0Size_;
71 
72  //- Nearest point with highest level
73  point origin_;
74  label originLevel_;
75 
76 
77  // Private Member Functions
78 
79  //- Updates with neighbouring data. Returns true if something changed.
80  template<class TrackingData>
81  inline bool update
82  (
83  const point&,
84  const refinementDistanceData& neighbourInfo,
85  const scalar tol,
86  TrackingData&
87  );
88 
89 public:
90 
91  // Constructors
92 
93  //- Construct null
94  inline refinementDistanceData();
95 
96  //- Construct from count
98  (
99  const scalar level0Size,
100  const point& origin,
101  const label level
102  );
103 
104 
105  // Member Functions
106 
107  // Access
109  inline scalar level0Size() const
110  {
111  return level0Size_;
112  }
114  inline scalar& level0Size()
115  {
116  return level0Size_;
117  }
119  inline const point& origin() const
120  {
121  return origin_;
122  }
124  inline point& origin()
125  {
126  return origin_;
127  }
129  inline label originLevel() const
130  {
131  return originLevel_;
132  }
134  inline label& originLevel()
135  {
136  return originLevel_;
137  }
138 
139 
140  // Other
141 
142  //- Calculates the wanted level at a given point. Walks out from
143  // the origin.
144  inline label wantedLevel(const point& pt) const;
145 
146 
147  // Needed by FaceCellWave
148 
149  //- Check whether origin has been changed at all or
150  // still contains original (invalid) value.
151  template<class TrackingData>
152  inline bool valid(TrackingData&) const;
153 
154  //- Check for identical geometrical data. Used for cyclics checking.
155  template<class TrackingData>
156  inline bool sameGeometry
157  (
158  const polyMesh&,
159  const refinementDistanceData&,
160  const scalar,
161  TrackingData&
162  ) const;
163 
164  //- Convert any absolute coordinates into relative to (patch)face
165  // centre
166  template<class TrackingData>
167  inline void leaveDomain
168  (
169  const polyMesh&,
170  const polyPatch&,
171  const label patchFacei,
172  const point& faceCentre,
173  TrackingData&
174  );
175 
176  //- Reverse of leaveDomain
177  template<class TrackingData>
178  inline void enterDomain
179  (
180  const polyMesh&,
181  const polyPatch&,
182  const label patchFacei,
183  const point& faceCentre,
184  TrackingData&
185  );
186 
187  //- Apply rotation matrix to any coordinates
188  template<class TrackingData>
189  inline void transform
190  (
191  const polyMesh&,
192  const tensor&,
193  TrackingData&
194  );
195 
196  //- Influence of neighbouring face.
197  template<class TrackingData>
198  inline bool updateCell
199  (
200  const polyMesh&,
201  const label thisCelli,
202  const label neighbourFacei,
203  const refinementDistanceData& neighbourInfo,
204  const scalar tol,
205  TrackingData&
206  );
207 
208  //- Influence of neighbouring cell.
209  template<class TrackingData>
210  inline bool updateFace
211  (
212  const polyMesh&,
213  const label thisFacei,
214  const label neighbourCelli,
215  const refinementDistanceData& neighbourInfo,
216  const scalar tol,
217  TrackingData&
218  );
219 
220  //- Influence of different value on same face.
221  template<class TrackingData>
222  inline bool updateFace
223  (
224  const polyMesh&,
225  const label thisFacei,
226  const refinementDistanceData& neighbourInfo,
227  const scalar tol,
228  TrackingData&
229  );
230 
231  //- Same (like operator==)
232  template<class TrackingData>
233  inline bool equal
234  (
235  const refinementDistanceData&,
236  TrackingData&
237  ) const;
238 
239  // Member Operators
240 
241  // Needed for List IO
242  inline bool operator==(const refinementDistanceData&) const;
243 
244  inline bool operator!=(const refinementDistanceData&) const;
245 
246 
247  // IOstream Operators
248 
251 };
252 
253 
254 //- Data associated with refinementDistanceData type are contiguous
255 template<>
257 {
258  return true;
259 }
260 
261 
262 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
263 
264 } // End namespace Foam
265 
266 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
267 
268 #include "refinementDistanceDataI.H"
269 
270 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
271 
272 #endif
273 
274 // ************************************************************************* //
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &)
Reverse of leaveDomain.
label wantedLevel(const point &pt) const
Calculates the wanted level at a given point. Walks out from.
friend Ostream & operator<<(Ostream &, const refinementDistanceData &)
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 equal(const refinementDistanceData &, TrackingData &) const
Same (like operator==)
bool valid(TrackingData &) const
Check whether origin has been changed at all or.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
friend Istream & operator>>(Istream &, refinementDistanceData &)
bool operator!=(const refinementDistanceData &) const
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &)
Convert any absolute coordinates into relative to (patch)face.
Istream & operator>>(Istream &, directionInfo &)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
bool contiguous< refinementDistanceData >()
Data associated with refinementDistanceData type are contiguous.
bool operator==(const refinementDistanceData &) const
bool updateCell(const polyMesh &, const label thisCelli, const label neighbourFacei, const refinementDistanceData &neighbourInfo, const scalar tol, TrackingData &)
Influence of neighbouring face.
Ostream & operator<<(Ostream &, const ensightPart &)
bool sameGeometry(const polyMesh &, const refinementDistanceData &, const scalar, TrackingData &) const
Check for identical geometrical data. Used for cyclics checking.
bool updateFace(const polyMesh &, const label thisFacei, const label neighbourCelli, const refinementDistanceData &neighbourInfo, const scalar tol, TrackingData &)
Influence of neighbouring cell.
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 transform(const polyMesh &, const tensor &, TrackingData &)
Apply rotation matrix to any coordinates.
Transfers refinement levels such that slow transition between levels is maintained. Used in FaceCellWave.
Namespace for OpenFOAM.