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-2020 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 // Forward Declarations
48 class smoothData;
49 
50 Ostream& operator<<(Ostream&, const smoothData&);
51 Istream& operator>>(Istream&, smoothData&);
52 
53 /*---------------------------------------------------------------------------*\
54  Class smoothData Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class smoothData
58 {
59  // Private Data
60 
61  scalar value_;
62 
63 
64  // Private Member Functions
65 
66  //- Update gets information from neighbouring face/cell and
67  //- uses this to update itself (if necessary) and return true
68  template<class TrackingData>
69  inline bool update
70  (
71  const smoothData& svf,
72  const scalar scale,
73  const scalar tol,
74  TrackingData& td
75  );
76 
77 
78 public:
79 
80  //- Class used to pass additional data in
81  class trackData
82  {
83  public:
84 
85  //- Cut off distance
86  scalar maxRatio;
87  };
88 
89 
90  // Generated Methods
91 
92  //- Copy construct
93  smoothData(const smoothData&) = default;
94 
95  //- Copy assignment
96  smoothData& operator=(const smoothData&) = default;
97 
98 
99  // Constructors
100 
101  //- Default construct
102  inline smoothData();
103 
104  //- Construct from inverse field value
105  inline smoothData(const scalar value);
106 
107 
108  // Member Functions
109 
110  // Access
111 
112  //- Return value
113  scalar value() const
114  {
115  return value_;
116  }
117 
118  //- The value
119  scalar& value()
120  {
121  return value_;
122  }
123 
124 
125  // Needed by FaceCellWave
126 
127  //- Changed or contains original (invalid) value
128  template<class TrackingData>
129  inline bool valid(TrackingData& td) const;
130 
131  //- Check for identical geometrical data (eg, cyclics checking)
132  template<class TrackingData>
133  inline bool sameGeometry
134  (
135  const polyMesh&,
136  const smoothData&,
137  const scalar,
138  TrackingData& td
139  ) const;
140 
141  //- Convert any absolute coordinates into relative to
142  //- (patch)face centre
143  template<class TrackingData>
144  inline void leaveDomain
145  (
146  const polyMesh&,
147  const polyPatch&,
148  const label patchFacei,
149  const point& faceCentre,
150  TrackingData& td
151  );
152 
153  //- Reverse of leaveDomain
154  template<class TrackingData>
155  inline void enterDomain
156  (
157  const polyMesh&,
158  const polyPatch&,
159  const label patchFacei,
160  const point& faceCentre,
161  TrackingData& td
162  );
163 
164  //- Apply rotation matrix to any coordinates
165  template<class TrackingData>
166  inline void transform
167  (
168  const polyMesh&,
169  const tensor&,
170  TrackingData& td
171  );
172 
173  //- Influence of neighbouring face
174  template<class TrackingData>
175  inline bool updateCell
176  (
177  const polyMesh&,
178  const label thisCelli,
179  const label neighbourFacei,
180  const smoothData& svf,
181  const scalar tol,
182  TrackingData& td
183  );
184 
185  //- Influence of neighbouring cell
186  template<class TrackingData>
187  inline bool updateFace
188  (
189  const polyMesh&,
190  const label thisFacei,
191  const label neighbourCelli,
192  const smoothData& svf,
193  const scalar tol,
194  TrackingData& td
195  );
196 
197  //- Influence of different value on same face
198  template<class TrackingData>
199  inline bool updateFace
200  (
201  const polyMesh&,
202  const label thisFacei,
203  const smoothData& svf,
204  const scalar tol,
205  TrackingData& td
206  );
207 
208  //- Test for equality, with TrackingData
209  template<class TrackingData>
210  inline bool equal(const smoothData&, TrackingData& td) const;
211 
212 
213  // Member Operators
214 
215  //- Assign new value
216  void operator=(const scalar value)
217  {
218  value_ = value;
219  }
220 
221  //- Test for equality
222  inline bool operator==(const smoothData&) const;
223 
224  //- Test for inequality
225  inline bool operator!=(const smoothData&) const;
226 
227 
228  // IOstream Operators
229 
230  friend Ostream& operator<<(Ostream& os, const smoothData& rhs)
231  {
232  return os << rhs.value_;
233  }
234 
235  friend Istream& operator>>(Istream& is, smoothData& rhs)
236  {
237  return is >> rhs.value_;
238  }
239 };
240 
241 
242 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
243 
244 //- Contiguous data for smoothData
245 template<> struct is_contiguous<smoothData> : std::true_type {};
246 
247 
248 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
249 
250 } // End namespace Foam
251 
252 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
253 
254 #include "smoothDataI.H"
255 
256 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
257 
258 #endif
259 
260 // ************************************************************************* //
Foam::smoothData::operator=
void operator=(const scalar value)
Assign new value.
Definition: smoothData.H:215
Foam::Tensor
A templated (3 x 3) tensor of objects of <T> derived from MatrixSpace.
Definition: complexI.H:275
Foam::smoothData::trackData
Class used to pass additional data in.
Definition: smoothData.H:80
Foam::smoothData::operator=
smoothData & operator=(const smoothData &)=default
Copy assignment.
Foam::smoothData::operator==
bool operator==(const smoothData &) const
Test for equality.
Definition: smoothDataI.H:197
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:153
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:230
smoothDataI.H
Foam::smoothData::leaveDomain
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Definition: smoothDataI.H:103
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::smoothData::operator!=
bool operator!=(const smoothData &) const
Test for inequality.
Definition: smoothDataI.H:206
Foam::smoothData::smoothData
smoothData()
Default construct.
Definition: smoothDataI.H:67
Foam::smoothData
Helper class used by the fvc::smooth and fvc::spread functions.
Definition: smoothData.H:56
Foam::smoothData::valid
bool valid(TrackingData &td) const
Changed or contains original (invalid) value.
Definition: smoothDataI.H:82
Foam::smoothData::operator>>
friend Istream & operator>>(Istream &is, smoothData &rhs)
Definition: smoothData.H:234
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
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:68
Foam::smoothData::equal
bool equal(const smoothData &, TrackingData &td) const
Test for equality, with TrackingData.
Definition: smoothDataI.H:185
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:137
os
OBJstream os(runTime.globalPath()/outputName)
Foam::smoothData::sameGeometry
bool sameGeometry(const polyMesh &, const smoothData &, const scalar, TrackingData &td) const
Check for identical geometrical data (eg, cyclics checking)
Definition: smoothDataI.H:90
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::smoothData::trackData::maxRatio
scalar maxRatio
Cut off distance.
Definition: smoothData.H:85
Foam::smoothData::operator<<
friend Ostream & operator<<(Ostream &os, const smoothData &rhs)
Definition: smoothData.H:229
Foam::Vector< scalar >
Foam::smoothData::enterDomain
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
Definition: smoothDataI.H:125
Foam::smoothData::value
scalar & value()
The value.
Definition: smoothData.H:118
Foam::smoothData::value
scalar value() const
Return value.
Definition: smoothData.H:112
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:115
Foam::is_contiguous
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:75