FvWallInfoData.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-2022 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::FvWallInfoData
26 
27 Description
28  Holds information (coordinate and normal) regarding nearest wall point.
29 
30  Is like FvWallInfo but transfer extra (passive) data.
31  Used e.g. in wall distance calculation with wall reflection vectors.
32 
33 SourceFiles
34  FvWallInfoDataI.H
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef FvWallInfoData_H
39 #define FvWallInfoData_H
40 
41 #include "FvWallInfo.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 // Forward declaration of friend functions and operators
49 template<class WallInfo, class Type, class Derived>
50 class FvWallInfoDataBase;
51 
52 template<class WallInfo, class Type, class Derived>
53 Istream& operator>>
54 (
55  Istream&,
57 );
58 
59 template<class WallInfo, class Type, class Derived>
60 Ostream& operator<<
61 (
62  Ostream&,
64 );
65 
66 
67 /*---------------------------------------------------------------------------*\
68  Class FvWallInfoDataBase Declaration
69 \*---------------------------------------------------------------------------*/
70 
71 template<class WallInfo, class Type, class Derived>
73 :
74  public FvWallInfoBase<WallInfo, Derived>
75 {
76  // Private Data
77 
78  //- Data at nearest wall center
79  Type data_;
80 
81 
82 protected:
83 
84  // Protected Member Functions
85 
86  //- Evaluate distance to point. Update distSqr, origin from whomever
87  // is nearer pt. Return true if w2 is closer to point.
88  template<class TrackingData>
89  inline bool update
90  (
91  const point&,
93  const scalar tol,
94  TrackingData& td
95  );
96 
97 
98 public:
99 
100  friend class FvWallInfoBase<WallInfo, Derived>;
101 
103  typedef Type dataType;
104 
105 
106  // Constructors
107 
108  //- Construct null
109  inline FvWallInfoDataBase();
110 
111  //- Construct from data and other geometry
112  template<class ... Geometry>
113  inline FvWallInfoDataBase
114  (
115  const Type& data,
116  const Geometry& ... geometry
117  );
118 
119 
120  // Member Functions
121 
122  // Access
123 
124  inline const Type& data() const;
125 
126  inline Type& data();
127 
128  template<class TrackingData>
129  inline const Type& data(TrackingData& td) const;
130 
131 
132  // Needed by meshWave
133 
134  //- Transform across an interface
135  template<class TrackingData>
136  inline void transform
137  (
138  const fvPatch& patch,
139  const label patchFacei,
140  const transformer& transform,
141  TrackingData& td
142  );
143 
144 
145  // IOstream Operators
146 
147  friend Ostream& operator<< <WallInfo, Type, Derived>
148  (
149  Ostream&,
151  );
152 
153  friend Istream& operator>> <WallInfo, Type, Derived>
154  (
155  Istream&,
157  );
158 };
159 
160 
161 /*---------------------------------------------------------------------------*\
162  Class FvWallInfoData Declaration
163 \*---------------------------------------------------------------------------*/
164 
165 template<class WallInfo, class Type>
166 class FvWallInfoData
167 :
168  public FvWallInfoDataBase<WallInfo, Type, FvWallInfoData<WallInfo, Type>>
169 {
170  public:
171 
172  using
175 };
176 
178 #define DefineFvWallInfoType(Type, nullArg) \
179  \
180  template<class WallInfo> \
181  using CAT(FvWallInfo, CAPITALIZE(Type)) = FvWallInfoData<WallInfo, Type>; \
182  \
183  template<> \
184  inline bool contiguous<CAT(FvWallInfo, CAPITALIZE(Type))<wallPoint>>() \
185  { \
186  return contiguous<FvWallInfo<wallPoint>>(); \
187  }
189 DefineFvWallInfoType(bool, nullArg)
190 DefineFvWallInfoType(label, nullArg)
192 
193 #undef DefineFvWallInfoType
194 
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 } // End namespace Foam
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 #include "FvWallInfoDataI.H"
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #endif
207 
208 // ************************************************************************* //
Vector-tensor class used to perform translations, rotations and scaling operations in 3D space...
Definition: transformer.H:83
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:63
#define w2
Definition: blockCreate.C:32
const Type & data() const
#define DefineFvWallInfoType(Type, nullArg)
Database for solution and other reduced data.
Definition: data.H:51
FvWallInfoDataBase()
Construct null.
bool update(const point &, const FvWallInfoDataBase< WallInfo, Type, Derived > &w2, const scalar tol, TrackingData &td)
Evaluate distance to point. Update distSqr, origin from whomever.
void transform(const fvPatch &patch, const label patchFacei, const transformer &transform, TrackingData &td)
Transform across an interface.
FOR_ALL_FIELD_TYPES(DefineFvWallInfoType)
Namespace for OpenFOAM.