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