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