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-------------------------------------------------------------------------------
11License
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
31template<class TrackingData>
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
73inline Foam::smoothData::smoothData(const scalar value)
74:
75 value_(value)
76{}
77
78
79// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
80
81template<class TrackingData>
82inline bool Foam::smoothData::valid(TrackingData& td) const
83{
84 return value_ > -SMALL;
85}
86
87
88template<class TrackingData>
90(
91 const polyMesh&,
92 const smoothData&,
93 const scalar,
94 TrackingData& td
95) const
96{
97 return true;
98}
99
100
101template<class TrackingData>
103(
104 const polyMesh&,
105 const polyPatch&,
106 const label,
107 const point&,
108 TrackingData& td
109)
110{}
111
112
113template<class TrackingData>
115(
116 const polyMesh&,
117 const tensor&,
118 TrackingData& td
119)
120{}
121
122
123template<class TrackingData>
125(
126 const polyMesh&,
127 const polyPatch&,
128 const label,
129 const point&,
130 TrackingData& td
131)
132{}
133
134
135template<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
151template<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.
168template<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
183template<class TrackingData>
185(
186 const smoothData& rhs,
187 TrackingData& td
188) const
189{
190 return operator==(rhs);
191}
192
193
194// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
195
197(
198 const smoothData& rhs
199) const
200{
201 return value_ == rhs.value_;
202}
203
204
206(
207 const smoothData& rhs
208) const
209{
210 return !(*this == rhs);
211}
212
213
214// ************************************************************************* //
bool valid() const
True if all internal ids are non-negative.
friend Ostream & operator(Ostream &, const faMatrix< Type > &)
virtual bool update()
Update the mesh for both mesh motion and topology change.
Default transformation behaviour.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:75
Helper class used by the fvc::smooth and fvc::spread functions.
Definition: smoothData.H:57
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
Definition: smoothDataI.H:125
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
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
bool sameGeometry(const polyMesh &, const smoothData &, const scalar, TrackingData &td) const
Check for identical geometrical data (eg, cyclics checking)
Definition: smoothDataI.H:90
bool equal(const smoothData &, TrackingData &td) const
Test for equality, with TrackingData.
Definition: smoothDataI.H:185
bool valid(TrackingData &td) const
Changed or contains original (invalid) value.
Definition: smoothDataI.H:82
smoothData()
Default construct.
Definition: smoothDataI.H:67
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Definition: smoothDataI.H:103
mesh update()
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)