All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
wallPointData.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 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 Class
25  Foam::wallPointData
26 
27 Description
28  Holds information (coordinate and normal) regarding nearest wall point.
29 
30  Is like wallPoint but transfer extra (passive) data.
31  Used e.g. in wall distance calculation with wall reflection vectors.
32 
33 SourceFiles
34  wallPointDataI.H
35  wallPointData.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef wallPointData_H
40 #define wallPointData_H
41 
42 #include "wallPoint.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 template<class Type> class wallPointData;
50 
51 // Forward declaration of friend functions and operators
52 
53 template<class Type> Istream& operator>>(Istream&, wallPointData<Type>&);
54 template<class Type> Ostream& operator<<(Ostream&, const wallPointData<Type>&);
55 
56 
57 /*---------------------------------------------------------------------------*\
58  Class wallPointData Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 template<class Type>
62 class wallPointData
63 :
64  public wallPoint
65 {
66  // Private Data
67 
68  //- Data at nearest wall center
69  Type data_;
70 
71 
72  // Private Member Functions
73 
74  //- Evaluate distance to point. Update distSqr, origin from whomever
75  // is nearer pt. Return true if w2 is closer to point,
76  // false otherwise.
77  template<class TrackingData>
78  inline bool update
79  (
80  const point&,
81  const wallPointData<Type>& w2,
82  const scalar tol,
83  TrackingData& td
84  );
85 
86 
87 public:
88 
89  typedef Type dataType;
90 
91 
92  // Constructors
93 
94  //- Construct null
95  inline wallPointData();
96 
97  //- Construct from origin, normal, distance
98  inline wallPointData
99  (
100  const point& origin,
101  const Type& data,
102  const scalar distSqr
103  );
104 
105 
106  // Member Functions
107 
108  // Access
109 
110  inline const Type& data() const;
111  inline Type& data();
112 
113  // Needed by meshWave
114 
115  //- Influence of neighbouring face.
116  // Calls update(...) with cellCentre of celli
117  template<class TrackingData>
118  inline bool updateCell
119  (
120  const polyMesh& mesh,
121  const label thisCelli,
122  const label neighbourFacei,
123  const wallPointData<Type>& neighbourWallInfo,
124  const scalar tol,
125  TrackingData& td
126  );
127 
128  //- Influence of neighbouring cell.
129  // Calls update(...) with faceCentre of facei
130  template<class TrackingData>
131  inline bool updateFace
132  (
133  const polyMesh& mesh,
134  const label thisFacei,
135  const label neighbourCelli,
136  const wallPointData<Type>& neighbourWallInfo,
137  const scalar tol,
138  TrackingData& td
139  );
140 
141  //- Influence of different value on same face.
142  // Merge new and old info.
143  // Calls update(...) with faceCentre of facei
144  template<class TrackingData>
145  inline bool updateFace
146  (
147  const polyMesh& mesh,
148  const label thisFacei,
149  const wallPointData<Type>& neighbourWallInfo,
150  const scalar tol,
151  TrackingData& td
152  );
153 
154  // Member Operators
155 
156  // IOstream Operators
157 
158  friend Ostream& operator<< <Type>(Ostream&, const wallPointData<Type>&);
159  friend Istream& operator>> <Type>(Istream&, wallPointData<Type>&);
160 };
161 
162 
163 //- Data associated with wallPointData type are contiguous. List the usual
164 // ones.
165 
166 template<>
167 inline bool contiguous<wallPointData<bool>>()
168 {
169  return contiguous<wallPoint>();
170 }
171 template<>
172 inline bool contiguous<wallPointData<label>>()
173 {
174  return contiguous<wallPoint>();
175 }
176 template<>
177 inline bool contiguous<wallPointData<scalar>>()
178 {
179  return contiguous<wallPoint>();
180 }
181 template<>
182 inline bool contiguous<wallPointData<vector>>()
183 {
184  return contiguous<wallPoint>();
185 }
186 template<>
187 inline bool contiguous<wallPointData<sphericalTensor>>()
188 {
189  return contiguous<wallPoint>();
190 }
191 template<>
192 inline bool contiguous<wallPointData<symmTensor>>()
193 {
194  return contiguous<wallPoint>();
195 }
196 template<>
197 inline bool contiguous<wallPointData<tensor>>()
198 {
199  return contiguous<wallPoint>();
200 }
201 
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 
206 } // End namespace Foam
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 #ifdef NoRepository
211  #include "wallPointData.C"
212 #endif
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 #include "wallPointDataI.H"
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 #endif
221 
222 // ************************************************************************* //
bool contiguous< wallPoint >()
Data associated with wallPoint type are contiguous.
Definition: wallPoint.H:218
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
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
const Type & data() const
#define w2
Definition: blockCreate.C:32
dynamicFvMesh & mesh
Istream & operator>>(Istream &, directionInfo &)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
Database for solution and other reduced data.
Definition: data.H:51
Holds information regarding nearest wall point. Used in wall distance calculation.
Definition: wallPoint.H:63
bool updateCell(const polyMesh &mesh, const label thisCelli, const label neighbourFacei, const wallPointData< Type > &neighbourWallInfo, const scalar tol, TrackingData &td)
Influence of neighbouring face.
Holds information (coordinate and normal) regarding nearest wall point.
Definition: wallPointData.H:48
const point & origin() const
Definition: wallPointI.H:101
scalar distSqr() const
Definition: wallPointI.H:113
wallPointData()
Construct null.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
bool updateFace(const polyMesh &mesh, const label thisFacei, const label neighbourCelli, const wallPointData< Type > &neighbourWallInfo, const scalar tol, TrackingData &td)
Influence of neighbouring cell.
Namespace for OpenFOAM.