wallNormalInfo.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) 2019 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 Class
28  Foam::wallNormalInfo
29 
30 Description
31  Holds information regarding nearest wall point.
32  Used in wall refinement.
33 
34 SourceFiles
35  wallNormalInfoI.H
36  wallNormalInfo.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef wallNormalInfo_H
41 #define wallNormalInfo_H
42 
43 #include "point.H"
44 #include "label.H"
45 #include "scalar.H"
46 #include "tensor.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 // Forward Declarations
54 class polyPatch;
55 class polyMesh;
56 class wallNormalInfo;
57 
58 Istream& operator>>(Istream&, wallNormalInfo&);
59 Ostream& operator<<(Ostream&, const wallNormalInfo&);
60 
61 /*---------------------------------------------------------------------------*\
62  Class wallNormalInfo Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 class wallNormalInfo
66 {
67  // Private Data
68 
69  //- Normal at nearest wall point
70  vector normal_;
71 
72 
73  // Private Member Functions
74 
75  //- Evaluate distance to point and update normal_
76  template<class TrackingData>
77  inline bool update(const wallNormalInfo& w2, TrackingData& td);
78 
79 
80 public:
81 
82  // Constructors
83 
84  //- Default construct
85  inline wallNormalInfo();
86 
87  //- Construct from normal
88  inline wallNormalInfo(const vector& normal);
89 
90 
91 
92  // Member Functions
93 
94  // Access
95 
96  const vector& normal() const
97  {
98  return normal_;
99  }
100  vector& normal()
101  {
102  return normal_;
103  }
104 
105 
106  // Needed by FaceCellWave
107 
108  //- Changed or contains original (invalid) value
109  template<class TrackingData>
110  inline bool valid(TrackingData& td) const;
111 
112  //- Check for identical geometrical data (eg, cyclics checking)
113  template<class TrackingData>
114  inline bool sameGeometry
115  (
116  const polyMesh&,
117  const wallNormalInfo&,
118  const scalar,
119  TrackingData& td
120  ) const;
121 
122  //- Convert any absolute coordinates into relative to (patch)face
123  // centre
124  template<class TrackingData>
125  inline void leaveDomain
126  (
127  const polyMesh&,
128  const polyPatch&,
129  const label patchFacei,
130  const point& faceCentre,
131  TrackingData& td
132  );
133 
134  //- Reverse of leaveDomain
135  template<class TrackingData>
136  inline void enterDomain
137  (
138  const polyMesh&,
139  const polyPatch&,
140  const label patchFacei,
141  const point& faceCentre,
142  TrackingData& td
143  );
144 
145  //- Apply rotation matrix to any coordinates
146  template<class TrackingData>
147  inline void transform
148  (
149  const polyMesh&,
150  const tensor&,
151  TrackingData& td
152  );
153 
154  //- Influence of neighbouring face.
155  template<class TrackingData>
156  inline bool updateCell
157  (
158  const polyMesh&,
159  const label thisCelli,
160  const label neighbourFacei,
161  const wallNormalInfo& neighbourInfo,
162  const scalar tol,
163  TrackingData& td
164  );
165 
166  //- Influence of neighbouring cell.
167  template<class TrackingData>
168  inline bool updateFace
169  (
170  const polyMesh&,
171  const label thisFacei,
172  const label neighbourCelli,
173  const wallNormalInfo& neighbourInfo,
174  const scalar tol,
175  TrackingData& td
176  );
177 
178  //- Influence of different value on same face.
179  template<class TrackingData>
180  inline bool updateFace
181  (
182  const polyMesh&,
183  const label thisFacei,
184  const wallNormalInfo& neighbourInfo,
185  const scalar tol,
186  TrackingData& td
187  );
188 
189  //- Test for equality, with TrackingData
190  template<class TrackingData>
191  inline bool equal(const wallNormalInfo&, TrackingData& td) const;
192 
193 
194  // Member Operators
195 
196  //- Test for equality
197  inline bool operator==(const wallNormalInfo&) const;
198 
199  //- Test for inequality
200  inline bool operator!=(const wallNormalInfo&) const;
201 
202 
203  // IOstream Operators
204 
205  friend Ostream& operator<<(Ostream&, const wallNormalInfo&);
206  friend Istream& operator>>(Istream&, wallNormalInfo&);
207 };
208 
209 
210 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
211 
212 //- Contiguous data for wallNormalInfo
213 template<> struct is_contiguous<wallNormalInfo> : std::true_type {};
214 
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 } // End namespace Foam
219 
220 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221 
222 #include "wallNormalInfoI.H"
223 
224 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
225 
226 #endif
227 
228 // ************************************************************************* //
Foam::wallNormalInfo::operator!=
bool operator!=(const wallNormalInfo &) const
Test for inequality.
Definition: wallNormalInfoI.H:206
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
Foam::wallNormalInfo::valid
bool valid(TrackingData &td) const
Changed or contains original (invalid) value.
Definition: wallNormalInfoI.H:79
point.H
Foam::wallNormalInfo::normal
const vector & normal() const
Definition: wallNormalInfo.H:95
Foam::wallNormalInfo::operator<<
friend Ostream & operator<<(Ostream &, const wallNormalInfo &)
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:230
Foam::wallNormalInfo::normal
vector & normal()
Definition: wallNormalInfo.H:99
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
tensor.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
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::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:68
wallNormalInfoI.H
scalar.H
w2
#define w2
Definition: blockCreate.C:35
Foam::wallNormalInfo::operator==
bool operator==(const wallNormalInfo &) const
Test for equality.
Definition: wallNormalInfoI.H:197
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::wallNormalInfo::equal
bool equal(const wallNormalInfo &, TrackingData &td) const
Test for equality, with TrackingData.
Definition: wallNormalInfoI.H:185
Foam::wallNormalInfo::operator>>
friend Istream & operator>>(Istream &, wallNormalInfo &)
Foam::Vector< scalar >
label.H
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::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::point
vector point
Point is a vector.
Definition: point.H:43
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::tensor
Tensor< scalar > tensor
Tensor of scalars, i.e. Tensor<scalar>.
Definition: symmTensor.H:61
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
Foam::is_contiguous
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:75