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;
54class refinementDistanceData;
55
56Istream& operator>>(Istream&, refinementDistanceData&);
57Ostream& operator<<(Ostream&, const refinementDistanceData&);
58
59
60/*---------------------------------------------------------------------------*\
61 Class refinementDistanceData Declaration
62\*---------------------------------------------------------------------------*/
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
109 scalar level0Size() const
110 {
111 return level0Size_;
113 scalar& level0Size()
114 {
115 return level0Size_;
116 }
118 const point& origin() const
119 {
120 return origin_;
122 point& origin()
123 {
124 return origin_;
125 }
127 label originLevel() const
128 {
129 return originLevel_;
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
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
246};
247
248
249// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
250
251//- Contiguous data for refinementDistanceData
252template<> struct is_contiguous<refinementDistanceData> : std::true_type {};
253
254
255// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
256
257} // End namespace Foam
258
259// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
260
262
263// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
264
265#endif
266
267// ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:75
Transfers refinement levels such that slow transition between levels is maintained....
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.
refinementDistanceData()
Default construct.
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.
Tensor of scalars, i.e. Tensor<scalar>.
mesh update()
Namespace for OpenFOAM.
vector point
Point is a vector.
Definition: point.H:43
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Istream & operator>>(Istream &, directionInfo &)
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:78