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-2016 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>
32 inline bool Foam::wallNormalInfo::update
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 // ************************************************************************* //
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
Holds information regarding nearest wall point. Used in wall refinement.
error FatalError
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
bool operator!=(const wallNormalInfo &) const
const vector & normal() const
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
bool updateFace(const polyMesh &, const label thisFacei, const label neighbourCelli, const wallNormalInfo &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
errorManip< error > abort(error &err)
Definition: errorManip.H:131
bool equal(const wallNormalInfo &, TrackingData &td) const
Same (like operator==)
A normal distribution model.
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Convert any absolute coordinates into relative to (patch)face.
wallNormalInfo()
Construct null.
bool operator==(const wallNormalInfo &) const
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
void transform(const polyMesh &, const tensor &, TrackingData &td)
Apply rotation matrix to any coordinates.
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:66
bool updateCell(const polyMesh &, const label thisCelli, const label neighbourFacei, const wallNormalInfo &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
bool sameGeometry(const polyMesh &, const wallNormalInfo &, const scalar, TrackingData &td) const
Check for identical geometrical data. Used for cyclics checking.