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  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 #include "polyMesh.H"
30 
31 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
32 
33 // Update this with w2 if not yet set.
34 template<class TrackingData>
35 inline bool Foam::wallNormalInfo::update
36 (
37  const wallNormalInfo& w2,
38  TrackingData& td
39 )
40 {
41  if (!w2.valid(td))
42  {
44  << "Problem: w2 is not valid" << abort(FatalError);
45 
46  return false;
47  }
48  else if (valid(td))
49  {
50  // our already set. Stop any transfer
51  return false;
52  }
53  else
54  {
55  normal_ = w2.normal();
56 
57  return true;
58  }
59 }
60 
61 
62 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
63 
65 :
66  normal_(point::max)
67 {}
68 
69 
71 :
72  normal_(normal)
73 {}
74 
75 
76 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
77 
78 template<class TrackingData>
79 inline bool Foam::wallNormalInfo::valid(TrackingData& td) const
80 {
81  return normal_ != point::max;
82 }
83 
84 
85 // No geometric data so never any problem on cyclics
86 template<class TrackingData>
88 (
89  const polyMesh&,
90  const wallNormalInfo& w2,
91  const scalar tol,
92  TrackingData& td
93 ) const
94 {
95  return true;
96 }
97 
98 
99 // No geometric data.
100 template<class TrackingData>
102 (
103  const polyMesh&,
104  const polyPatch& patch,
105  const label patchFacei,
106  const point& faceCentre,
107  TrackingData& td
108 )
109 {}
110 
111 
112 // No geometric data.
113 template<class TrackingData>
115 (
116  const polyMesh&,
117  const tensor& rotTensor,
118  TrackingData& td
119 )
120 {}
121 
122 
123 // No geometric data.
124 template<class TrackingData>
126 (
127  const polyMesh&,
128  const polyPatch& patch,
129  const label patchFacei,
130  const point& faceCentre,
131  TrackingData& td
132 )
133 {}
134 
135 
136 // Update this with w2 if w2 nearer to pt.
137 template<class TrackingData>
139 (
140  const polyMesh&,
141  const label thisCelli,
142  const label neighbourFacei,
143  const wallNormalInfo& neighbourWallInfo,
144  const scalar tol,
145  TrackingData& td
146 )
147 {
148  return update(neighbourWallInfo, td);
149 }
150 
151 
152 // Update this with w2 if w2 nearer to pt.
153 template<class TrackingData>
155 (
156  const polyMesh&,
157  const label thisFacei,
158  const label neighbourCelli,
159  const wallNormalInfo& neighbourWallInfo,
160  const scalar tol,
161  TrackingData& td
162 )
163 {
164  return update(neighbourWallInfo, td);
165 }
166 
167 
168 // Update this with w2 if w2 nearer to pt.
169 template<class TrackingData>
171 (
172  const polyMesh&,
173  const label thisFacei,
174  const wallNormalInfo& neighbourWallInfo,
175  const scalar tol,
176  TrackingData& td
177 )
178 {
179  return update(neighbourWallInfo, td);
180 }
181 
182 
183 template<class TrackingData>
184 inline bool Foam::wallNormalInfo::equal
185 (
186  const wallNormalInfo& rhs,
187  TrackingData& td
188 ) const
189 {
190  return operator==(rhs);
191 }
192 
193 
194 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
195 
196 inline bool Foam::wallNormalInfo::operator==
197 (
198  const wallNormalInfo& rhs
199 ) const
200 {
201  return normal_ == rhs.normal_;
202 }
203 
204 
205 inline bool Foam::wallNormalInfo::operator!=
206 (
207  const wallNormalInfo& rhs
208 ) const
209 {
210  return !(*this == rhs);
211 }
212 
213 
214 // ************************************************************************* //
Foam::Tensor< scalar >
Foam::wallNormalInfo::sameGeometry
bool sameGeometry(const polyMesh &, const wallNormalInfo &, const scalar, TrackingData &td) const
Check for identical geometrical data (eg, cyclics checking)
Definition: wallNormalInfoI.H:88
update
mesh update()
Foam::wallNormalInfo::valid
bool valid(TrackingData &td) const
Changed or contains original (invalid) value.
Definition: wallNormalInfoI.H:79
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:155
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:126
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::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::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
Foam::wallNormalInfo::equal
bool equal(const wallNormalInfo &, TrackingData &td) const
Test for equality, with TrackingData.
Definition: wallNormalInfoI.H:185
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Foam::VectorSpace< Vector< Cmpt >, Cmpt, 3 >::max
static const Vector< Cmpt > 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:115
Foam::wallNormalInfo
Holds information regarding nearest wall point. Used in wall refinement.
Definition: wallNormalInfo.H:64
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:102
Foam::wallNormalInfo::wallNormalInfo
wallNormalInfo()
Default construct.
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:139