patchDataWave.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) 2020 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::patchDataWave
29 
30 Description
31  Takes a set of patches to start MeshWave from.
32 
33  Holds after construction distance at cells and distance at patches
34  (like patchWave), but also additional transported data.
35  It is used, for example, in the y+ calculation.
36 
37 See also
38  The patchWave class.
39 
40 SourceFiles
41  patchDataWave.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef patchDataWave_H
46 #define patchDataWave_H
47 
48 #include "cellDistFuncs.H"
49 #include "FieldField.H"
50 #include "UPtrList.H"
51 #include "MeshWave.H"
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace Foam
56 {
57 
58 // Forward declaration of classes
59 class polyMesh;
60 class wallPoint;
61 
62 /*---------------------------------------------------------------------------*\
63  Class patchDataWave Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 template<class TransferType, class TrackingData = int>
67 class patchDataWave
68 :
69  public cellDistFuncs
70 {
71 
72 private:
73 
74  typedef typename TransferType::dataType Type;
75 
76 
77  // Private Member Data
78 
79  //- Current patch subset (stored as patchIDs)
80  labelHashSet patchIDs_;
81 
82  //- Reference to initial extra data at patch faces
83  const UPtrList<Field<Type>>& initialPatchValuePtrs_;
84 
85  //- Do accurate distance calculation for near-wall cells.
86  bool correctWalls_;
87 
88  //- Additional data to be passed into underlying containers
89  TrackingData& td_;
90 
91 
92  //
93  // After construction:
94  //
95 
96  //- Number of cells/faces unset after MeshWave has finished
97  label nUnset_;
98 
99  //- Distance at cell centres
100  scalarField distance_;
101 
102  //- Distance at patch faces
103  FieldField<Field, scalar> patchDistance_;
104 
105  //- Extra data at cell centres
106  Field<Type> cellData_;
107 
108  //- Extra data at patch faces
109  FieldField<Field, Type> patchData_;
110 
111 
112  // Private Member Functions
113 
114  //- Set initial set of changed faces
115  void setChangedFaces
116  (
117  const labelHashSet& patchIDs,
118  labelList&,
120  ) const;
121 
122  //- Copy MeshWave values into *this
123  label getValues(const MeshWave<TransferType, TrackingData>&);
124 
125 
126  // Private static data
127 
128  //- Used as default trackdata value to satisfy default template
129  // argument.
130  static int dummyTrackData_;
131 
132 
133 public:
134 
135  // Constructors
136 
137  //- Construct from mesh, information on patches to initialize and flag
138  // whether or not to correct wall.
139  // Calculate for all cells. correctWalls : correct wall (face&point)
140  // cells for correct distance, searching neighbours.
142  (
143  const polyMesh& mesh,
144  const labelHashSet& patchIDs,
145  const UPtrList<Field<Type>>& initialPatchValuePtrs,
146  const bool correctWalls = true,
147  TrackingData& td = dummyTrackData_
148  );
149 
150 
151  //- Destructor
152  virtual ~patchDataWave();
153 
154 
155  // Member Functions
156 
157  //- Correct for mesh geom/topo changes
158  virtual void correct();
159 
160 
161  const scalarField& distance() const
162  {
163  return distance_;
164  }
165 
166  //- Non const access so we can 'transfer' contents for efficiency.
168  {
169  return distance_;
170  }
171 
173  {
174  return patchDistance_;
175  }
176 
178  {
179  return patchDistance_;
180  }
181 
182  const Field<Type>& cellData() const
183  {
184  return cellData_;
185  }
186 
188  {
189  return cellData_;
190  }
191 
192  const FieldField<Field, Type>& patchData() const
193  {
194  return patchData_;
195  }
196 
198  {
199  return patchData_;
200  }
201 
202  label nUnset() const
203  {
204  return nUnset_;
205  }
206 };
207 
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 } // End namespace Foam
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 #ifdef NoRepository
216  #include "patchDataWave.C"
217 #endif
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 #endif
222 
223 // ************************************************************************* //
UPtrList.H
Foam::FieldField
A field of fields is a PtrList of fields with reference counting.
Definition: FieldField.H:53
FieldField.H
Foam::patchDataWave
Takes a set of patches to start MeshWave from.
Definition: patchDataWave.H:66
cellDistFuncs.H
Foam::patchDataWave::distance
scalarField & distance()
Non const access so we can 'transfer' contents for efficiency.
Definition: patchDataWave.H:166
Foam::HashSet< label, Hash< label > >
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::patchDataWave::cellData
Field< Type > & cellData()
Definition: patchDataWave.H:186
Foam::Field< scalar >
MeshWave.H
Foam::MeshWave
FaceCellWave plus data.
Definition: MeshWave.H:59
Foam::patchDataWave::~patchDataWave
virtual ~patchDataWave()
Destructor.
Definition: patchDataWave.C:207
Foam::patchDataWave::patchDataWave
patchDataWave(const polyMesh &mesh, const labelHashSet &patchIDs, const UPtrList< Field< Type >> &initialPatchValuePtrs, const bool correctWalls=true, TrackingData &td=dummyTrackData_)
Construct from mesh, information on patches to initialize and flag.
Definition: patchDataWave.C:181
Foam::patchDataWave::distance
const scalarField & distance() const
Definition: patchDataWave.H:160
Foam::UPtrList
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition: UPtrList.H:63
Foam::patchDataWave::cellData
const Field< Type > & cellData() const
Definition: patchDataWave.H:181
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::cellDistFuncs::mesh
const polyMesh & mesh() const
Access mesh.
Definition: cellDistFuncs.H:96
Foam::patchDataWave::patchData
FieldField< Field, Type > & patchData()
Definition: patchDataWave.H:196
Foam::patchDataWave::patchData
const FieldField< Field, Type > & patchData() const
Definition: patchDataWave.H:191
Foam::cellDistFuncs
Collection of functions used in wall distance calculation.
Definition: cellDistFuncs.H:62
Foam::List< label >
Foam::patchDataWave::correct
virtual void correct()
Correct for mesh geom/topo changes.
Definition: patchDataWave.C:215
Foam::patchDataWave::nUnset
label nUnset() const
Definition: patchDataWave.H:201
patchDataWave.C
Foam::patchDataWave::patchDistance
const FieldField< Field, scalar > & patchDistance() const
Definition: patchDataWave.H:171
Foam::patchDataWave::patchDistance
FieldField< Field, scalar > & patchDistance()
Definition: patchDataWave.H:176