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 | Copyright (C) 2011-2015 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 
51 /*---------------------------------------------------------------------------*\
52  Class refinementDistanceData Declaration
53 \*---------------------------------------------------------------------------*/
54 
56 {
57 
58  // Private data
59 
60  //- Unrefined (level0) buffer size (nBufferLayers*level0Size)
61  scalar level0Size_;
62 
63  //- Nearest point with highest level
66 
67 
68  // Private Member Functions
69 
70  //- Updates with neighbouring data. Returns true if something changed.
71  template<class TrackingData>
72  inline bool update
73  (
74  const point&,
75  const refinementDistanceData& neighbourInfo,
76  const scalar tol,
77  TrackingData&
78  );
79 
80 public:
81 
82  // Constructors
83 
84  //- Construct null
85  inline refinementDistanceData();
86 
87  //- Construct from count
89  (
90  const scalar level0Size,
91  const point& origin,
92  const label level
93  );
94 
95 
96  // Member Functions
97 
98  // Access
99 
100  inline scalar level0Size() const
101  {
102  return level0Size_;
103  }
104 
105  inline scalar& level0Size()
106  {
107  return level0Size_;
108  }
109 
110  inline const point& origin() const
111  {
112  return origin_;
113  }
114 
115  inline point& origin()
116  {
117  return origin_;
118  }
119 
120  inline label originLevel() const
121  {
122  return originLevel_;
123  }
124 
125  inline label& originLevel()
126  {
127  return originLevel_;
128  }
129 
130 
131  // Other
132 
133  //- Calculates the wanted level at a given point. Walks out from
134  // the origin.
135  inline label wantedLevel(const point& pt) const;
136 
137 
138  // Needed by FaceCellWave
139 
140  //- Check whether origin has been changed at all or
141  // still contains original (invalid) value.
142  template<class TrackingData>
143  inline bool valid(TrackingData&) const;
144 
145  //- Check for identical geometrical data. Used for cyclics checking.
146  template<class TrackingData>
147  inline bool sameGeometry
148  (
149  const polyMesh&,
150  const refinementDistanceData&,
151  const scalar,
152  TrackingData&
153  ) const;
154 
155  //- Convert any absolute coordinates into relative to (patch)face
156  // centre
157  template<class TrackingData>
158  inline void leaveDomain
159  (
160  const polyMesh&,
161  const polyPatch&,
162  const label patchFaceI,
163  const point& faceCentre,
164  TrackingData&
165  );
166 
167  //- Reverse of leaveDomain
168  template<class TrackingData>
169  inline void enterDomain
170  (
171  const polyMesh&,
172  const polyPatch&,
173  const label patchFaceI,
174  const point& faceCentre,
175  TrackingData&
176  );
177 
178  //- Apply rotation matrix to any coordinates
179  template<class TrackingData>
180  inline void transform
181  (
182  const polyMesh&,
183  const tensor&,
184  TrackingData&
185  );
186 
187  //- Influence of neighbouring face.
188  template<class TrackingData>
189  inline bool updateCell
190  (
191  const polyMesh&,
192  const label thisCellI,
193  const label neighbourFaceI,
194  const refinementDistanceData& neighbourInfo,
195  const scalar tol,
196  TrackingData&
197  );
198 
199  //- Influence of neighbouring cell.
200  template<class TrackingData>
201  inline bool updateFace
202  (
203  const polyMesh&,
204  const label thisFaceI,
205  const label neighbourCellI,
206  const refinementDistanceData& neighbourInfo,
207  const scalar tol,
208  TrackingData&
209  );
210 
211  //- Influence of different value on same face.
212  template<class TrackingData>
213  inline bool updateFace
214  (
215  const polyMesh&,
216  const label thisFaceI,
217  const refinementDistanceData& neighbourInfo,
218  const scalar tol,
219  TrackingData&
220  );
221 
222  //- Same (like operator==)
223  template<class TrackingData>
224  inline bool equal
225  (
226  const refinementDistanceData&,
227  TrackingData&
228  ) const;
229 
230  // Member Operators
231 
232  // Needed for List IO
233  inline bool operator==(const refinementDistanceData&) const;
234 
235  inline bool operator!=(const refinementDistanceData&) const;
236 
237 
238  // IOstream Operators
239 
242 };
243 
244 
245 //- Data associated with refinementDistanceData type are contiguous
246 template<>
248 {
249  return true;
250 }
251 
252 
253 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
254 
255 } // End namespace Foam
256 
257 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
258 
259 #include "refinementDistanceDataI.H"
260 
261 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
262 
263 #endif
264 
265 // ************************************************************************* //
Foam::Tensor
Templated 3D tensor derived from VectorSpace adding construction from 9 components,...
Definition: complexI.H:224
Foam::refinementDistanceData::originLevel
label originLevel() const
Definition: refinementDistanceData.H:119
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:157
Foam::refinementDistanceData::level0Size_
scalar level0Size_
Unrefined (level0) buffer size (nBufferLayers*level0Size)
Definition: refinementDistanceData.H:60
point.H
Foam::refinementDistanceData::level0Size
scalar level0Size() const
Definition: refinementDistanceData.H:99
Foam::refinementDistanceData::valid
bool valid(TrackingData &) const
Check whether origin has been changed at all or.
Definition: refinementDistanceDataI.H:148
Foam::refinementDistanceData::operator==
bool operator==(const refinementDistanceData &) const
Definition: refinementDistanceDataI.H:291
Foam::refinementDistanceData::refinementDistanceData
refinementDistanceData()
Construct null.
Definition: refinementDistanceDataI.H:125
Foam::refinementDistanceData::origin_
point origin_
Nearest point with highest level.
Definition: refinementDistanceData.H:63
Foam::refinementDistanceData::originLevel_
label originLevel_
Definition: refinementDistanceData.H:64
tensor.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
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
Foam::refinementDistanceData
Transfers refinement levels such that slow transition between levels is maintained....
Definition: refinementDistanceData.H:54
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:59
Foam::contiguous< refinementDistanceData >
bool contiguous< refinementDistanceData >()
Data associated with refinementDistanceData type are contiguous.
Definition: refinementDistanceData.H:246
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
Foam::refinementDistanceData::update
bool update(const point &, const refinementDistanceData &neighbourInfo, const scalar tol, TrackingData &)
Updates with neighbouring data. Returns true if something changed.
Definition: refinementDistanceDataI.H:62
Foam::refinementDistanceData::operator!=
bool operator!=(const refinementDistanceData &) const
Definition: refinementDistanceDataI.H:304
refinementDistanceDataI.H
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
Namespace for OpenFOAM.
Definition: combustionModel.C:30
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::refinementDistanceData::level0Size
scalar & level0Size()
Definition: refinementDistanceData.H:104
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
Same (like operator==)
Definition: refinementDistanceDataI.H:265
Foam::refinementDistanceData::originLevel
label & originLevel()
Definition: refinementDistanceData.H:124
Foam::Vector< scalar >
Foam::refinementDistanceData::operator<<
friend Ostream & operator<<(Ostream &, const refinementDistanceData &)
Foam::refinementDistanceData::origin
point & origin()
Definition: refinementDistanceData.H:114
Foam::refinementDistanceData::enterDomain
void enterDomain(const polyMesh &, const polyPatch &, const label patchFaceI, const point &faceCentre, TrackingData &)
Reverse of leaveDomain.
Definition: refinementDistanceDataI.H:197
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::refinementDistanceData::origin
const point & origin() const
Definition: refinementDistanceData.H:109
Foam::refinementDistanceData::wantedLevel
label wantedLevel(const point &pt) const
Calculates the wanted level at a given point. Walks out from.
Definition: refinementDistanceDataI.H:32