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-2020 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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 
41 namespace Foam
42 {
43 
44 /*---------------------------------------------------------------------------*\
45  Class sweepData Declaration
46 \*---------------------------------------------------------------------------*/
47 
48 class sweepData
49 {
50  scalar value_;
51  point origin_;
52 
53  // Private Member Functions
54 
55  //- Update - gets information from neighbouring face/cell and
56  // uses this to update itself (if necessary) and return true
57  template<class TrackingData>
58  inline bool update
59  (
60  const sweepData& svf,
61  const point& position,
62  const scalar tol,
63  TrackingData& td
64  );
65 
66 
67 public:
68 
69  // Constructors
70 
71  //- Construct null
72  inline sweepData();
73 
74  //- Construct from component
75  inline sweepData(const scalar value, const point& origin);
76 
77 
78  // Member Functions
79 
80  // Access
81 
82  //- Return value
83  scalar value() const
84  {
85  return value_;
86  }
87 
88  //- Return origin
89  const point& origin() const
90  {
91  return origin_;
92  }
93 
94 
95  // Needed by FaceCellWave
96 
97  //- Check whether origin has been changed at all or
98  // still contains original (invalid) value
99  template<class TrackingData>
100  inline bool valid(TrackingData& td) const;
101 
102  //- Check for identical geometrical data
103  // Used for cyclics checking
104  template<class TrackingData>
105  inline bool sameGeometry
106  (
107  const polyMesh&,
108  const sweepData&,
109  const scalar,
110  TrackingData& td
111  ) const;
112 
113  //- Convert any absolute coordinates into relative to
114  // (patch)face centre
115  template<class TrackingData>
116  inline void leaveDomain
117  (
118  const polyMesh&,
119  const polyPatch&,
120  const label patchFacei,
121  const point& faceCentre,
122  TrackingData& td
123  );
124 
125  //- Reverse of leaveDomain
126  template<class TrackingData>
127  inline void enterDomain
128  (
129  const polyMesh&,
130  const polyPatch&,
131  const label patchFacei,
132  const point& faceCentre,
133  TrackingData& td
134  );
135 
136  //- Apply rotation matrix to any coordinates
137  template<class TrackingData>
138  inline void transform
139  (
140  const polyMesh&,
141  const tensor&,
142  TrackingData& td
143  );
144 
145  //- Influence of neighbouring face
146  template<class TrackingData>
147  inline bool updateCell
148  (
149  const polyMesh&,
150  const label thisCelli,
151  const label neighbourFacei,
152  const sweepData& svf,
153  const scalar tol,
154  TrackingData& td
155  );
156 
157  //- Influence of neighbouring cell
158  template<class TrackingData>
159  inline bool updateFace
160  (
161  const polyMesh&,
162  const label thisFacei,
163  const label neighbourCelli,
164  const sweepData& svf,
165  const scalar tol,
166  TrackingData& td
167  );
168 
169  //- Influence of different value on same face
170  template<class TrackingData>
171  inline bool updateFace
172  (
173  const polyMesh&,
174  const label thisFacei,
175  const sweepData& svf,
176  const scalar tol,
177  TrackingData& td
178  );
179 
180  //- Same (like operator==)
181  template<class TrackingData>
182  inline bool equal(const sweepData&, TrackingData& td) const;
183 
184 
185  // Member Operators
186 
187  inline void operator=(const scalar value);
188 
189  // Needed for List IO
190  inline bool operator==(const sweepData&) const;
191 
192  inline bool operator!=(const sweepData&) const;
193 
194 
195  // IOstream Operators
196 
197  friend Ostream& operator<<
198  (
199  Ostream& os,
200  const sweepData& svf
201  )
202  {
203  return os << svf.value_ << svf.origin_;
204  }
206  friend Istream& operator>>(Istream& is, sweepData& svf)
207  {
208  return is >> svf.value_ >> svf.origin_;
209  }
210 };
211 
212 
213 //- Data associated with sweepData type are contiguous
214 template<>
215 inline bool contiguous<sweepData>()
216 {
217  return true;
218 }
219 
220 
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 } // End namespace Foam
225 
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 
228 #include "sweepDataI.H"
229 
230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231 
232 #endif
233 
234 // ************************************************************************* //
bool operator==(const sweepData &) const
Definition: sweepDataI.H:219
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
Definition: sweepDataI.H:91
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:153
bool sameGeometry(const polyMesh &, const sweepData &, const scalar, TrackingData &td) const
Check for identical geometrical data.
Definition: sweepDataI.H:99
scalar value() const
Return value.
Definition: sweepData.H:82
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Convert any absolute coordinates into relative to.
Definition: sweepDataI.H:112
friend Istream & operator>>(Istream &is, sweepData &svf)
Definition: sweepData.H:205
sweepData()
Construct null.
Definition: sweepDataI.H:74
Helper class used by fvc::sweep function.
Definition: sweepData.H:47
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
Definition: sweepDataI.H:138
const point & origin() const
Return origin.
Definition: sweepData.H:88
bool equal(const sweepData &, TrackingData &td) const
Same (like operator==)
Definition: sweepDataI.H:198
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:168
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
void transform(const polyMesh &, const tensor &, TrackingData &td)
Apply rotation matrix to any coordinates.
Definition: sweepDataI.H:126
void operator=(const scalar value)
Definition: sweepDataI.H:210
bool operator!=(const sweepData &) const
Definition: sweepDataI.H:228
bool contiguous< sweepData >()
Data associated with sweepData type are contiguous.
Definition: sweepData.H:214
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
Namespace for OpenFOAM.