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  //- Interpolate between two values (lerp). Returns true if
190  //- causes changes. Not sure if needs to be specialised between
191  //- face and cell and what index is needed...
192  template<class TrackingData>
193  inline bool interpolate
194  (
195  const polyMesh&,
196  const point& pt,
197  const label i0,
198  const wallNormalInfo& f0,
199  const label i1,
200  const wallNormalInfo& f1,
201  const scalar weight,
202  const scalar tol,
203  TrackingData& td
204  );
205 
206  //- Test for equality, with TrackingData
207  template<class TrackingData>
208  inline bool equal(const wallNormalInfo&, TrackingData& td) const;
209 
210 
211  // Member Operators
212 
213  //- Test for equality
214  inline bool operator==(const wallNormalInfo&) const;
215 
216  //- Test for inequality
217  inline bool operator!=(const wallNormalInfo&) const;
218 
219 
220  // IOstream Operators
221 
222  friend Ostream& operator<<(Ostream&, const wallNormalInfo&);
224 };
225 
226 
227 // * * * * * * * * * * * * * * * * * Traits * * * * * * * * * * * * * * * * //
228 
229 //- Contiguous data for wallNormalInfo
230 template<> struct is_contiguous<wallNormalInfo> : std::true_type {};
231 
232 
233 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
234 
235 } // End namespace Foam
236 
237 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
238 
239 #include "wallNormalInfoI.H"
240 
241 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
242 
243 #endif
244 
245 // ************************************************************************* //
Holds information regarding nearest wall point. Used in wall refinement.
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
bool operator!=(const wallNormalInfo &) const
Test for inequality.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
friend Ostream & operator<<(Ostream &, const wallNormalInfo &)
#define w2
Definition: blockCreate.C:28
bool valid(TrackingData &td) const
Changed or contains original (invalid) value.
bool updateFace(const polyMesh &, const label thisFacei, const label neighbourCelli, const wallNormalInfo &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
const vector & normal() const
void enterDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Reverse of leaveDomain.
Istream & operator>>(Istream &, directionInfo &)
bool interpolate(const polyMesh &, const point &pt, const label i0, const wallNormalInfo &f0, const label i1, const wallNormalInfo &f1, const scalar weight, const scalar tol, TrackingData &td)
Interpolate between two values (lerp). Returns true if causes changes. Not sure if needs to be specia...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
bool equal(const wallNormalInfo &, TrackingData &td) const
Test for equality, with TrackingData.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:77
friend Istream & operator>>(Istream &, wallNormalInfo &)
void leaveDomain(const polyMesh &, const polyPatch &, const label patchFacei, const point &faceCentre, TrackingData &td)
Convert any absolute coordinates into relative to (patch)face.
wallNormalInfo()
Default construct.
bool operator==(const wallNormalInfo &) const
Test for equality.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:75
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:69
Tensor of scalars, i.e. Tensor<scalar>.
bool updateCell(const polyMesh &, const label thisCelli, const label neighbourFacei, const wallNormalInfo &neighbourInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
Namespace for OpenFOAM.
bool sameGeometry(const polyMesh &, const wallNormalInfo &, const scalar, TrackingData &td) const
Check for identical geometrical data (eg, cyclics checking)