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-2022 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 class transformer;
51 
52 
53 // Forward declaration of friend functions and operators
54 
55 class refinementData;
56 
57 Istream& operator>>(Istream&, refinementData&);
58 Ostream& operator<<(Ostream&, const refinementData&);
59 
60 
61 /*---------------------------------------------------------------------------*\
62  Class refinementData Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 class refinementData
66 {
67  // Private Data
68 
69  //- Count which triggers refinement
70  label refinementCount_;
71 
72  //- Refinement level
73  label count_;
74 
75 public:
76 
77  // Constructors
78 
79  //- Construct null
80  inline refinementData();
81 
82  //- Construct from count
83  inline refinementData(const label refinementCount, const label count);
84 
85 
86  // Member Functions
87 
88  // Access
89 
90  inline label refinementCount() const
91  {
92  return refinementCount_;
93  }
94 
95  inline label& refinementCount()
96  {
97  return refinementCount_;
98  }
99 
100  inline label count() const
101  {
102  return count_;
103  }
104 
105  inline label& count()
106  {
107  return count_;
108  }
109 
110  inline bool isRefined() const
111  {
112  return count_ >= refinementCount_;
113  }
114 
115 
116 
117  // Needed by FaceCellWave
118 
119  //- Check whether origin has been changed at all or
120  // still contains original (invalid) value.
121  template<class TrackingData>
122  inline bool valid(TrackingData& td) const;
123 
124  //- Check for identical geometrical data. Used for cyclics checking.
125  template<class TrackingData>
126  inline bool sameGeometry
127  (
128  const polyMesh&,
129  const refinementData&,
130  const scalar,
131  TrackingData& td
132  ) const;
133 
134  //- Transform across an interface
135  template<class TrackingData>
136  inline void transform
137  (
138  const polyPatch& patch,
139  const label patchFacei,
140  const transformer& transform,
141  TrackingData& td
142  );
143 
144  //- Influence of neighbouring face.
145  template<class TrackingData>
146  inline bool updateCell
147  (
148  const polyMesh&,
149  const label thisCelli,
150  const label neighbourFacei,
151  const refinementData& neighbourInfo,
152  const scalar tol,
153  TrackingData& td
154  );
155 
156  //- Influence of neighbouring cell.
157  template<class TrackingData>
158  inline bool updateFace
159  (
160  const polyMesh&,
161  const label thisFacei,
162  const label neighbourCelli,
163  const refinementData& neighbourInfo,
164  const scalar tol,
165  TrackingData& td
166  );
167 
168  //- Influence of different value on same face.
169  template<class TrackingData>
170  inline bool updateFace
171  (
172  const polyMesh&,
173  const label thisFacei,
174  const refinementData& neighbourInfo,
175  const scalar tol,
176  TrackingData& td
177  );
178 
179  //- Same (like operator==)
180  template<class TrackingData>
181  inline bool equal(const refinementData&, TrackingData& td) const;
182 
183 
184  // Member Operators
185 
186  // Needed for List IO
187  inline bool operator==(const refinementData&) const;
188 
189  inline bool operator!=(const refinementData&) const;
190 
191 
192  // IOstream Operators
193 
196 };
197 
198 
199 //- Data associated with refinementData type are contiguous
200 template<>
201 inline bool contiguous<refinementData>()
202 {
203  return true;
204 }
205 
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 } // End namespace Foam
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 #include "refinementDataI.H"
214 
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 
217 #endif
218 
219 // ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:70
Transfers refinement levels such that slow transition between levels is maintained....
bool operator!=(const refinementData &) const
bool equal(const refinementData &, TrackingData &td) const
Same (like operator==)
bool isRefined() const
bool sameGeometry(const polyMesh &, const refinementData &, const scalar, TrackingData &td) const
Check for identical geometrical data. Used for cyclics checking.
friend Ostream & operator<<(Ostream &, const refinementData &)
label count() const
bool updateCell(const polyMesh &, const label thisCelli, const label neighbourFacei, const refinementData &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
label refinementCount() const
bool updateFace(const polyMesh &, const label thisFacei, const label neighbourCelli, const refinementData &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
void transform(const polyPatch &patch, const label patchFacei, const transformer &transform, TrackingData &td)
Transform across an interface.
refinementData()
Construct null.
friend Istream & operator>>(Istream &, refinementData &)
bool operator==(const refinementData &) const
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space.
Definition: transformer.H:84
Namespace for OpenFOAM.
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
bool contiguous< refinementData >()
Data associated with refinementData type are contiguous.
Istream & operator>>(Istream &, directionInfo &)
Ostream & operator<<(Ostream &, const ensightPart &)