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