FreeFOAM The Cross-Platform CFD Toolkit
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) 1991-2010 OpenCFD Ltd.
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 <OpenFOAM/point.H>
41 #include <OpenFOAM/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
64  point origin_;
65  label originLevel_;
66 
67 
68  // Private Member Functions
69 
70  //- Updates with neighbouring data. Returns true if something changed.
71  inline bool update
72  (
73  const point&,
74  const refinementDistanceData& neighbourInfo,
75  const scalar tol
76  );
77 
78 public:
79 
80  // Constructors
81 
82  //- Construct null
83  inline refinementDistanceData();
84 
85  //- Construct from count
87  (
88  const scalar level0Size,
89  const point& origin,
90  const label level
91  );
92 
93 
94  // Member Functions
95 
96  // Access
97 
98  inline scalar level0Size() const
99  {
100  return level0Size_;
101  }
102 
103  inline scalar& level0Size()
104  {
105  return level0Size_;
106  }
107 
108  inline const point& origin() const
109  {
110  return origin_;
111  }
112 
113  inline point& origin()
114  {
115  return origin_;
116  }
117 
118  inline label originLevel() const
119  {
120  return originLevel_;
121  }
122 
123  inline label& originLevel()
124  {
125  return originLevel_;
126  }
127 
128 
129  // Other
130 
131  //- Calculates the wanted level at a given point. Walks out from
132  // the origin.
133  inline label wantedLevel(const point& pt) const;
134 
135 
136  // Needed by FaceCellWave
137 
138  //- Check whether origin has been changed at all or
139  // still contains original (invalid) value.
140  inline bool valid() const;
141 
142  //- Check for identical geometrical data. Used for cyclics checking.
143  inline bool sameGeometry
144  (
145  const polyMesh&,
146  const refinementDistanceData&,
147  const scalar
148  ) const;
149 
150  //- Convert any absolute coordinates into relative to (patch)face
151  // centre
152  inline void leaveDomain
153  (
154  const polyMesh&,
155  const polyPatch&,
156  const label patchFaceI,
157  const point& faceCentre
158  );
159 
160  //- Reverse of leaveDomain
161  inline void enterDomain
162  (
163  const polyMesh&,
164  const polyPatch&,
165  const label patchFaceI,
166  const point& faceCentre
167  );
168 
169  //- Apply rotation matrix to any coordinates
170  inline void transform
171  (
172  const polyMesh&,
173  const tensor&
174  );
175 
176  //- Influence of neighbouring face.
177  inline bool updateCell
178  (
179  const polyMesh&,
180  const label thisCellI,
181  const label neighbourFaceI,
182  const refinementDistanceData& neighbourInfo,
183  const scalar tol
184  );
185 
186  //- Influence of neighbouring cell.
187  inline bool updateFace
188  (
189  const polyMesh&,
190  const label thisFaceI,
191  const label neighbourCellI,
192  const refinementDistanceData& neighbourInfo,
193  const scalar tol
194  );
195 
196  //- Influence of different value on same face.
197  inline bool updateFace
198  (
199  const polyMesh&,
200  const label thisFaceI,
201  const refinementDistanceData& neighbourInfo,
202  const scalar tol
203  );
204 
205  // Member Operators
206 
207  // Needed for List IO
208  inline bool operator==(const refinementDistanceData&) const;
209 
210  inline bool operator!=(const refinementDistanceData&) const;
211 
212 
213  // IOstream Operators
214 
217 };
218 
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 } // End namespace Foam
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 #endif
231 
232 // ************************ vim: set sw=4 sts=4 et: ************************ //