Loading...
Searching...
No Matches
smoothData.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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::smoothData
29
30Description
31 Helper class used by the fvc::smooth and fvc::spread functions.
32
33SourceFiles
34 smoothData.H
35 smoothDataI.H
36
37\*---------------------------------------------------------------------------*/
38
39#ifndef smoothData_H
40#define smoothData_H
41
42// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43
44namespace Foam
45{
46
47// Forward Declarations
48class smoothData;
49
53/*---------------------------------------------------------------------------*\
54 Class smoothData Declaration
55\*---------------------------------------------------------------------------*/
56
57class smoothData
58{
59 // Private Data
60
61 scalar value_;
62
63
64 // Private Member Functions
65
66 //- Update gets information from neighbouring face/cell and
67 //- uses this to update itself (if necessary) and return true
68 template<class TrackingData>
69 inline bool update
70 (
71 const smoothData& svf,
72 const scalar scale,
73 const scalar tol,
74 TrackingData& td
75 );
76
77
78public:
79
80 //- Class used to pass additional data in
81 class trackData
82 {
83 public:
84
85 //- Cut off distance
86 scalar maxRatio;
87 };
88
89
90 // Generated Methods
91
92 //- Copy construct
93 smoothData(const smoothData&) = default;
94
95 //- Copy assignment
96 smoothData& operator=(const smoothData&) = default;
97
98
99 // Constructors
100
101 //- Default construct
102 inline smoothData();
103
104 //- Construct from inverse field value
105 inline smoothData(const scalar value);
106
107
108 // Member Functions
109
110 // Access
111
112 //- Return value
113 scalar value() const
114 {
115 return value_;
116 }
117
118 //- The value
119 scalar& value()
120 {
121 return value_;
122 }
123
125 // Needed by FaceCellWave
126
127 //- Changed or contains original (invalid) value
128 template<class TrackingData>
129 inline bool valid(TrackingData& td) const;
130
131 //- Check for identical geometrical data (eg, cyclics checking)
132 template<class TrackingData>
133 inline bool sameGeometry
134 (
135 const polyMesh&,
136 const smoothData&,
137 const scalar,
138 TrackingData& td
139 ) const;
140
141 //- Convert any absolute coordinates into relative to
142 //- (patch)face centre
143 template<class TrackingData>
144 inline void leaveDomain
145 (
146 const polyMesh&,
147 const polyPatch&,
148 const label patchFacei,
149 const point& faceCentre,
150 TrackingData& td
151 );
152
153 //- Reverse of leaveDomain
154 template<class TrackingData>
155 inline void enterDomain
156 (
157 const polyMesh&,
158 const polyPatch&,
159 const label patchFacei,
160 const point& faceCentre,
161 TrackingData& td
162 );
163
164 //- Apply rotation matrix to any coordinates
165 template<class TrackingData>
166 inline void transform
167 (
168 const polyMesh&,
169 const tensor&,
170 TrackingData& td
171 );
172
173 //- Influence of neighbouring face
174 template<class TrackingData>
175 inline bool updateCell
176 (
177 const polyMesh&,
178 const label thisCelli,
179 const label neighbourFacei,
180 const smoothData& svf,
181 const scalar tol,
182 TrackingData& td
183 );
184
185 //- Influence of neighbouring cell
186 template<class TrackingData>
187 inline bool updateFace
188 (
189 const polyMesh&,
190 const label thisFacei,
191 const label neighbourCelli,
192 const smoothData& svf,
193 const scalar tol,
194 TrackingData& td
195 );
196
197 //- Influence of different value on same face
198 template<class TrackingData>
199 inline bool updateFace
200 (
201 const polyMesh&,
202 const label thisFacei,
203 const smoothData& svf,
204 const scalar tol,
205 TrackingData& td
206 );
207
208 //- Test for equality, with TrackingData
209 template<class TrackingData>
210 inline bool equal(const smoothData&, TrackingData& td) const;
211
212 //- Interpolate between two values (lerp). Returns true if
213 //- causes changes. Not sure if needs to be specialised between
214 //- face and cell and what index is needed...
215 template<class TrackingData>
216 inline bool interpolate
217 (
218 const polyMesh&,
219 const point& pt,
220 const label i0,
221 const smoothData& f0,
222 const label i1,
223 const smoothData& f1,
224 const scalar weight,
225 const scalar tol,
226 TrackingData& td
227 );
228
229
230 // Member Operators
231
232 //- Assign new value
233 void operator=(const scalar value)
234 {
235 value_ = value;
236 }
237
238 //- Test for equality
239 inline bool operator==(const smoothData&) const;
240
241 //- Test for inequality
242 inline bool operator!=(const smoothData&) const;
243
244
245 // IOstream Operators
246
247 friend Ostream& operator<<(Ostream& os, const smoothData& rhs)
248 {
249 return os << rhs.value_;
250 }
251
252 friend Istream& operator>>(Istream& is, smoothData& rhs)
253 {
254 return is >> rhs.value_;
255 }
256};
257
258
259// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
260
261//- Contiguous data for smoothData
262template<> struct is_contiguous<smoothData> : std::true_type {};
263
264
265// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
266
267} // End namespace Foam
269// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
270
271#include "smoothDataI.H"
272
273// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
274
275#endif
276
277// ************************************************************************* //
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:59
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
A patch is a list of labels that address the faces in the global face list.
Definition polyPatch.H:73
Class used to pass additional data in.
Definition smoothData.H:81
scalar maxRatio
Cut off distance.
Definition smoothData.H:87
Helper class used by the fvc::smooth and fvc::spread functions.
Definition smoothData.H:53
bool operator==(const smoothData &) const
Test for equality.
friend Ostream & operator<<(Ostream &os, const smoothData &rhs)
Definition smoothData.H:286
void transform(const polyMesh &, const tensor &, TrackingData &td)
Apply rotation matrix to any coordinates.
bool operator!=(const smoothData &) const
Test for inequality.
bool interpolate(const polyMesh &, const point &pt, const label i0, const smoothData &f0, const label i1, const smoothData &f1, const scalar weight, const scalar tol, TrackingData &td)
Interpolate between two values (lerp). Returns true if causes changes. Not sure if needs to be specia...
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
bool updateFace(const polyMesh &, const label thisFacei, const label neighbourCelli, const smoothData &svf, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
bool updateCell(const polyMesh &, const label thisCelli, const label neighbourFacei, const smoothData &svf, const scalar tol, TrackingData &td)
Influence of neighbouring face.
bool sameGeometry(const polyMesh &, const smoothData &, const scalar, TrackingData &td) const
Check for identical geometrical data (eg, cyclics checking).
Definition smoothDataI.H:83
scalar & value()
The value.
Definition smoothData.H:132
scalar value() const
Return value.
Definition smoothData.H:124
smoothData(const smoothData &)=default
Copy construct.
void operator=(const scalar value)
Assign new value.
Definition smoothData.H:268
bool equal(const smoothData &, TrackingData &td) const
Test for equality, with TrackingData.
friend Istream & operator>>(Istream &is, smoothData &rhs)
Definition smoothData.H:291
bool valid(TrackingData &td) const
Changed or contains original (invalid) value.
Definition smoothDataI.H:75
smoothData()
Default construct.
Definition smoothDataI.H:60
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Convert any absolute coordinates into relative to (patch)face centre.
Definition smoothDataI.H:96
smoothData & operator=(const smoothData &)=default
Copy assignment.
mesh update()
OBJstream os(runTime.globalPath()/outputName)
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
Namespace for OpenFOAM.
Tensor< scalar > tensor
Definition symmTensor.H:57
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
Istream & operator>>(Istream &, directionInfo &)
vector point
Point is a vector.
Definition point.H:37
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
A template class to specify that a data type can be considered as being contiguous in memory.
Definition contiguous.H:70