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