patchWave.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-2021 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::patchWave
26 
27 Description
28  Takes a set of patches to start MeshWave from. After construction holds
29  distance at cells and distance at patches. Is e.g. used by wallDist to
30  construct volScalarField with correct distance to wall.
31 
32 SourceFiles
33  patchWave.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef patchWave_H
38 #define patchWave_H
39 
40 #include "cellDistFuncs.H"
41 #include "FieldField.H"
42 #include "MeshWave.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 // Forward declaration of classes
50 class polyMesh;
51 class wallPoint;
52 
53 /*---------------------------------------------------------------------------*\
54  Class patchWave Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class patchWave
58 :
59  public cellDistFuncs
60 {
61  // Private Data
62 
63  //- Current patch subset (stored as patchIDs)
64  labelHashSet patchIDs_;
65 
66  //- Do accurate distance calculation for near-wall cells.
67  bool correctWalls_;
68 
69  //- Number of cells/faces unset after MeshWave has finished
70  label nUnset_;
71 
72  //- Distance at cell centres
73  scalarField distance_;
74 
75  //- Distance at patch faces
76  FieldField<Field, scalar> patchDistance_;
77 
78 
79  // Private Member Functions
80 
81  //- Set initial set of changed faces (= all faces of patches in
82  // patchIDs). Set changedFaces to labels of changed faces,
83  // changedInfo to face centres.
84  void setChangedFaces
85  (
86  const labelHashSet& patchIDs,
87  labelList& changedFaces,
88  List<wallPoint>& changedInfo
89  ) const;
90 
91  //- Copy MeshWave cell values. Return number of illegal/unset
92  // cells.
93  label getValues(const MeshWave<wallPoint>&);
94 
95 
96 public:
97 
98  // Constructors
99 
100  //- Construct from mesh and patches to initialise to 0 and flag
101  // whether or not to correct wall.
102  // Calculate for all cells. correctWalls : correct wall (face&point)
103  // cells for correct distance, searching neighbours.
104  patchWave
105  (
106  const polyMesh& mesh,
107  const labelHashSet& patchIDs,
108  bool correctWalls = true
109  );
110 
111  //- Destructor
112  virtual ~patchWave();
113 
114 
115  // Member Functions
116 
117  //- Correct for mesh geom/topo changes
118  virtual void correct();
119 
121  label nUnset() const
122  {
123  return nUnset_;
124  }
126  const scalarField& distance() const
127  {
128  return distance_;
129  }
130 
131  //- Non const access so we can 'transfer' contents for efficiency
133  {
134  return distance_;
135  }
138  {
139  return patchDistance_;
140  }
143  {
144  return patchDistance_;
145  }
146 };
147 
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 } // End namespace Foam
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 #endif
156 
157 // ************************************************************************* //
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
virtual ~patchWave()
Destructor.
Definition: patchWave.C:154
Generic field type.
Definition: FieldField.H:51
Collection of functions used in wall distance calculation.
Definition: cellDistFuncs.H:61
FaceCellWave plus data.
Definition: MeshWave.H:56
const FieldField< Field, scalar > & patchDistance() const
Definition: patchWave.H:136
Takes a set of patches to start MeshWave from. After construction holds distance at cells and distanc...
Definition: patchWave.H:56
virtual void correct()
Correct for mesh geom/topo changes.
Definition: patchWave.C:160
label nUnset() const
Definition: patchWave.H:120
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
const scalarField & distance() const
Definition: patchWave.H:125
const polyMesh & mesh() const
Access mesh.
Definition: cellDistFuncs.H:92
Namespace for OpenFOAM.
patchWave(const polyMesh &mesh, const labelHashSet &patchIDs, bool correctWalls=true)
Construct from mesh and patches to initialise to 0 and flag.
Definition: patchWave.C:135