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 | Copyright (C) 2011-2015 OpenFOAM Foundation
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 #include "polyMesh.H"
27 
28 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
29 
30 // Update this with w2 if not yet set.
31 template<class TrackingData>
33 (
34  const wallNormalInfo& w2,
35  TrackingData& td
36 )
37 {
38  if (!w2.valid(td))
39  {
41  << "Problem: w2 is not valid" << abort(FatalError);
42 
43  return false;
44  }
45  else if (valid(td))
46  {
47  // our already set. Stop any transfer
48  return false;
49  }
50  else
51  {
52  normal_ = w2.normal();
53 
54  return true;
55  }
56 }
57 
58 
59 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
60 
61 // Null constructor
63 :
64  normal_(point::max)
65 {}
66 
67 
68 // Construct from normal
70 :
71  normal_(normal)
72 {}
73 
74 
75 // Construct as copy
77 :
78  normal_(wpt.normal())
79 {}
80 
81 
82 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
83 
85 {
86  return normal_;
87 }
88 
89 
90 template<class TrackingData>
91 inline bool Foam::wallNormalInfo::valid(TrackingData& td) const
92 {
93  return normal_ != point::max;
94 }
95 
96 
97 // No geometric data so never any problem on cyclics
98 template<class TrackingData>
100 (
101  const polyMesh&,
102  const wallNormalInfo& w2,
103  const scalar tol,
104  TrackingData& td
105 ) const
106 {
107  return true;
108 }
109 
110 
111 // No geometric data.
112 template<class TrackingData>
114 (
115  const polyMesh&,
116  const polyPatch& patch,
117  const label patchFaceI,
118  const point& faceCentre,
119  TrackingData& td
120 )
121 {}
122 
123 
124 // No geometric data.
125 template<class TrackingData>
127 (
128  const polyMesh&,
129  const tensor& rotTensor,
130  TrackingData& td
131 )
132 {}
133 
134 
135 // No geometric data.
136 template<class TrackingData>
138 (
139  const polyMesh&,
140  const polyPatch& patch,
141  const label patchFaceI,
142  const point& faceCentre,
143  TrackingData& td
144 )
145 {}
146 
147 
148 // Update this with w2 if w2 nearer to pt.
149 template<class TrackingData>
151 (
152  const polyMesh&,
153  const label thisCellI,
154  const label neighbourFaceI,
155  const wallNormalInfo& neighbourWallInfo,
156  const scalar tol,
157  TrackingData& td
158 )
159 {
160  return update(neighbourWallInfo, td);
161 }
162 
163 
164 // Update this with w2 if w2 nearer to pt.
165 template<class TrackingData>
167 (
168  const polyMesh&,
169  const label thisFaceI,
170  const label neighbourCellI,
171  const wallNormalInfo& neighbourWallInfo,
172  const scalar tol,
173  TrackingData& td
174 )
175 {
176  return update(neighbourWallInfo, td);
177 }
178 
179 
180 // Update this with w2 if w2 nearer to pt.
181 template<class TrackingData>
183 (
184  const polyMesh&,
185  const label thisFaceI,
186  const wallNormalInfo& neighbourWallInfo,
187  const scalar tol,
188  TrackingData& td
189 )
190 {
191  return update(neighbourWallInfo, td);
192 }
193 
194 
195 template<class TrackingData>
196 inline bool Foam::wallNormalInfo::equal
197 (
198  const wallNormalInfo& rhs,
199  TrackingData& td
200 ) const
201 {
202  return operator==(rhs);
203 }
204 
205 
206 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
207 
209  const
210 {
211  return normal() == rhs.normal();
212 }
213 
214 
216  const
217 {
218  return !(*this == rhs);
219 }
220 
221 
222 // ************************************************************************* //
Foam::wallNormalInfo::operator!=
bool operator!=(const wallNormalInfo &) const
Definition: wallNormalInfoI.H:215
Foam::Tensor
Templated 3D tensor derived from VectorSpace adding construction from 9 components,...
Definition: complexI.H:224
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:100
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:151
Foam::wallNormalInfo::normal
const vector & normal() const
Definition: wallNormalInfoI.H:84
Foam::wallNormalInfo::valid
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
Definition: wallNormalInfoI.H:91
Foam::Vector< scalar >::max
static const Vector max
Definition: Vector.H:82
Foam::operator==
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
polyMesh.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
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:59
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:114
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
Foam::FatalError
error FatalError
Foam::wallNormalInfo::update
bool update(const wallNormalInfo &w2, TrackingData &td)
Evaluate distance to point. Update normal_.
Definition: wallNormalInfoI.H:33
Foam::wallNormalInfo::operator==
bool operator==(const wallNormalInfo &) const
Definition: wallNormalInfoI.H:208
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:131
Foam::max
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
Foam::wallNormalInfo::equal
bool equal(const wallNormalInfo &, TrackingData &td) const
Same (like operator==)
Definition: wallNormalInfoI.H:197
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:318
Foam::Vector< scalar >
Foam::wallNormalInfo::transform
void transform(const polyMesh &, const tensor &, TrackingData &td)
Apply rotation matrix to any coordinates.
Definition: wallNormalInfoI.H:127
Foam::wallNormalInfo
Holds information regarding nearest wall point. Used in wall refinement.
Definition: wallNormalInfo.H:57
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:167
Foam::wallNormalInfo::enterDomain
void enterDomain(const polyMesh &, const polyPatch &, const label patchFaceI, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
Definition: wallNormalInfoI.H:138
Foam::wallNormalInfo::wallNormalInfo
wallNormalInfo()
Construct null.
Definition: wallNormalInfoI.H:62
normal
A normal distribution model.