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 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. Returns true if something changed.
79  template<class TrackingData>
80  inline bool update
81  (
82  const point&,
83  const refinementDistanceData& neighbourInfo,
84  const scalar tol,
85  TrackingData&
86  );
87 
88 public:
89 
90  // Constructors
91 
92  //- Construct null
93  inline refinementDistanceData();
94 
95  //- Construct from count
97  (
98  const scalar level0Size,
99  const point& origin,
100  const label level
101  );
102 
103 
104  // Member Functions
105 
106  // Access
107 
108  inline scalar level0Size() const
109  {
110  return level0Size_;
111  }
112 
113  inline scalar& level0Size()
114  {
115  return level0Size_;
116  }
117 
118  inline const point& origin() const
119  {
120  return origin_;
121  }
122 
123  inline point& origin()
124  {
125  return origin_;
126  }
127 
128  inline label originLevel() const
129  {
130  return originLevel_;
131  }
132 
133  inline label& originLevel()
134  {
135  return originLevel_;
136  }
137 
138 
139  // Other
140 
141  //- Calculates the wanted level at a given point. Walks out from
142  // the origin.
143  inline label wantedLevel(const point& pt) const;
144 
145 
146  // Needed by FaceCellWave
147 
148  //- Check whether origin has been changed at all or
149  // still contains original (invalid) value.
150  template<class TrackingData>
151  inline bool valid(TrackingData&) const;
152 
153  //- Check for identical geometrical data. Used for cyclics checking.
154  template<class TrackingData>
155  inline bool sameGeometry
156  (
157  const polyMesh&,
158  const refinementDistanceData&,
159  const scalar,
160  TrackingData&
161  ) const;
162 
163  //- Convert any absolute coordinates into relative to (patch)face
164  // centre
165  template<class TrackingData>
166  inline void leaveDomain
167  (
168  const polyMesh&,
169  const polyPatch&,
170  const label patchFacei,
171  const point& faceCentre,
172  TrackingData&
173  );
174 
175  //- Reverse of leaveDomain
176  template<class TrackingData>
177  inline void enterDomain
178  (
179  const polyMesh&,
180  const polyPatch&,
181  const label patchFacei,
182  const point& faceCentre,
183  TrackingData&
184  );
185 
186  //- Apply rotation matrix to any coordinates
187  template<class TrackingData>
188  inline void transform
189  (
190  const polyMesh&,
191  const tensor&,
192  TrackingData&
193  );
194 
195  //- Influence of neighbouring face.
196  template<class TrackingData>
197  inline bool updateCell
198  (
199  const polyMesh&,
200  const label thisCelli,
201  const label neighbourFacei,
202  const refinementDistanceData& neighbourInfo,
203  const scalar tol,
204  TrackingData&
205  );
206 
207  //- Influence of neighbouring cell.
208  template<class TrackingData>
209  inline bool updateFace
210  (
211  const polyMesh&,
212  const label thisFacei,
213  const label neighbourCelli,
214  const refinementDistanceData& neighbourInfo,
215  const scalar tol,
216  TrackingData&
217  );
218 
219  //- Influence of different value on same face.
220  template<class TrackingData>
221  inline bool updateFace
222  (
223  const polyMesh&,
224  const label thisFacei,
225  const refinementDistanceData& neighbourInfo,
226  const scalar tol,
227  TrackingData&
228  );
229 
230  //- Same (like operator==)
231  template<class TrackingData>
232  inline bool equal
233  (
234  const refinementDistanceData&,
235  TrackingData&
236  ) const;
237 
238  // Member Operators
239 
240  // Needed for List IO
241  inline bool operator==(const refinementDistanceData&) const;
242 
243  inline bool operator!=(const refinementDistanceData&) const;
244 
245 
246  // IOstream Operators
247 
250 };
251 
252 
253 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
254 
255 //- Contiguous data for refinementDistanceData
256 template<> struct is_contiguous<refinementDistanceData> : std::true_type {};
257 
258 
259 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
260 
261 } // End namespace Foam
262 
263 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
264 
265 #include "refinementDistanceDataI.H"
266 
267 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
268 
269 #endif
270 
271 // ************************************************************************* //
Foam::Tensor< scalar >
Foam::refinementDistanceData::originLevel
label originLevel() const
Definition: refinementDistanceData.H:127
Foam::refinementDistanceData::sameGeometry
bool sameGeometry(const polyMesh &, const refinementDistanceData &, const scalar, TrackingData &) const
Check for identical geometrical data. Used for cyclics checking.
Definition: refinementDistanceDataI.H:158
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:214
point.H
Foam::refinementDistanceData::level0Size
scalar level0Size() const
Definition: refinementDistanceData.H:107
Foam::refinementDistanceData::valid
bool valid(TrackingData &) const
Check whether origin has been changed at all or.
Definition: refinementDistanceDataI.H:149
Foam::refinementDistanceData::operator==
bool operator==(const refinementDistanceData &) const
Definition: refinementDistanceDataI.H:285
Foam::refinementDistanceData::refinementDistanceData
refinementDistanceData()
Construct null.
Definition: refinementDistanceDataI.H:126
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:228
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::label
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:62
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:232
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:66
Foam::refinementDistanceData::operator!=
bool operator!=(const refinementDistanceData &) const
Definition: refinementDistanceDataI.H:297
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:198
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:185
Foam::refinementDistanceData::equal
bool equal(const refinementDistanceData &, TrackingData &) const
Same (like operator==)
Definition: refinementDistanceDataI.H:266
Foam::refinementDistanceData::originLevel
label & originLevel()
Definition: refinementDistanceData.H:132
Foam::Vector< scalar >
Foam::refinementDistanceData::operator<<
friend Ostream & operator<<(Ostream &, const refinementDistanceData &)
Foam::refinementDistanceData::origin
point & origin()
Definition: refinementDistanceData.H:122
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:171
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &)
Definition: boundaryPatch.C:102
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. Walks out from.
Definition: refinementDistanceDataI.H:35