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 | Copyright (C) 2011 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  Class refinementData Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 class refinementData
56 {
57  // Private data
58 
59  //- Count which triggers refinement
61 
62  //- Refinement level
63  label count_;
64 
65 public:
66 
67  // Constructors
68 
69  //- Construct null
70  inline refinementData();
71 
72  //- Construct from count
73  inline refinementData(const label refinementCount, const label count);
74 
75 
76  // Member Functions
77 
78  // Access
79 
80  inline label refinementCount() const
81  {
82  return refinementCount_;
83  }
84 
85  inline label& refinementCount()
86  {
87  return refinementCount_;
88  }
89 
90  inline label count() const
91  {
92  return count_;
93  }
94 
95  inline label& count()
96  {
97  return count_;
98  }
99 
100  inline bool isRefined() const
101  {
102  return count_ >= refinementCount_;
103  }
104 
105 
106 
107  // Needed by FaceCellWave
108 
109  //- Check whether origin has been changed at all or
110  // still contains original (invalid) value.
111  template<class TrackingData>
112  inline bool valid(TrackingData& td) const;
113 
114  //- Check for identical geometrical data. Used for cyclics checking.
115  template<class TrackingData>
116  inline bool sameGeometry
117  (
118  const polyMesh&,
119  const refinementData&,
120  const scalar,
121  TrackingData& td
122  ) const;
123 
124  //- Convert any absolute coordinates into relative to (patch)face
125  // centre
126  template<class TrackingData>
127  inline void leaveDomain
128  (
129  const polyMesh&,
130  const polyPatch&,
131  const label patchFaceI,
132  const point& faceCentre,
133  TrackingData& td
134  );
135 
136  //- Reverse of leaveDomain
137  template<class TrackingData>
138  inline void enterDomain
139  (
140  const polyMesh&,
141  const polyPatch&,
142  const label patchFaceI,
143  const point& faceCentre,
144  TrackingData& td
145  );
146 
147  //- Apply rotation matrix to any coordinates
148  template<class TrackingData>
149  inline void transform
150  (
151  const polyMesh&,
152  const tensor&,
153  TrackingData& td
154  );
155 
156  //- Influence of neighbouring face.
157  template<class TrackingData>
158  inline bool updateCell
159  (
160  const polyMesh&,
161  const label thisCellI,
162  const label neighbourFaceI,
163  const refinementData& neighbourInfo,
164  const scalar tol,
165  TrackingData& td
166  );
167 
168  //- Influence of neighbouring cell.
169  template<class TrackingData>
170  inline bool updateFace
171  (
172  const polyMesh&,
173  const label thisFaceI,
174  const label neighbourCellI,
175  const refinementData& neighbourInfo,
176  const scalar tol,
177  TrackingData& td
178  );
179 
180  //- Influence of different value on same face.
181  template<class TrackingData>
182  inline bool updateFace
183  (
184  const polyMesh&,
185  const label thisFaceI,
186  const refinementData& neighbourInfo,
187  const scalar tol,
188  TrackingData& td
189  );
190 
191  //- Same (like operator==)
192  template<class TrackingData>
193  inline bool equal(const refinementData&, TrackingData& td) const;
194 
195 
196  // Member Operators
197 
198  // Needed for List IO
199  inline bool operator==(const refinementData&) const;
200 
201  inline bool operator!=(const refinementData&) const;
202 
203 
204  // IOstream Operators
205 
206  friend Ostream& operator<<(Ostream&, const refinementData&);
208 };
209 
210 
211 //- Data associated with refinementData type are contiguous
212 template<>
213 inline bool contiguous<refinementData>()
214 {
215  return true;
216 }
217 
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 } // End namespace Foam
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 #include "refinementDataI.H"
226 
227 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
228 
229 #endif
230 
231 // ************************************************************************* //
Foam::Tensor
Templated 3D tensor derived from VectorSpace adding construction from 9 components,...
Definition: complexI.H:224
Foam::refinementData::leaveDomain
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFaceI, const point &faceCentre, TrackingData &td)
Convert any absolute coordinates into relative to (patch)face.
Definition: refinementDataI.H:74
Foam::refinementData::operator>>
friend Istream & operator>>(Istream &, refinementData &)
Foam::refinementData::enterDomain
void enterDomain(const polyMesh &, const polyPatch &, const label patchFaceI, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
Definition: refinementDataI.H:98
Foam::refinementData
Transfers refinement levels such that slow transition between levels is maintained....
Definition: refinementData.H:54
Foam::refinementData::refinementCount
label refinementCount() const
Definition: refinementData.H:79
Foam::refinementData::refinementCount
label & refinementCount()
Definition: refinementData.H:84
Foam::refinementData::count_
label count_
Refinement level.
Definition: refinementData.H:62
Foam::refinementData::updateCell
bool updateCell(const polyMesh &, const label thisCellI, const label neighbourFaceI, const refinementData &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
Definition: refinementDataI.H:111
point.H
Foam::refinementData::valid
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
Definition: refinementDataI.H:51
Foam::refinementData::updateFace
bool updateFace(const polyMesh &, const label thisFaceI, const label neighbourCellI, const refinementData &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
Definition: refinementDataI.H:173
tensor.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::refinementData::operator==
bool operator==(const refinementData &) const
Definition: refinementDataI.H:252
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::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::refinementData::operator<<
friend Ostream & operator<<(Ostream &, const refinementData &)
Foam::refinementData::refinementData
refinementData()
Construct null.
Definition: refinementDataI.H:29
Foam::contiguous< refinementData >
bool contiguous< refinementData >()
Data associated with refinementData type are contiguous.
Definition: refinementData.H:212
Foam::refinementData::equal
bool equal(const refinementData &, TrackingData &td) const
Same (like operator==)
Definition: refinementDataI.H:241
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::refinementData::isRefined
bool isRefined() const
Definition: refinementData.H:99
Foam::refinementData::operator!=
bool operator!=(const refinementData &) const
Definition: refinementDataI.H:259
Foam::refinementData::refinementCount_
label refinementCount_
Count which triggers refinement.
Definition: refinementData.H:59
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:53
Foam::refinementData::count
label count() const
Definition: refinementData.H:89
Foam::refinementData::sameGeometry
bool sameGeometry(const polyMesh &, const refinementData &, const scalar, TrackingData &td) const
Check for identical geometrical data. Used for cyclics checking.
Definition: refinementDataI.H:60
Foam::refinementData::transform
void transform(const polyMesh &, const tensor &, TrackingData &td)
Apply rotation matrix to any coordinates.
Definition: refinementDataI.H:87
Foam::refinementData::count
label & count()
Definition: refinementData.H:94