sweepData.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2022 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::sweepData
26 
27 Description
28  Helper class used by fvc::sweep function.
29 
30 SourceFiles
31  sweepData.H
32  sweepDataI.H
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef sweepData_H
37 #define sweepData_H
38 
39 #include "scalar.H"
40 #include "point.H"
41 #include "labelPair.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 // Forward declaration of classes
49 class fvPatch;
50 class fvMesh;
51 class transformer;
52 
53 /*---------------------------------------------------------------------------*\
54  Class sweepData Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class sweepData
58 {
59  // Private Member Data
60 
61  //-
62  scalar value_;
63 
64  //-
65  point origin_;
66 
67 
68  // Private Member Functions
69 
70  //- Update - gets information from neighbouring face/cell and
71  // uses this to update itself (if necessary) and return true
72  template<class TrackingData>
73  inline bool update
74  (
75  const sweepData& svf,
76  const point& position,
77  const scalar tol,
78  TrackingData& td
79  );
80 
81 
82 public:
83 
84  // Constructors
85 
86  //- Construct null
87  inline sweepData();
88 
89  //- Construct from component
90  inline sweepData(const scalar value, const point& origin);
91 
92 
93  // Member Functions
94 
95  // Access
96 
97  //- Return value
98  scalar value() const
99  {
100  return value_;
101  }
102 
103  //- Return origin
104  const point& origin() const
105  {
106  return origin_;
107  }
108 
109 
110  // Needed by FvFaceCellWave
111 
112  //- Check whether origin has been changed at all or
113  // still contains original (invalid) value
114  template<class TrackingData>
115  inline bool valid(TrackingData& td) const;
116 
117  //- Check for identical geometrical data
118  // Used for cyclics checking
119  template<class TrackingData>
120  inline bool sameGeometry
121  (
122  const fvMesh&,
123  const sweepData&,
124  const scalar,
125  TrackingData& td
126  ) const;
127 
128  //- Transform across an interface
129  template<class TrackingData>
130  inline void transform
131  (
132  const fvPatch& patch,
133  const label patchFacei,
134  const transformer& transform,
135  TrackingData& td
136  );
137 
138  //- Influence of neighbouring face
139  template<class TrackingData>
140  inline bool updateCell
141  (
142  const fvMesh&,
143  const label thisCelli,
144  const labelPair& neighbourPatchAndFacei,
145  const sweepData& svf,
146  const scalar tol,
147  TrackingData& td
148  );
149 
150  //- Influence of neighbouring cell
151  template<class TrackingData>
152  inline bool updateFace
153  (
154  const fvMesh&,
155  const labelPair& thisPatchAndFacei,
156  const label neighbourCelli,
157  const sweepData& svf,
158  const scalar tol,
159  TrackingData& td
160  );
161 
162  //- Influence of different value on same face
163  template<class TrackingData>
164  inline bool updateFace
165  (
166  const fvMesh&,
167  const labelPair& thisPatchAndFacei,
168  const sweepData& svf,
169  const scalar tol,
170  TrackingData& td
171  );
172 
173  //- Same (like operator==)
174  template<class TrackingData>
175  inline bool equal(const sweepData&, TrackingData& td) const;
176 
177 
178  // Member Operators
179 
180  inline void operator=(const scalar value);
181 
182  inline bool operator==(const sweepData&) const;
183 
184  inline bool operator!=(const sweepData&) const;
185 
186 
187  // IOstream Operators
189  friend Ostream& operator<<(Ostream& os, const sweepData& svf)
190  {
191  return os << svf.value_ << svf.origin_;
192  }
194  friend Istream& operator>>(Istream& is, sweepData& svf)
195  {
196  return is >> svf.value_ >> svf.origin_;
197  }
198 };
199 
200 
201 //- Data associated with sweepData type are contiguous
202 template<>
203 inline bool contiguous<sweepData>()
204 {
205  return true;
206 }
207 
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 } // End namespace Foam
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 #include "sweepDataI.H"
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 #endif
220 
221 // ************************************************************************* //
bool operator==(const sweepData &) const
Definition: sweepDataI.H:218
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space...
Definition: transformer.H:83
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
Definition: sweepDataI.H:94
scalar value() const
Return value.
Definition: sweepData.H:97
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:63
friend Istream & operator>>(Istream &is, sweepData &svf)
Definition: sweepData.H:193
sweepData()
Construct null.
Definition: sweepDataI.H:77
Helper class used by fvc::sweep function.
Definition: sweepData.H:56
const point & origin() const
Return origin.
Definition: sweepData.H:103
bool equal(const sweepData &, TrackingData &td) const
Same (like operator==)
Definition: sweepDataI.H:197
An ordered pair of two objects of type <T> with first() and second() elements.
Definition: contiguous.H:49
bool updateCell(const fvMesh &, const label thisCelli, const labelPair &neighbourPatchAndFacei, const sweepData &svf, const scalar tol, TrackingData &td)
Influence of neighbouring face.
Definition: sweepDataI.H:128
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
void operator=(const scalar value)
Definition: sweepDataI.H:209
void transform(const fvPatch &patch, const label patchFacei, const transformer &transform, TrackingData &td)
Transform across an interface.
Definition: sweepDataI.H:115
bool operator!=(const sweepData &) const
Definition: sweepDataI.H:227
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
bool contiguous< sweepData >()
Data associated with sweepData type are contiguous.
Definition: sweepData.H:202
bool sameGeometry(const fvMesh &, const sweepData &, const scalar, TrackingData &td) const
Check for identical geometrical data.
Definition: sweepDataI.H:102
friend Ostream & operator<<(Ostream &os, const sweepData &svf)
Definition: sweepData.H:188
Namespace for OpenFOAM.
bool updateFace(const fvMesh &, const labelPair &thisPatchAndFacei, const label neighbourCelli, const sweepData &svf, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
Definition: sweepDataI.H:143