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
50Ostream& operator<<(Ostream&, const sweepData&);
51Istream& operator>>(Istream&, sweepData&);
52
53/*---------------------------------------------------------------------------*\
54 Class sweepData Declaration
55\*---------------------------------------------------------------------------*/
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;
89
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()
112 {
113 return value_;
114 }
115
116 //- Return origin
117 const point& origin() const
118 {
119 return origin_;
120 }
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;
128
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
211 // Member Operators
212
213 //- Assign new value
214 void operator=(const scalar value)
215 {
216 value_ = value;
217 }
218
219 //- Test for equality
220 inline bool operator==(const sweepData&) const;
221
222 //- Test for inequality
223 inline bool operator!=(const sweepData&) const;
224
225
226 // IOstream Operators
228 friend Ostream& operator<<(Ostream& os, const sweepData& rhs)
229 {
230 return os << rhs.value_ << rhs.origin_;
231 }
233 friend Istream& operator>>(Istream& is, sweepData& rhs)
234 {
235 return is >> rhs.value_ >> rhs.origin_;
236 }
237};
238
239
240// * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
241
242//- Contiguous data for sweepData
243template<> struct is_contiguous<sweepData> : std::true_type {};
244
245
246// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
247
248} // End namespace Foam
249
250// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
251
252#include "sweepDataI.H"
253
254// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
255
256#endif
257
258// ************************************************************************* //
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
Helper class used by fvc::sweep function.
Definition: sweepData.H:57
const point & origin() const
Return origin.
Definition: sweepData.H:116
void transform(const polyMesh &, const tensor &, TrackingData &td)
Apply rotation matrix to any coordinates.
Definition: sweepDataI.H:132
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:174
sweepData()
Default construct.
Definition: sweepDataI.H:76
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
Definition: sweepDataI.H:144
scalar & value()
The value.
Definition: sweepData.H:110
scalar value() const
Return value.
Definition: sweepData.H:104
sweepData(const sweepData &)=default
Copy construct.
void operator=(const scalar value)
Assign new value.
Definition: sweepData.H:213
bool valid(TrackingData &td) const
Changed or contains original (invalid) value.
Definition: sweepDataI.H:97
sweepData & operator=(const sweepData &)=default
Copy assignment.
bool sameGeometry(const polyMesh &, const sweepData &, const scalar, TrackingData &td) const
Check for identical geometrical data (eg, cyclics checking)
Definition: sweepDataI.H:105
bool operator!=(const sweepData &) const
Test for inequality.
Definition: sweepDataI.H:225
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Convert any absolute coordinates into relative to.
Definition: sweepDataI.H:118
friend Istream & operator>>(Istream &is, sweepData &rhs)
Definition: sweepData.H:232
bool operator==(const sweepData &) const
Test for equality.
Definition: sweepDataI.H:216
friend Ostream & operator<<(Ostream &os, const sweepData &rhs)
Definition: sweepData.H:227
bool equal(const sweepData &, TrackingData &td) const
Test for equality, with TrackingData.
Definition: sweepDataI.H:204
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:159
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