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 /*---------------------------------------------------------------------------*\
63  Class wallNormalInfo Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 class wallNormalInfo
67 {
68  // Private data
69 
70  //- Normal at nearest wall point
71  vector normal_;
72 
73  // Private Member Functions
74 
75  //- Evaluate distance to point. Update normal_
76  template<class TrackingData>
77  inline bool update(const wallNormalInfo& w2, TrackingData& td);
78 
79 public:
80 
81  // Constructors
82 
83  //- Construct null
84  inline wallNormalInfo();
85 
86  //- Construct from normal
87  inline wallNormalInfo(const vector& normal);
88 
89  //- Construct as copy
90  inline wallNormalInfo(const wallNormalInfo&);
91 
92  // Member Functions
93 
94  // Access
95 
96  inline const vector& normal() const;
97 
98 
99  // Needed by FaceCellWave
100 
101  //- Check whether origin has been changed at all or
102  // still contains original (invalid) value.
103  template<class TrackingData>
104  inline bool valid(TrackingData& td) const;
105 
106  //- Check for identical geometrical data. Used for cyclics checking.
107  template<class TrackingData>
108  inline bool sameGeometry
109  (
110  const polyMesh&,
111  const wallNormalInfo&,
112  const scalar,
113  TrackingData& td
114  ) const;
115 
116  //- Convert any absolute coordinates into relative to (patch)face
117  // centre
118  template<class TrackingData>
119  inline void leaveDomain
120  (
121  const polyMesh&,
122  const polyPatch&,
123  const label patchFacei,
124  const point& faceCentre,
125  TrackingData& td
126  );
127 
128  //- Reverse of leaveDomain
129  template<class TrackingData>
130  inline void enterDomain
131  (
132  const polyMesh&,
133  const polyPatch&,
134  const label patchFacei,
135  const point& faceCentre,
136  TrackingData& td
137  );
138 
139  //- Apply rotation matrix to any coordinates
140  template<class TrackingData>
141  inline void transform
142  (
143  const polyMesh&,
144  const tensor&,
145  TrackingData& td
146  );
147 
148  //- Influence of neighbouring face.
149  template<class TrackingData>
150  inline bool updateCell
151  (
152  const polyMesh&,
153  const label thisCelli,
154  const label neighbourFacei,
155  const wallNormalInfo& neighbourInfo,
156  const scalar tol,
157  TrackingData& td
158  );
159 
160  //- Influence of neighbouring cell.
161  template<class TrackingData>
162  inline bool updateFace
163  (
164  const polyMesh&,
165  const label thisFacei,
166  const label neighbourCelli,
167  const wallNormalInfo& neighbourInfo,
168  const scalar tol,
169  TrackingData& td
170  );
171 
172  //- Influence of different value on same face.
173  template<class TrackingData>
174  inline bool updateFace
175  (
176  const polyMesh&,
177  const label thisFacei,
178  const wallNormalInfo& neighbourInfo,
179  const scalar tol,
180  TrackingData& td
181  );
182 
183  //- Same (like operator==)
184  template<class TrackingData>
185  inline bool equal(const wallNormalInfo&, TrackingData& td) const;
186 
187  // Member Operators
188 
189  // Needed for List IO
190  inline bool operator==(const wallNormalInfo&) const;
191 
192  inline bool operator!=(const wallNormalInfo&) const;
193 
194 
195  // IOstream Operators
196 
197  friend Ostream& operator<<(Ostream&, const wallNormalInfo&);
199 };
200 
201 
202 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
203 
204 //- Contiguous data for wallNormalInfo
205 template<> struct is_contiguous<wallNormalInfo> : std::true_type {};
206 
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 } // End namespace Foam
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 #include "wallNormalInfoI.H"
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 #endif
219 
220 // ************************************************************************* //
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
Foam::wallNormalInfo::valid
bool valid(TrackingData &td) const
Check whether origin has been changed at all or.
Definition: wallNormalInfoI.H:93
point.H
Foam::wallNormalInfo::operator<<
friend Ostream & operator<<(Ostream &, const wallNormalInfo &)
Foam::operator>>
Istream & operator>>(Istream &, directionInfo &)
Definition: directionInfo.C:228
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
tensor.H
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::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:66
wallNormalInfoI.H
scalar.H
w2
#define w2
Definition: blockCreate.C:35
Foam::wallNormalInfo::operator==
bool operator==(const wallNormalInfo &) const
Definition: wallNormalInfoI.H:210
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::wallNormalInfo::equal
bool equal(const wallNormalInfo &, TrackingData &td) const
Same (like operator==)
Definition: wallNormalInfoI.H:199
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:129
Foam::wallNormalInfo
Holds information regarding nearest wall point. Used in wall refinement.
Definition: wallNormalInfo.H:65
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
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::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &)
Definition: boundaryPatch.C:102
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
Foam::is_contiguous
A template class to specify that a data type can be considered as being contiguous in memory.
Definition: contiguous.H:75