refinementData.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 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::refinementData
26 
27 Description
28  Transfers refinement levels such that slow transition between levels is
29  maintained. Used in FaceCellWave.
30 
31 SourceFiles
32  refinementDataI.H
33  refinementData.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef refinementData_H
38 #define refinementData_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 // Forward declaration of friend functions and operators
53 
54 class refinementData;
55 
56 Istream& operator>>(Istream&, refinementData&);
57 Ostream& operator<<(Ostream&, const refinementData&);
58 
59 
60 /*---------------------------------------------------------------------------*\
61  Class refinementData Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 class refinementData
65 {
66  // Private Data
67 
68  //- Count which triggers refinement
69  label refinementCount_;
70 
71  //- Refinement level
72  label count_;
73 
74 public:
75 
76  // Constructors
77 
78  //- Construct null
79  inline refinementData();
80 
81  //- Construct from count
82  inline refinementData(const label refinementCount, const label count);
83 
84 
85  // Member Functions
86 
87  // Access
88 
89  inline label refinementCount() const
90  {
91  return refinementCount_;
92  }
93 
94  inline label& refinementCount()
95  {
96  return refinementCount_;
97  }
98 
99  inline label count() const
100  {
101  return count_;
102  }
104  inline label& count()
105  {
106  return count_;
107  }
109  inline bool isRefined() const
110  {
111  return count_ >= refinementCount_;
112  }
113 
114 
115 
116  // Needed by FaceCellWave
117 
118  //- Check whether origin has been changed at all or
119  // still contains original (invalid) value.
120  template<class TrackingData>
121  inline bool valid(TrackingData& td) const;
122 
123  //- Check for identical geometrical data. Used for cyclics checking.
124  template<class TrackingData>
125  inline bool sameGeometry
126  (
127  const polyMesh&,
128  const refinementData&,
129  const scalar,
130  TrackingData& td
131  ) const;
132 
133  //- Convert any absolute coordinates into relative to (patch)face
134  // centre
135  template<class TrackingData>
136  inline void leaveDomain
137  (
138  const polyMesh&,
139  const polyPatch&,
140  const label patchFacei,
141  const point& faceCentre,
142  TrackingData& td
143  );
144 
145  //- Reverse of leaveDomain
146  template<class TrackingData>
147  inline void enterDomain
148  (
149  const polyMesh&,
150  const polyPatch&,
151  const label patchFacei,
152  const point& faceCentre,
153  TrackingData& td
154  );
155 
156  //- Apply rotation matrix to any coordinates
157  template<class TrackingData>
158  inline void transform
159  (
160  const polyMesh&,
161  const tensor&,
162  TrackingData& td
163  );
164 
165  //- Influence of neighbouring face.
166  template<class TrackingData>
167  inline bool updateCell
168  (
169  const polyMesh&,
170  const label thisCelli,
171  const label neighbourFacei,
172  const refinementData& neighbourInfo,
173  const scalar tol,
174  TrackingData& td
175  );
176 
177  //- Influence of neighbouring cell.
178  template<class TrackingData>
179  inline bool updateFace
180  (
181  const polyMesh&,
182  const label thisFacei,
183  const label neighbourCelli,
184  const refinementData& neighbourInfo,
185  const scalar tol,
186  TrackingData& td
187  );
188 
189  //- Influence of different value on same face.
190  template<class TrackingData>
191  inline bool updateFace
192  (
193  const polyMesh&,
194  const label thisFacei,
195  const refinementData& neighbourInfo,
196  const scalar tol,
197  TrackingData& td
198  );
199 
200  //- Same (like operator==)
201  template<class TrackingData>
202  inline bool equal(const refinementData&, TrackingData& td) const;
203 
204 
205  // Member Operators
206 
207  // Needed for List IO
208  inline bool operator==(const refinementData&) const;
209 
210  inline bool operator!=(const refinementData&) const;
211 
212 
213  // IOstream Operators
214 
215  friend Ostream& operator<<(Ostream&, const refinementData&);
217 };
218 
219 
220 //- Data associated with refinementData type are contiguous
221 template<>
222 inline bool contiguous<refinementData>()
223 {
224  return true;
225 }
226 
227 
228 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
229 
230 } // End namespace Foam
231 
232 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
233 
234 #include "refinementDataI.H"
235 
236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237 
238 #endif
239 
240 // ************************************************************************* //
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
refinementData()
Construct null.
bool updateCell(const polyMesh &, const label thisCelli, const label neighbourFacei, const refinementData &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
bool updateFace(const polyMesh &, const label thisFacei, const label neighbourCelli, const refinementData &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
bool sameGeometry(const polyMesh &, const refinementData &, const scalar, TrackingData &td) const
Check for identical geometrical data. Used for cyclics checking.
label refinementCount() const
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Convert any absolute coordinates into relative to (patch)face.
bool isRefined() const
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
Istream & operator>>(Istream &, directionInfo &)
label count() const
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
friend Istream & operator>>(Istream &, refinementData &)
Transfers refinement levels such that slow transition between levels is maintained. Used in FaceCellWave.
void transform(const polyMesh &, const tensor &, TrackingData &td)
Apply rotation matrix to any coordinates.
friend Ostream & operator<<(Ostream &, const refinementData &)
bool operator==(const refinementData &) const
Ostream & operator<<(Ostream &, const ensightPart &)
bool equal(const refinementData &, TrackingData &td) const
Same (like operator==)
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
bool operator!=(const refinementData &) const
bool contiguous< refinementData >()
Data associated with refinementData type are contiguous.
Namespace for OpenFOAM.