smoothDataI.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 \*---------------------------------------------------------------------------*/
25 
26 #include "smoothData.H"
27 
28 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
29 
30 template<class TrackingData>
31 inline bool Foam::smoothData::update
32 (
33  const smoothData& svf,
34  const scalar scale,
35  const scalar tol,
36  TrackingData& td
37 )
38 {
39  if (!valid(td) || (value_ < vSmall))
40  {
41  // My value not set - take over neighbour
42  value_ = svf.value()/scale;
43 
44  // Something changed - let caller know
45  return true;
46  }
47  else if (svf.value() > (1 + tol)*scale*value_)
48  {
49  // Neighbour is too big for me - up my value
50  value_ = svf.value()/scale;
51 
52  // Something changed - let caller know
53  return true;
54  }
55  else
56  {
57  // Neighbour is not too big for me or change is too small
58  // ...
59 
60  // Nothing changed
61  return false;
62  }
63 }
64 
65 
66 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
67 
69 :
70  value_(-great)
71 {}
72 
73 
74 inline Foam::smoothData::smoothData(const scalar value)
75 :
76  value_(value)
77 {}
78 
79 
80 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
81 
82 template<class TrackingData>
83 inline bool Foam::smoothData::valid(TrackingData& td) const
84 {
85  return value_ > -small;
86 }
87 
88 
89 template<class TrackingData>
91 (
92  const fvMesh&,
93  const smoothData&,
94  const scalar,
95  TrackingData& td
96 ) const
97 {
98  return true;
99 }
100 
101 
102 template<class TrackingData>
103 inline void Foam::smoothData::transform
104 (
105  const fvPatch& patch,
106  const label patchFacei,
107  const transformer& transform,
108  TrackingData& td
109 )
110 {}
111 
112 
113 template<class TrackingData>
115 (
116  const fvMesh&,
117  const label,
118  const labelPair&,
119  const smoothData& svf,
120  const scalar tol,
121  TrackingData& td
122 )
123 {
124  // Take over info from face if more than deltaRatio larger
125  return update(svf, td.maxRatio, tol, td);
126 }
127 
128 
129 template<class TrackingData>
131 (
132  const fvMesh&,
133  const labelPair&,
134  const label,
135  const smoothData& svf,
136  const scalar tol,
137  TrackingData& td
138 )
139 {
140  // Take over information from cell without any scaling (scale = 1.0)
141  return update(svf, 1.0, tol, td);
142 }
143 
144 
145 // Update this (face) with coupled face information.
146 template<class TrackingData>
148 (
149  const fvMesh&,
150  const labelPair&,
151  const smoothData& svf,
152  const scalar tol,
153  TrackingData& td
154 )
155 {
156  // Take over information from coupled face without any scaling (scale = 1.0)
157  return update(svf, 1.0, tol, td);
158 }
159 
160 
161 template<class TrackingData>
162 inline bool Foam::smoothData::equal
163 (
164  const smoothData& rhs,
165  TrackingData& td
166 ) const
167 {
168  return operator==(rhs);
169 }
170 
171 
172 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
173 
174 inline void Foam::smoothData::operator=(const scalar value)
175 {
176  value_ = value;
177 }
178 
179 
180 inline bool Foam::smoothData::operator==(const smoothData& rhs) const
181 {
182  return value_ == rhs.value();
183 }
184 
185 
186 inline bool Foam::smoothData::operator!=(const smoothData& rhs) const
187 {
188  return !(*this == rhs);
189 }
190 
191 
192 // ************************************************************************* //
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space...
Definition: transformer.H:83
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
bool operator==(const smoothData &) const
Definition: smoothDataI.H:180
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
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
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
scalar value() const
Return value.
Definition: smoothData.H:105