wallNormalInfoI.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-2016 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 #include "polyMesh.H"
29 
30 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
31 
32 // Update this with w2 if not yet set.
33 template<class TrackingData>
34 inline bool Foam::wallNormalInfo::update
35 (
36  const wallNormalInfo& w2,
37  TrackingData& td
38 )
39 {
40  if (!w2.valid(td))
41  {
43  << "Problem: w2 is not valid" << abort(FatalError);
44 
45  return false;
46  }
47  else if (valid(td))
48  {
49  // our already set. Stop any transfer
50  return false;
51  }
52  else
53  {
54  normal_ = w2.normal();
55 
56  return true;
57  }
58 }
59 
60 
61 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
62 
63 // Null constructor
65 :
66  normal_(point::max)
67 {}
68 
69 
70 // Construct from normal
72 :
73  normal_(normal)
74 {}
75 
76 
77 // Construct as copy
79 :
80  normal_(wpt.normal())
81 {}
82 
83 
84 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
85 
87 {
88  return normal_;
89 }
90 
91 
92 template<class TrackingData>
93 inline bool Foam::wallNormalInfo::valid(TrackingData& td) const
94 {
95  return normal_ != point::max;
96 }
97 
98 
99 // No geometric data so never any problem on cyclics
100 template<class TrackingData>
102 (
103  const polyMesh&,
104  const wallNormalInfo& w2,
105  const scalar tol,
106  TrackingData& td
107 ) const
108 {
109  return true;
110 }
111 
112 
113 // No geometric data.
114 template<class TrackingData>
116 (
117  const polyMesh&,
118  const polyPatch& patch,
119  const label patchFacei,
120  const point& faceCentre,
121  TrackingData& td
122 )
123 {}
124 
125 
126 // No geometric data.
127 template<class TrackingData>
129 (
130  const polyMesh&,
131  const tensor& rotTensor,
132  TrackingData& td
133 )
134 {}
135 
136 
137 // No geometric data.
138 template<class TrackingData>
140 (
141  const polyMesh&,
142  const polyPatch& patch,
143  const label patchFacei,
144  const point& faceCentre,
145  TrackingData& td
146 )
147 {}
148 
149 
150 // Update this with w2 if w2 nearer to pt.
151 template<class TrackingData>
153 (
154  const polyMesh&,
155  const label thisCelli,
156  const label neighbourFacei,
157  const wallNormalInfo& neighbourWallInfo,
158  const scalar tol,
159  TrackingData& td
160 )
161 {
162  return update(neighbourWallInfo, td);
163 }
164 
165 
166 // Update this with w2 if w2 nearer to pt.
167 template<class TrackingData>
169 (
170  const polyMesh&,
171  const label thisFacei,
172  const label neighbourCelli,
173  const wallNormalInfo& neighbourWallInfo,
174  const scalar tol,
175  TrackingData& td
176 )
177 {
178  return update(neighbourWallInfo, td);
179 }
180 
181 
182 // Update this with w2 if w2 nearer to pt.
183 template<class TrackingData>
185 (
186  const polyMesh&,
187  const label thisFacei,
188  const wallNormalInfo& neighbourWallInfo,
189  const scalar tol,
190  TrackingData& td
191 )
192 {
193  return update(neighbourWallInfo, td);
194 }
195 
196 
197 template<class TrackingData>
198 inline bool Foam::wallNormalInfo::equal
199 (
200  const wallNormalInfo& rhs,
201  TrackingData& td
202 ) const
203 {
204  return operator==(rhs);
205 }
206 
207 
208 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
209 
211  const
212 {
213  return normal() == rhs.normal();
214 }
215 
216 
218  const
219 {
220  return !(*this == rhs);
221 }
222 
223 
224 // ************************************************************************* //
Foam::wallNormalInfo::operator!=
bool operator!=(const wallNormalInfo &) const
Definition: wallNormalInfoI.H:217
Foam::Tensor< scalar >
Foam::wallNormalInfo::sameGeometry
bool sameGeometry(const polyMesh &, const wallNormalInfo &, const scalar, TrackingData &td) const
Check for identical geometrical data. Used for cyclics checking.
Definition: wallNormalInfoI.H:102
Foam::wallNormalInfo::normal
const vector & normal() const
Definition: wallNormalInfoI.H:86
update
mesh update()
Foam::wallNormalInfo::valid
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
Definition: wallNormalInfoI.H:93
polyMesh.H
Foam::wallNormalInfo::updateFace
bool updateFace(const polyMesh &, const label thisFacei, const label neighbourCelli, const wallNormalInfo &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
Definition: wallNormalInfoI.H:169
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::wallNormalInfo::enterDomain
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
Definition: wallNormalInfoI.H:140
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::max
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Definition: hashSets.C:47
Foam::FatalError
error FatalError
w2
#define w2
Definition: blockCreate.C:35
Foam::wallNormalInfo::operator==
bool operator==(const wallNormalInfo &) const
Definition: wallNormalInfoI.H:210
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:137
Foam::wallNormalInfo::equal
bool equal(const wallNormalInfo &, TrackingData &td) const
Same (like operator==)
Definition: wallNormalInfoI.H:199
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:355
Foam::VectorSpace< Vector< scalar >, scalar, 3 >::max
static const Vector< scalar > max
Definition: VectorSpace.H:117
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::Vector< scalar >
Foam::wallNormalInfo::transform
void transform(const polyMesh &, const tensor &, TrackingData &td)
Apply rotation matrix to any coordinates.
Definition: wallNormalInfoI.H:129
Foam::wallNormalInfo
Holds information regarding nearest wall point. Used in wall refinement.
Definition: wallNormalInfo.H:65
Foam::wallNormalInfo::leaveDomain
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Convert any absolute coordinates into relative to (patch)face.
Definition: wallNormalInfoI.H:116
Foam::wallNormalInfo::wallNormalInfo
wallNormalInfo()
Construct null.
Definition: wallNormalInfoI.H:64
Foam::wallNormalInfo::updateCell
bool updateCell(const polyMesh &, const label thisCelli, const label neighbourFacei, const wallNormalInfo &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
Definition: wallNormalInfoI.H:153