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