Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::refinementDistanceData
29
30Description
31 Transfers refinement levels such that slow transition between levels is
32 maintained. Used in FaceCellWave.
33
34SourceFiles
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
48namespace Foam
49{
50
51// Forward Declarations
52class polyPatch;
53class polyMesh;
55
58
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
89public:
90
91 // Constructors
92
93 //- Default construct
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
120 return origin_;
121 }
122 point& origin()
123 {
124 return origin_;
125 }
126
127 label originLevel() const
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&,
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 //- Interpolate between two values (lerp). Returns true if
233 //- causes changes. Not sure if needs to be specialised between
234 //- face and cell and what index is needed...
235 template<class TrackingData>
236 inline bool interpolate
237 (
238 const polyMesh&,
239 const point& pt,
240 const label i0,
241 const refinementDistanceData& f0,
242 const label i1,
243 const refinementDistanceData& f1,
244 const scalar weight,
245 const scalar tol,
246 TrackingData& td
247 );
248
249
250 // Member Operators
251
252 //- Test for equality
253 inline bool operator==(const refinementDistanceData&) const;
254
255 //- Test for inequality
256 inline bool operator!=(const refinementDistanceData&) const;
257
258
259 // IOstream Operators
260
263};
264
265
266// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
267
268//- Contiguous data for refinementDistanceData
269template<> struct is_contiguous<refinementDistanceData> : std::true_type {};
270
271
272// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
273
274} // End namespace Foam
275
276// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
277
279
280// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
281
282#endif
283
284// ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
A patch is a list of labels that address the faces in the global face list.
Definition polyPatch.H:73
Transfers refinement levels such that slow transition between levels is maintained....
bool interpolate(const polyMesh &, const point &pt, const label i0, const refinementDistanceData &f0, const label i1, const refinementDistanceData &f1, const scalar weight, const scalar tol, TrackingData &td)
Interpolate between two values (lerp). Returns true if causes changes. Not sure if needs to be specia...
bool updateCell(const polyMesh &, const label thisCelli, const label neighbourFacei, const refinementDistanceData &neighbourInfo, const scalar tol, TrackingData &)
Influence of neighbouring face.
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &)
Convert any absolute coordinates into relative to (patch)face.
bool operator!=(const refinementDistanceData &) const
Test for inequality.
friend Ostream & operator<<(Ostream &, const refinementDistanceData &)
bool sameGeometry(const polyMesh &, const refinementDistanceData &, const scalar, TrackingData &) const
Check for identical geometrical data (eg, cyclics checking).
bool updateFace(const polyMesh &, const label thisFacei, const label neighbourCelli, const refinementDistanceData &neighbourInfo, const scalar tol, TrackingData &)
Influence of neighbouring cell.
label wantedLevel(const point &pt) const
Calculates the wanted level at a given point.
bool valid(TrackingData &) const
Changed or contains original (invalid) value.
bool operator==(const refinementDistanceData &) const
Test for equality.
friend Istream & operator>>(Istream &, refinementDistanceData &)
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &)
Reverse of leaveDomain.
void transform(const polyMesh &, const tensor &, TrackingData &)
Apply rotation matrix to any coordinates.
bool equal(const refinementDistanceData &, TrackingData &) const
Test for equality, with TrackingData.
mesh update()
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
Namespace for OpenFOAM.
Tensor< scalar > tensor
Definition symmTensor.H:57
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
Istream & operator>>(Istream &, directionInfo &)
vector point
Point is a vector.
Definition point.H:37
A template class to specify that a data type can be considered as being contiguous in memory.
Definition contiguous.H:70