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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::patchDataWave
28 
29 Description
30  Takes a set of patches to start MeshWave from.
31 
32  Holds after construction distance at cells and distance at patches
33  (like patchWave), but also additional transported data.
34  It is used, for example, in the y+ calculation.
35 
36 See also
37  The patchWave class.
38 
39 SourceFiles
40  patchDataWave.C
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef patchDataWave_H
45 #define patchDataWave_H
46 
47 #include "cellDistFuncs.H"
48 #include "FieldField.H"
49 #include "UPtrList.H"
50 #include "MeshWave.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 // Forward declaration of classes
58 class polyMesh;
59 class wallPoint;
60 
61 /*---------------------------------------------------------------------------*\
62  Class patchDataWave Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 template<class TransferType>
66 class patchDataWave
67 :
68  public cellDistFuncs
69 {
70 
71 private:
72 
73  typedef typename TransferType::dataType Type;
74 
75 
76  // Private Member Data
77 
78  //- Current patch subset (stored as patchIDs)
79  labelHashSet patchIDs_;
80 
81  //- Reference to initial extra data at patch faces
82  const UPtrList<Field<Type>>& initialPatchValuePtrs_;
83 
84  //- Do accurate distance calculation for near-wall cells.
85  bool correctWalls_;
86 
87  //
88  // After construction:
89  //
90 
91  //- Number of cells/faces unset after MeshWave has finished
92  label nUnset_;
93 
94  //- Distance at cell centres
95  scalarField distance_;
96 
97  //- Distance at patch faces
98  FieldField<Field, scalar> patchDistance_;
99 
100  //- Extra data at cell centres
101  Field<Type> cellData_;
102 
103  //- Extra data at patch faces
104  FieldField<Field, Type> patchData_;
105 
106 
107  // Private Member Functions
108 
109  //- Set initial set of changed faces
110  void setChangedFaces
111  (
112  const labelHashSet& patchIDs,
113  labelList&,
115  ) const;
116 
117  //- Copy MeshWave values into *this
118  label getValues(const MeshWave<TransferType>&);
119 
120 
121 public:
122 
123  // Constructors
124 
125  //- Construct from mesh, information on patches to initialize and flag
126  // whether or not to correct wall.
127  // Calculate for all cells. correctWalls : correct wall (face&point)
128  // cells for correct distance, searching neighbours.
130  (
131  const polyMesh& mesh,
132  const labelHashSet& patchIDs,
133  const UPtrList<Field<Type>>& initialPatchValuePtrs,
134  bool correctWalls = true
135  );
136 
137 
138  //- Destructor
139  virtual ~patchDataWave();
140 
141 
142  // Member Functions
143 
144  //- Correct for mesh geom/topo changes
145  virtual void correct();
146 
147 
148  const scalarField& distance() const
149  {
150  return distance_;
151  }
152 
153  //- Non const access so we can 'transfer' contents for efficiency.
155  {
156  return distance_;
157  }
158 
160  {
161  return patchDistance_;
162  }
163 
165  {
166  return patchDistance_;
167  }
168 
169  const Field<Type>& cellData() const
170  {
171  return cellData_;
172  }
173 
175  {
176  return cellData_;
177  }
178 
179  const FieldField<Field, Type>& patchData() const
180  {
181  return patchData_;
182  }
183 
185  {
186  return patchData_;
187  }
188 
189  label nUnset() const
190  {
191  return nUnset_;
192  }
193 };
194 
195 
196 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197 
198 } // End namespace Foam
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 #ifdef NoRepository
203  #include "patchDataWave.C"
204 #endif
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 #endif
209 
210 // ************************************************************************* //
UPtrList.H
Foam::FieldField
A field of fields is a PtrList of fields with reference counting.
Definition: FieldField.H:53
FieldField.H
Foam::patchDataWave::patchDataWave
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.
Definition: patchDataWave.C:174
Foam::patchDataWave
Takes a set of patches to start MeshWave from.
Definition: patchDataWave.H:65
cellDistFuncs.H
Foam::patchDataWave::distance
scalarField & distance()
Non const access so we can 'transfer' contents for efficiency.
Definition: patchDataWave.H:153
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:173
Foam::label
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:62
Foam::Field< scalar >
MeshWave.H
Foam::MeshWave
FaceCellWave plus data.
Definition: MeshWave.H:58
Foam::patchDataWave::~patchDataWave
virtual ~patchDataWave()
Destructor.
Definition: patchDataWave.C:198
Foam::patchDataWave::distance
const scalarField & distance() const
Definition: patchDataWave.H:147
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:168
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:183
Foam::patchDataWave::patchData
const FieldField< Field, Type > & patchData() const
Definition: patchDataWave.H:178
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:206
Foam::patchDataWave::nUnset
label nUnset() const
Definition: patchDataWave.H:188
patchDataWave.C
Foam::patchDataWave::patchDistance
const FieldField< Field, scalar > & patchDistance() const
Definition: patchDataWave.H:158
Foam::patchDataWave::patchDistance
FieldField< Field, scalar > & patchDistance()
Definition: patchDataWave.H:163