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