refinementDistanceData.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::refinementDistanceData
29 
30 Description
31  Transfers refinement levels such that slow transition between levels is
32  maintained. Used in FaceCellWave.
33 
34 SourceFiles
35  refinementDistanceDataI.H
36  refinementDistanceData.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef refinementDistanceData_H
41 #define refinementDistanceData_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 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  // Private Data
67 
68  //- Unrefined (level0) buffer size (nBufferLayers*level0Size)
69  scalar level0Size_;
70 
71  //- Nearest point with highest level
72  point origin_;
73  label originLevel_;
74 
75 
76  // Private Member Functions
77 
78  //- Updates with neighbouring data.
79  // \return 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  //- Default construct
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
108 
109  scalar level0Size() const
110  {
111  return level0Size_;
112  }
113  scalar& level0Size()
114  {
115  return level0Size_;
116  }
117 
118  const point& origin() const
119  {
120  return origin_;
121  }
122  point& origin()
123  {
124  return origin_;
125  }
126 
127  label originLevel() const
128  {
129  return originLevel_;
130  }
131  label& originLevel()
132  {
133  return originLevel_;
134  }
135 
136 
137  // Other
138 
139  //- Calculates the wanted level at a given point.
140  // Walks out from the origin.
141  inline label wantedLevel(const point& pt) const;
142 
143 
144  // Needed by FaceCellWave
145 
146  //- Changed or contains original (invalid) value
147  template<class TrackingData>
148  inline bool valid(TrackingData&) const;
149 
150  //- Check for identical geometrical data (eg, cyclics checking)
151  template<class TrackingData>
152  inline bool sameGeometry
153  (
154  const polyMesh&,
155  const refinementDistanceData&,
156  const scalar,
157  TrackingData&
158  ) const;
159 
160  //- Convert any absolute coordinates into relative to (patch)face
161  // centre
162  template<class TrackingData>
163  inline void leaveDomain
164  (
165  const polyMesh&,
166  const polyPatch&,
167  const label patchFacei,
168  const point& faceCentre,
169  TrackingData&
170  );
171 
172  //- Reverse of leaveDomain
173  template<class TrackingData>
174  inline void enterDomain
175  (
176  const polyMesh&,
177  const polyPatch&,
178  const label patchFacei,
179  const point& faceCentre,
180  TrackingData&
181  );
182 
183  //- Apply rotation matrix to any coordinates
184  template<class TrackingData>
185  inline void transform
186  (
187  const polyMesh&,
188  const tensor&,
189  TrackingData&
190  );
191 
192  //- Influence of neighbouring face.
193  template<class TrackingData>
194  inline bool updateCell
195  (
196  const polyMesh&,
197  const label thisCelli,
198  const label neighbourFacei,
199  const refinementDistanceData& neighbourInfo,
200  const scalar tol,
201  TrackingData&
202  );
203 
204  //- Influence of neighbouring cell.
205  template<class TrackingData>
206  inline bool updateFace
207  (
208  const polyMesh&,
209  const label thisFacei,
210  const label neighbourCelli,
211  const refinementDistanceData& neighbourInfo,
212  const scalar tol,
213  TrackingData&
214  );
215 
216  //- Influence of different value on same face.
217  template<class TrackingData>
218  inline bool updateFace
219  (
220  const polyMesh&,
221  const label thisFacei,
222  const refinementDistanceData& neighbourInfo,
223  const scalar tol,
224  TrackingData&
225  );
226 
227  //- Test for equality, with TrackingData
228  template<class TrackingData>
229  inline bool equal(const refinementDistanceData&, TrackingData&)
230  const;
231 
232 
233  // Member Operators
234 
235  //- Test for equality
236  inline bool operator==(const refinementDistanceData&) const;
237 
238  //- Test for inequality
239  inline bool operator!=(const refinementDistanceData&) const;
240 
241 
242  // IOstream Operators
243 
244  friend Ostream& operator<<(Ostream&, const refinementDistanceData&);
245  friend Istream& operator>>(Istream&, refinementDistanceData&);
246 };
247 
248 
249 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
250 
251 //- Contiguous data for refinementDistanceData
252 template<> struct is_contiguous<refinementDistanceData> : std::true_type {};
253 
254 
255 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256 
257 } // End namespace Foam
258 
259 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
260 
261 #include "refinementDistanceDataI.H"
262 
263 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
264 
265 #endif
266 
267 // ************************************************************************* //
Foam::Tensor< scalar >
Foam::refinementDistanceData::originLevel
label originLevel() const
Definition: refinementDistanceData.H:126
Foam::refinementDistanceData::sameGeometry
bool sameGeometry(const polyMesh &, const refinementDistanceData &, const scalar, TrackingData &) const
Check for identical geometrical data (eg, cyclics checking)
Definition: refinementDistanceDataI.H:157
Foam::refinementDistanceData::updateCell
bool updateCell(const polyMesh &, const label thisCelli, const label neighbourFacei, const refinementDistanceData &neighbourInfo, const scalar tol, TrackingData &)
Influence of neighbouring face.
Definition: refinementDistanceDataI.H:213
point.H
Foam::refinementDistanceData::level0Size
scalar level0Size() const
Definition: refinementDistanceData.H:108
Foam::refinementDistanceData::valid
bool valid(TrackingData &) const
Changed or contains original (invalid) value.
Definition: refinementDistanceDataI.H:148
Foam::refinementDistanceData::operator==
bool operator==(const refinementDistanceData &) const
Test for equality.
Definition: refinementDistanceDataI.H:284
Foam::refinementDistanceData::refinementDistanceData
refinementDistanceData()
Default construct.
Definition: refinementDistanceDataI.H:126
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::refinementDistanceData
Transfers refinement levels such that slow transition between levels is maintained....
Definition: refinementDistanceData.H:63
Foam::refinementDistanceData::operator>>
friend Istream & operator>>(Istream &, refinementDistanceData &)
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::refinementDistanceData::updateFace
bool updateFace(const polyMesh &, const label thisFacei, const label neighbourCelli, const refinementDistanceData &neighbourInfo, const scalar tol, TrackingData &)
Influence of neighbouring cell.
Definition: refinementDistanceDataI.H:231
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::refinementDistanceData::operator!=
bool operator!=(const refinementDistanceData &) const
Test for inequality.
Definition: refinementDistanceDataI.H:296
refinementDistanceDataI.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::refinementDistanceData::enterDomain
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &)
Reverse of leaveDomain.
Definition: refinementDistanceDataI.H:197
Foam::refinementDistanceData::level0Size
scalar & level0Size()
Definition: refinementDistanceData.H:112
Foam::refinementDistanceData::transform
void transform(const polyMesh &, const tensor &, TrackingData &)
Apply rotation matrix to any coordinates.
Definition: refinementDistanceDataI.H:184
Foam::refinementDistanceData::equal
bool equal(const refinementDistanceData &, TrackingData &) const
Test for equality, with TrackingData.
Definition: refinementDistanceDataI.H:265
Foam::refinementDistanceData::originLevel
label & originLevel()
Definition: refinementDistanceData.H:130
Foam::Vector< scalar >
Foam::refinementDistanceData::operator<<
friend Ostream & operator<<(Ostream &, const refinementDistanceData &)
Foam::refinementDistanceData::origin
point & origin()
Definition: refinementDistanceData.H:121
Foam::refinementDistanceData::leaveDomain
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &)
Convert any absolute coordinates into relative to (patch)face.
Definition: refinementDistanceDataI.H:170
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::point
vector point
Point is a vector.
Definition: point.H:43
Foam::tensor
Tensor< scalar > tensor
Tensor of scalars, i.e. Tensor<scalar>.
Definition: symmTensor.H:61
Foam::refinementDistanceData::origin
const point & origin() const
Definition: refinementDistanceData.H:117
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::refinementDistanceData::wantedLevel
label wantedLevel(const point &pt) const
Calculates the wanted level at a given point.
Definition: refinementDistanceDataI.H:35