Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::patchDataWave
29
30Description
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
37See also
38 The patchWave class.
39
40SourceFiles
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
55namespace Foam
56{
57
58// Forward declaration of classes
59class polyMesh;
60class wallPoint;
61
62/*---------------------------------------------------------------------------*\
63 Class patchDataWave Declaration
64\*---------------------------------------------------------------------------*/
65
66template<class TransferType, class TrackingData = int>
67class patchDataWave
68:
69 public cellDistFuncs
70{
71
72private:
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 DynamicList<label>& changedFaces,
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
133public:
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
189 return cellData_;
190 }
191
193 {
194 return patchData_;
195 }
198 {
199 return patchData_;
200 }
202 label nUnset() const
203 {
204 return nUnset_;
205 }
207
208
209// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210
211} // End namespace Foam
212
213// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214
215#ifdef NoRepository
217#endif
218
219// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220
221#endif
222
223// ************************************************************************* //
labelList patchIDs
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition DynamicList.H:68
A field of fields is a PtrList of fields with reference counting.
Definition FieldField.H:77
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
FaceCellWave plus data.
Definition MeshWave.H:58
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition UPtrList.H:101
const polyMesh & mesh() const
Access mesh.
virtual ~patchDataWave()
Destructor.
const FieldField< Field, scalar > & patchDistance() const
const Field< Type > & cellData() const
virtual void correct()
Correct for mesh geom/topo changes.
Field< Type > & cellData()
label nUnset() const
scalarField & distance()
Non const access so we can 'transfer' contents for efficiency.
FieldField< Field, scalar > & patchDistance()
const FieldField< Field, Type > & patchData() const
FieldField< Field, Type > & patchData()
const scalarField & distance() const
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.
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
Holds information regarding nearest wall point. Used in wall distance calculation.
Definition wallPoint.H:62
wallPoints::trackData td(isBlockedFace, regionToBlockSize)
Namespace for OpenFOAM.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
Definition HashSet.H:85
Field< scalar > scalarField
Specialisation of Field<T> for scalar.