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-2022 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 class transformer;
51 
52 
53 // Forward declaration of friend functions and operators
54 
55 class refinementDistanceData;
56 
57 Istream& operator>>(Istream&, refinementDistanceData&);
58 Ostream& operator<<(Ostream&, const refinementDistanceData&);
59 
60 
61 /*---------------------------------------------------------------------------*\
62  Class refinementDistanceData Declaration
63 \*---------------------------------------------------------------------------*/
64 
66 {
67 
68  // Private Data
69 
70  //- Unrefined (level0) buffer size (nBufferLayers*level0Size)
71  scalar level0Size_;
72 
73  //- Nearest point with highest level
74  point origin_;
75  label originLevel_;
76 
77 
78  // Private Member Functions
79 
80  //- Updates with neighbouring data. Returns true if something changed.
81  template<class TrackingData>
82  inline bool update
83  (
84  const point&,
85  const refinementDistanceData& neighbourInfo,
86  const scalar tol,
87  TrackingData&
88  );
89 
90 public:
91 
92  // Constructors
93 
94  //- Construct null
95  inline refinementDistanceData();
96 
97  //- Construct from count
99  (
100  const scalar level0Size,
101  const point& origin,
102  const label level
103  );
104 
105 
106  // Member Functions
107 
108  // Access
110  inline scalar level0Size() const
111  {
112  return level0Size_;
113  }
115  inline scalar& level0Size()
116  {
117  return level0Size_;
118  }
120  inline const point& origin() const
121  {
122  return origin_;
123  }
125  inline point& origin()
126  {
127  return origin_;
128  }
130  inline label originLevel() const
131  {
132  return originLevel_;
133  }
135  inline label& originLevel()
136  {
137  return originLevel_;
138  }
139 
140 
141  // Other
142 
143  //- Calculates the wanted level at a given point. Walks out from
144  // the origin.
145  inline label wantedLevel(const point& pt) const;
146 
147 
148  // Needed by FaceCellWave
149 
150  //- Check whether origin has been changed at all or
151  // still contains original (invalid) value.
152  template<class TrackingData>
153  inline bool valid(TrackingData&) const;
154 
155  //- Check for identical geometrical data. Used for cyclics checking.
156  template<class TrackingData>
157  inline bool sameGeometry
158  (
159  const polyMesh&,
160  const refinementDistanceData&,
161  const scalar,
162  TrackingData&
163  ) const;
164 
165  //- Transform across an interface
166  template<class TrackingData>
167  inline void transform
168  (
169  const polyPatch& patch,
170  const label patchFacei,
171  const transformer& transform,
172  TrackingData& td
173  );
174 
175  //- Influence of neighbouring face.
176  template<class TrackingData>
177  inline bool updateCell
178  (
179  const polyMesh&,
180  const label thisCelli,
181  const label neighbourFacei,
182  const refinementDistanceData& neighbourInfo,
183  const scalar tol,
184  TrackingData&
185  );
186 
187  //- Influence of neighbouring cell.
188  template<class TrackingData>
189  inline bool updateFace
190  (
191  const polyMesh&,
192  const label thisFacei,
193  const label neighbourCelli,
194  const refinementDistanceData& neighbourInfo,
195  const scalar tol,
196  TrackingData&
197  );
198 
199  //- Influence of different value on same face.
200  template<class TrackingData>
201  inline bool updateFace
202  (
203  const polyMesh&,
204  const label thisFacei,
205  const refinementDistanceData& neighbourInfo,
206  const scalar tol,
207  TrackingData&
208  );
209 
210  //- Same (like operator==)
211  template<class TrackingData>
212  inline bool equal
213  (
214  const refinementDistanceData&,
215  TrackingData&
216  ) const;
217 
218  // Member Operators
219 
220  // Needed for List IO
221  inline bool operator==(const refinementDistanceData&) const;
222 
223  inline bool operator!=(const refinementDistanceData&) const;
224 
225 
226  // IOstream Operators
227 
230 };
231 
232 
233 //- Data associated with refinementDistanceData type are contiguous
234 template<>
236 {
237  return true;
238 }
239 
240 
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 
243 } // End namespace Foam
244 
245 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246 
247 #include "refinementDistanceDataI.H"
248 
249 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250 
251 #endif
252 
253 // ************************************************************************* //
label wantedLevel(const point &pt) const
Calculates the wanted level at a given point. Walks out from.
void transform(const polyPatch &patch, const label patchFacei, const transformer &transform, TrackingData &td)
Transform across an interface.
friend Ostream & operator<<(Ostream &, const refinementDistanceData &)
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space...
Definition: transformer.H:83
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
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:76
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
Transfers refinement levels such that slow transition between levels is maintained. Used in FaceCellWave.
Namespace for OpenFOAM.