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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
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  // Nothing changed
59  return false;
60  }
61 }
62 
63 
64 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
65 
67 :
68  value_(-GREAT)
69 {}
70 
71 
72 inline Foam::smoothData::smoothData(const scalar value)
73 :
74  value_(value)
75 {}
76 
77 
78 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
79 
80 template<class TrackingData>
81 inline bool Foam::smoothData::valid(TrackingData& td) const
82 {
83  return value_ > -SMALL;
84 }
85 
86 
87 template<class TrackingData>
89 (
90  const polyMesh&,
91  const smoothData&,
92  const scalar,
93  TrackingData& td
94 ) const
95 {
96  return true;
97 }
98 
99 
100 template<class TrackingData>
102 (
103  const polyMesh&,
104  const polyPatch&,
105  const label,
106  const point&,
107  TrackingData& td
108 )
109 {}
110 
111 
112 template<class TrackingData>
113 inline void Foam::smoothData::transform
114 (
115  const polyMesh&,
116  const tensor&,
117  TrackingData& td
118 )
119 {}
120 
121 
122 template<class TrackingData>
124 (
125  const polyMesh&,
126  const polyPatch&,
127  const label,
128  const point&,
129  TrackingData& td
130 )
131 {}
132 
133 
134 template<class TrackingData>
136 (
137  const polyMesh&,
138  const label,
139  const label,
140  const smoothData& svf,
141  const scalar tol,
142  TrackingData& td
143 )
144 {
145  // Take over info from face if more than deltaRatio larger
146  return update(svf, td.maxRatio, tol, td);
147 }
148 
149 
150 template<class TrackingData>
152 (
153  const polyMesh&,
154  const label,
155  const label,
156  const smoothData& svf,
157  const scalar tol,
158  TrackingData& td
159 )
160 {
161  // Take over information from cell without any scaling (scale = 1.0)
162  return update(svf, 1.0, tol, td);
163 }
164 
165 
166 // Update this (face) with coupled face information.
167 template<class TrackingData>
169 (
170  const polyMesh&,
171  const label,
172  const smoothData& svf,
173  const scalar tol,
174  TrackingData& td
175 )
176 {
177  // Take over information from coupled face without any scaling (scale = 1.0)
178  return update(svf, 1.0, tol, td);
179 }
180 
181 
182 template<class TrackingData>
183 inline bool Foam::smoothData::equal
184 (
185  const smoothData& rhs,
186  TrackingData& td
187 ) const
188 {
189  return operator==(rhs);
190 }
191 
192 
193 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
194 
195 inline void Foam::smoothData::operator=
196 (
197  const scalar value
198 )
199 {
200  value_ = value;
201 }
202 
203 
204 inline bool Foam::smoothData::operator==
205 (
206  const smoothData& rhs
207 ) const
208 {
209  return value_ == rhs.value();
210 }
211 
212 
213 inline bool Foam::smoothData::operator!=
214 (
215  const smoothData& rhs
216 ) const
217 {
218  return !(*this == rhs);
219 }
220 
221 
222 // ************************************************************************* //
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:152
Foam::smoothData::leaveDomain
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Convert any absolute coordinates into relative to.
Definition: smoothDataI.H:102
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::smoothData::smoothData
smoothData()
Construct null.
Definition: smoothDataI.H:66
Foam::smoothData
Helper class used by the fvc::smooth and fvc::spread functions.
Definition: smoothData.H:50
Foam::smoothData::valid
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
Definition: smoothDataI.H:81
Foam::label
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:62
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:66
Foam::smoothData::equal
bool equal(const smoothData &, TrackingData &td) const
Same (like operator==)
Definition: smoothDataI.H:184
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:136
Foam::smoothData::sameGeometry
bool sameGeometry(const polyMesh &, const smoothData &, const scalar, TrackingData &td) const
Check for identical geometrical data.
Definition: smoothDataI.H:89
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:124
Foam::smoothData::value
scalar value() const
Return value.
Definition: smoothData.H:100
Foam::smoothData::transform
void transform(const polyMesh &, const tensor &, TrackingData &td)
Apply rotation matrix to any coordinates.
Definition: smoothDataI.H:114