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
50Ostream& operator<<(Ostream&, const smoothData&);
51Istream& operator>>(Istream&, smoothData&);
52
53/*---------------------------------------------------------------------------*\
54 Class smoothData Declaration
55\*---------------------------------------------------------------------------*/
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
124
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
213 // Member Operators
214
215 //- Assign new value
216 void operator=(const scalar value)
217 {
218 value_ = value;
219 }
220
221 //- Test for equality
222 inline bool operator==(const smoothData&) const;
223
224 //- Test for inequality
225 inline bool operator!=(const smoothData&) const;
226
227
228 // IOstream Operators
230 friend Ostream& operator<<(Ostream& os, const smoothData& rhs)
231 {
232 return os << rhs.value_;
233 }
235 friend Istream& operator>>(Istream& is, smoothData& rhs)
236 {
237 return is >> rhs.value_;
238 }
239};
240
241
242// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
243
244//- Contiguous data for smoothData
245template<> struct is_contiguous<smoothData> : std::true_type {};
246
247
248// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
249
250} // End namespace Foam
251
252// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
253
254#include "smoothDataI.H"
255
256// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
257
258#endif
259
260// ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:75
Class used to pass additional data in.
Definition: smoothData.H:81
scalar maxRatio
Cut off distance.
Definition: smoothData.H:85
Helper class used by the fvc::smooth and fvc::spread functions.
Definition: smoothData.H:57
bool operator==(const smoothData &) const
Test for equality.
Definition: smoothDataI.H:197
friend Ostream & operator<<(Ostream &os, const smoothData &rhs)
Definition: smoothData.H:229
void transform(const polyMesh &, const tensor &, TrackingData &td)
Apply rotation matrix to any coordinates.
Definition: smoothDataI.H:115
bool operator!=(const smoothData &) const
Test for inequality.
Definition: smoothDataI.H:206
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
Definition: smoothDataI.H:125
bool updateFace(const polyMesh &, const label thisFacei, const label neighbourCelli, const smoothData &svf, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
Definition: smoothDataI.H:153
bool updateCell(const polyMesh &, const label thisCelli, const label neighbourFacei, const smoothData &svf, const scalar tol, TrackingData &td)
Influence of neighbouring face.
Definition: smoothDataI.H:137
bool sameGeometry(const polyMesh &, const smoothData &, const scalar, TrackingData &td) const
Check for identical geometrical data (eg, cyclics checking)
Definition: smoothDataI.H:90
scalar & value()
The value.
Definition: smoothData.H:118
scalar value() const
Return value.
Definition: smoothData.H:112
smoothData(const smoothData &)=default
Copy construct.
void operator=(const scalar value)
Assign new value.
Definition: smoothData.H:215
bool equal(const smoothData &, TrackingData &td) const
Test for equality, with TrackingData.
Definition: smoothDataI.H:185
friend Istream & operator>>(Istream &is, smoothData &rhs)
Definition: smoothData.H:234
bool valid(TrackingData &td) const
Changed or contains original (invalid) value.
Definition: smoothDataI.H:82
smoothData()
Default construct.
Definition: smoothDataI.H:67
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Definition: smoothDataI.H:103
smoothData & operator=(const smoothData &)=default
Copy assignment.
mesh update()
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Istream & operator>>(Istream &, directionInfo &)
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:78