All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
patchDataWave.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::patchDataWave
26 
27 Description
28  Takes a set of patches to start MeshWave from.
29 
30  Holds after construction distance at cells and distance at patches
31  (like patchWave), but also additional transported data.
32  It is used, for example, in the y+ calculation.
33 
34 See also
35  The patchWave class.
36 
37 SourceFiles
38  patchDataWave.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef patchDataWave_H
43 #define patchDataWave_H
44 
45 #include "cellDistFuncs.H"
46 #include "FieldField.H"
47 #include "UPtrList.H"
48 #include "MeshWave.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 // Forward declaration of classes
56 class polyMesh;
57 class wallPoint;
58 
59 /*---------------------------------------------------------------------------*\
60  Class patchDataWave Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 template<class TransferType>
64 class patchDataWave
65 :
66  public cellDistFuncs
67 {
68  typedef typename TransferType::dataType Type;
69 
70 
71  // Private Member Data
72 
73  //- Current patch subset (stored as patchIDs)
74  labelHashSet patchIDs_;
75 
76  //- Reference to initial extra data at patch faces
77  const UPtrList<Field<Type>>& initialPatchValuePtrs_;
78 
79  //- Do accurate distance calculation for near-wall cells.
80  bool correctWalls_;
81 
82  //
83  // After construction:
84  //
85 
86  //- Number of cells/faces unset after MeshWave has finished
87  label nUnset_;
88 
89  //- Distance at cell centres
90  scalarField distance_;
91 
92  //- Distance at patch faces
93  FieldField<Field, scalar> patchDistance_;
94 
95  //- Extra data at cell centres
96  Field<Type> cellData_;
97 
98  //- Extra data at patch faces
99  FieldField<Field, Type> patchData_;
100 
101 
102  // Private Member Functions
103 
104  //- Set initial set of changed faces
105  void setChangedFaces
106  (
107  const labelHashSet& patchIDs,
108  labelList&,
110  ) const;
111 
112  //- Copy MeshWave values into *this
113  label getValues(const MeshWave<TransferType>&);
114 
115 
116 public:
117 
118  // Constructors
119 
120  //- Construct from mesh, information on patches to initialize and flag
121  // whether or not to correct wall.
122  // Calculate for all cells. correctWalls : correct wall (face&point)
123  // cells for correct distance, searching neighbours.
125  (
126  const polyMesh& mesh,
127  const labelHashSet& patchIDs,
128  const UPtrList<Field<Type>>& initialPatchValuePtrs,
129  bool correctWalls = true
130  );
131 
132 
133  //- Destructor
134  virtual ~patchDataWave();
135 
136 
137  // Member Functions
138 
139  //- Correct for mesh geom/topo changes
140  virtual void correct();
141 
143  const scalarField& distance() const
144  {
145  return distance_;
146  }
147 
148  //- Non const access so we can 'transfer' contents for efficiency.
150  {
151  return distance_;
152  }
155  {
156  return patchDistance_;
157  }
160  {
161  return patchDistance_;
162  }
164  const Field<Type>& cellData() const
165  {
166  return cellData_;
167  }
170  {
171  return cellData_;
172  }
174  const FieldField<Field, Type>& patchData() const
175  {
176  return patchData_;
177  }
180  {
181  return patchData_;
182  }
184  label nUnset() const
185  {
186  return nUnset_;
187  }
188 };
189 
190 
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 
193 } // End namespace Foam
194 
195 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 
197 #ifdef NoRepository
198  #include "patchDataWave.C"
199 #endif
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 #endif
204 
205 // ************************************************************************* //
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
label nUnset() const
Takes a set of patches to start MeshWave from.
Definition: patchDataWave.H:63
Generic field type.
Definition: FieldField.H:51
patchDataWave(const polyMesh &mesh, const labelHashSet &patchIDs, const UPtrList< Field< Type >> &initialPatchValuePtrs, bool correctWalls=true)
Construct from mesh, information on patches to initialize and flag.
Collection of functions used in wall distance calculation.
Definition: cellDistFuncs.H:61
virtual void correct()
Correct for mesh geom/topo changes.
FaceCellWave plus data.
Definition: MeshWave.H:56
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: UPtrList.H:54
const FieldField< Field, Type > & patchData() const
const scalarField & distance() const
const FieldField< Field, scalar > & patchDistance() const
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
virtual ~patchDataWave()
Destructor.
const Field< Type > & cellData() const
const polyMesh & mesh() const
Access mesh.
Definition: cellDistFuncs.H:92
Namespace for OpenFOAM.