FreeFOAM The Cross-Platform CFD Toolkit
smoothDeltaDeltaDataI.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 | Copyright (C) 1991-2010 OpenCFD Ltd.
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
27 
28 namespace Foam
29 {
30 
31 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32 
33 
34 // Update this with w2 if applicable
35 inline bool smoothDelta::deltaData::update
36 (
37  const smoothDelta::deltaData& w2,
38  const scalar scale,
39  const scalar tol
40 )
41 {
42  if (!valid() || (delta_ < VSMALL))
43  {
44  // My delta not set. Take over neighbour.
45  delta_ = w2.delta()/scale;
46 
47  // Something changed. Let caller know.
48  return true;
49  }
50  else if (w2.delta() > (1 + tol)*scale*delta_)
51  {
52  // Neighbour is too big for me. Up my delta.
53  delta_ = w2.delta()/scale;
54 
55  // Something changed. Let caller know.
56  return true;
57  }
58  else
59  {
60  // Neighbour is not too big for me or change is too small
61  // Nothing changed.
62  return false;
63  }
64 }
65 
66 
67 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
68 
69 // Null constructor
70 inline smoothDelta::deltaData::deltaData()
71 :
72  delta_(-GREAT)
73 {}
74 
75 
76 // Construct from components
77 inline smoothDelta::deltaData::deltaData(const scalar delta)
78 :
79  delta_(delta)
80 {}
81 
82 
83 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
84 
85 inline bool smoothDelta::deltaData::valid() const
86 {
87  return delta_ > -SMALL;
88 }
89 
90 
91 // Checks for cyclic faces
92 inline bool smoothDelta::deltaData::sameGeometry
93 (
94  const polyMesh&,
95  const deltaData&,
96  const scalar
97 ) const
98 {
99  return true;
100 }
101 
102 
103 inline void smoothDelta::deltaData::leaveDomain
104 (
105  const polyMesh&,
106  const polyPatch&,
107  const label,
108  const point&
109 )
110 {}
111 
112 
114 (
115  const polyMesh&,
116  const tensor&
117 )
118 {}
119 
120 
121 // Update absolute geometric quantities.
122 inline void smoothDelta::deltaData::enterDomain
123 (
124  const polyMesh&,
125  const polyPatch&,
126  const label,
127  const point&
128 )
129 {}
130 
131 
132 // Update this (cellI) with face information.
133 inline bool smoothDelta::deltaData::updateCell
134 (
135  const polyMesh&,
136  const label,
137  const label,
138  const deltaData& neighbourWallInfo,
139  const scalar tol
140 )
141 {
142  // Take over info from face if more than deltaRatio larger.
143  return update(neighbourWallInfo, maxDeltaRatio, tol);
144 }
145 
146 
147 // Update this (face) with cell information.
148 inline bool smoothDelta::deltaData::updateFace
149 (
150  const polyMesh&,
151  const label,
152  const label,
153  const deltaData& neighbourWallInfo,
154  const scalar tol
155 )
156 {
157  // Take over information from cell without any scaling (scale = 1.0)
158  return update(neighbourWallInfo, 1.0, tol);
159 }
160 
161 
162 // Update this (face) with coupled face information.
163 inline bool smoothDelta::deltaData::updateFace
164 (
165  const polyMesh&,
166  const label,
167  const deltaData& neighbourWallInfo,
168  const scalar tol
169 )
170 {
171  // Take over information from coupled face without any scaling (scale = 1.0)
172  return update(neighbourWallInfo, 1.0, tol);
173 }
174 
175 
176 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
177 
178 inline bool smoothDelta::deltaData::operator==
179 (
180  const deltaData& rhs
181 ) const
182 {
183  return delta_ == rhs.delta();
184 }
185 
186 
187 inline bool smoothDelta::deltaData::operator!=
188 (
189  const deltaData& rhs
190 ) const
191 {
192  return !(*this == rhs);
193 }
194 
195 } // End namespace Foam
196 
197 // ************************ vim: set sw=4 sts=4 et: ************************ //