refinementData.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-2020 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::refinementData
29 
30 Description
31  Transfers refinement levels such that slow transition between levels is
32  maintained. Used in FaceCellWave.
33 
34 SourceFiles
35  refinementDataI.H
36  refinementData.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef refinementData_H
41 #define refinementData_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 refinementData;
55 
56 Istream& operator>>(Istream&, refinementData&);
57 Ostream& operator<<(Ostream&, const refinementData&);
58 
59 /*---------------------------------------------------------------------------*\
60  Class refinementData Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 class refinementData
64 {
65  // Private Data
66 
67  //- Count which triggers refinement
68  label refinementCount_;
69 
70  //- Refinement level
71  label count_;
72 
73 public:
74 
75  // Constructors
76 
77  //- Default construct
78  inline refinementData();
79 
80  //- Construct from count
81  inline refinementData(const label refinementCount, const label count);
82 
83 
84  // Member Functions
85 
86  // Access
87 
88  label refinementCount() const
89  {
90  return refinementCount_;
91  }
92  label& refinementCount()
93  {
94  return refinementCount_;
95  }
96 
97  label count() const
98  {
99  return count_;
100  }
101  label& count()
102  {
103  return count_;
104  }
105 
106  bool isRefined() const
107  {
108  return count_ >= refinementCount_;
109  }
110 
111 
112 
113  // Needed by FaceCellWave
114 
115  //- Changed or contains original (invalid) value
116  template<class TrackingData>
117  inline bool valid(TrackingData& td) const;
118 
119  //- Check for identical geometrical data (eg, cyclics checking)
120  template<class TrackingData>
121  inline bool sameGeometry
122  (
123  const polyMesh&,
124  const refinementData&,
125  const scalar,
126  TrackingData& td
127  ) const;
128 
129  //- Convert any absolute coordinates into relative to (patch)face
130  // centre
131  template<class TrackingData>
132  inline void leaveDomain
133  (
134  const polyMesh&,
135  const polyPatch&,
136  const label patchFacei,
137  const point& faceCentre,
138  TrackingData& td
139  );
140 
141  //- Reverse of leaveDomain
142  template<class TrackingData>
143  inline void enterDomain
144  (
145  const polyMesh&,
146  const polyPatch&,
147  const label patchFacei,
148  const point& faceCentre,
149  TrackingData& td
150  );
151 
152  //- Apply rotation matrix to any coordinates
153  template<class TrackingData>
154  inline void transform
155  (
156  const polyMesh&,
157  const tensor&,
158  TrackingData& td
159  );
160 
161  //- Influence of neighbouring face.
162  template<class TrackingData>
163  inline bool updateCell
164  (
165  const polyMesh&,
166  const label thisCelli,
167  const label neighbourFacei,
168  const refinementData& neighbourInfo,
169  const scalar tol,
170  TrackingData& td
171  );
172 
173  //- Influence of neighbouring cell.
174  template<class TrackingData>
175  inline bool updateFace
176  (
177  const polyMesh&,
178  const label thisFacei,
179  const label neighbourCelli,
180  const refinementData& neighbourInfo,
181  const scalar tol,
182  TrackingData& td
183  );
184 
185  //- Influence of different value on same face.
186  template<class TrackingData>
187  inline bool updateFace
188  (
189  const polyMesh&,
190  const label thisFacei,
191  const refinementData& neighbourInfo,
192  const scalar tol,
193  TrackingData& td
194  );
195 
196  //- Test for equality, with TrackingData
197  template<class TrackingData>
198  inline bool equal(const refinementData&, TrackingData& td) const;
199 
200 
201  // Member Operators
202 
203  //- Test for equality
204  inline bool operator==(const refinementData&) const;
205 
206  //- Test for inequality
207  inline bool operator!=(const refinementData&) const;
208 
209 
210  // IOstream Operators
211 
212  friend Ostream& operator<<(Ostream&, const refinementData&);
213  friend Istream& operator>>(Istream&, refinementData&);
214 };
215 
216 
217 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
218 
219 //- Contiguous data for refinementData
220 template<> struct is_contiguous<refinementData> : std::true_type {};
221 
222 //- Contiguous label data for refinementData
223 template<> struct is_contiguous_label<refinementData> : std::true_type {};
224 
225 
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 
228 } // End namespace Foam
229 
230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231 
232 #include "refinementDataI.H"
233 
234 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
235 
236 #endif
237 
238 // ************************************************************************* //
Foam::Tensor
A templated (3 x 3) tensor of objects of <T> derived from MatrixSpace.
Definition: complexI.H:268
Foam::refinementData::leaveDomain
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Definition: refinementDataI.H:68
Foam::refinementData::operator>>
friend Istream & operator>>(Istream &, refinementData &)
Foam::refinementData
Transfers refinement levels such that slow transition between levels is maintained....
Definition: refinementData.H:58
Foam::refinementData::refinementCount
label refinementCount() const
Definition: refinementData.H:83
Foam::refinementData::refinementCount
label & refinementCount()
Definition: refinementData.H:87
point.H
Foam::refinementData::valid
bool valid(TrackingData &td) const
Definition: refinementDataI.H:45
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:223
tensor.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:73
Foam::is_contiguous_label
A template class to specify if a data type is composed solely of Foam::label elements.
Definition: contiguous.H:79
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Definition: boundaryPatch.C:76
Foam::refinementData::operator==
bool operator==(const refinementData &) const
Definition: refinementDataI.H:247
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:64
Foam::refinementData::operator<<
friend Ostream & operator<<(Ostream &, const refinementData &)
Foam::refinementData::refinementData
refinementData()
Definition: refinementDataI.H:24
Foam::refinementData::equal
bool equal(const refinementData &, TrackingData &td) const
Definition: refinementDataI.H:235
Foam
Definition: atmBoundaryLayer.C:26
Foam::refinementData::isRefined
bool isRefined() const
Definition: refinementData.H:101
Foam::refinementData::operator!=
bool operator!=(const refinementData &) const
Definition: refinementDataI.H:256
Foam::refinementData::enterDomain
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Definition: refinementDataI.H:92
Foam::Vector< scalar >
refinementDataI.H
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:52
Foam::refinementData::updateCell
bool updateCell(const polyMesh &, const label thisCelli, const label neighbourFacei, const refinementData &neighbourInfo, const scalar tol, TrackingData &td)
Definition: refinementDataI.H:105
Foam::point
vector point
Point is a vector.
Definition: point.H:37
Foam::refinementData::updateFace
bool updateFace(const polyMesh &, const label thisFacei, const label neighbourCelli, const refinementData &neighbourInfo, const scalar tol, TrackingData &td)
Definition: refinementDataI.H:167
Foam::tensor
Tensor< scalar > tensor
Tensor of scalars, i.e. Tensor<scalar>.
Definition: symmTensor.H:57
Foam::refinementData::count
label count() const
Definition: refinementData.H:92
Foam::is_contiguous
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:71
Foam::refinementData::sameGeometry
bool sameGeometry(const polyMesh &, const refinementData &, const scalar, TrackingData &td) const
Definition: refinementDataI.H:54
Foam::refinementData::transform
void transform(const polyMesh &, const tensor &, TrackingData &td)
Definition: refinementDataI.H:81
Foam::refinementData::count
label & count()
Definition: refinementData.H:96