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