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-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 \*---------------------------------------------------------------------------*/
25 
26 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
27 
28 template<class TrackingData>
29 inline bool Foam::smoothData::update
30 (
31  const smoothData& svf,
32  const scalar scale,
33  const scalar tol,
34  TrackingData& td
35 )
36 {
37  if (!valid(td) || (value_ < vSmall))
38  {
39  // My value not set - take over neighbour
40  value_ = svf.value()/scale;
41 
42  // Something changed - let caller know
43  return true;
44  }
45  else if (svf.value() > (1 + tol)*scale*value_)
46  {
47  // Neighbour is too big for me - Up my value
48  value_ = svf.value()/scale;
49 
50  // Something changed - let caller know
51  return true;
52  }
53  else
54  {
55  // Neighbour is not too big for me or change is too small
56  // Nothing changed
57  return false;
58  }
59 }
60 
61 
62 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
63 
65 :
66  value_(-great)
67 {}
68 
69 
70 inline Foam::smoothData::smoothData(const scalar value)
71 :
72  value_(value)
73 {}
74 
75 
76 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
77 
78 template<class TrackingData>
79 inline bool Foam::smoothData::valid(TrackingData& td) const
80 {
81  return value_ > -small;
82 }
83 
84 
85 template<class TrackingData>
87 (
88  const polyMesh&,
89  const smoothData&,
90  const scalar,
91  TrackingData& td
92 ) const
93 {
94  return true;
95 }
96 
97 
98 template<class TrackingData>
100 (
101  const polyMesh&,
102  const polyPatch&,
103  const label,
104  const point&,
105  TrackingData& td
106 )
107 {}
108 
109 
110 template<class TrackingData>
111 inline void Foam::smoothData::transform
112 (
113  const polyMesh&,
114  const tensor&,
115  TrackingData& td
116 )
117 {}
118 
119 
120 template<class TrackingData>
122 (
123  const polyMesh&,
124  const polyPatch&,
125  const label,
126  const point&,
127  TrackingData& td
128 )
129 {}
130 
131 
132 template<class TrackingData>
134 (
135  const polyMesh&,
136  const label,
137  const label,
138  const smoothData& svf,
139  const scalar tol,
140  TrackingData& td
141 )
142 {
143  // Take over info from face if more than deltaRatio larger
144  return update(svf, td.maxRatio, tol, td);
145 }
146 
147 
148 template<class TrackingData>
150 (
151  const polyMesh&,
152  const label,
153  const label,
154  const smoothData& svf,
155  const scalar tol,
156  TrackingData& td
157 )
158 {
159  // Take over information from cell without any scaling (scale = 1.0)
160  return update(svf, 1.0, tol, td);
161 }
162 
163 
164 // Update this (face) with coupled face information.
165 template<class TrackingData>
167 (
168  const polyMesh&,
169  const label,
170  const smoothData& svf,
171  const scalar tol,
172  TrackingData& td
173 )
174 {
175  // Take over information from coupled face without any scaling (scale = 1.0)
176  return update(svf, 1.0, tol, td);
177 }
178 
179 
180 template<class TrackingData>
181 inline bool Foam::smoothData::equal
182 (
183  const smoothData& rhs,
184  TrackingData& td
185 ) const
186 {
187  return operator==(rhs);
188 }
189 
190 
191 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
192 
193 inline void Foam::smoothData::operator=
194 (
195  const scalar value
196 )
197 {
198  value_ = value;
199 }
200 
201 
202 inline bool Foam::smoothData::operator==
203 (
204  const smoothData& rhs
205 ) const
206 {
207  return value_ == rhs.value();
208 }
209 
210 
211 inline bool Foam::smoothData::operator!=
212 (
213  const smoothData& rhs
214 ) const
215 {
216  return !(*this == rhs);
217 }
218 
219 
220 // ************************************************************************* //
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
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
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
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 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
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
scalar value() const
Return value.
Definition: smoothData.H:97