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 | Copyright (C) 2011-2013 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)
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
74 
75  //- Distance at patch faces
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.
94 
95 
96 public:
97 
98  // Constructors
99 
100  //- Construct from mesh and patches to initialize 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 
120 
121  label nUnset() const
122  {
123  return nUnset_;
124  }
125 
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  }
136 
138  {
139  return patchDistance_;
140  }
141 
143  {
144  return patchDistance_;
145  }
146 };
147 
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 } // End namespace Foam
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 #endif
156 
157 // ************************************************************************* //
Foam::patchWave::patchDistance
FieldField< Field, scalar > & patchDistance()
Definition: patchWave.H:141
Foam::FieldField
Generic field type.
Definition: FieldField.H:51
FieldField.H
Foam::patchWave::correctWalls_
bool correctWalls_
Do accurate distance calculation for near-wall cells.
Definition: patchWave.H:66
Foam::patchWave::patchIDs_
labelHashSet patchIDs_
Current patch subset (stored as patchIDs)
Definition: patchWave.H:63
cellDistFuncs.H
Foam::HashSet< label, Hash< label > >
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::patchWave::patchDistance_
FieldField< Field, scalar > patchDistance_
Distance at patch faces.
Definition: patchWave.H:75
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:59
Foam::patchWave
Takes a set of patches to start MeshWave from. After construction holds distance at cells and distanc...
Definition: patchWave.H:56
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::patchWave::setChangedFaces
void setChangedFaces(const labelHashSet &patchIDs, labelList &changedFaces, List< wallPoint > &changedInfo) const
Set initial set of changed faces (= all faces of patches in.
Definition: patchWave.C:34
MeshWave.H
Foam::MeshWave
FaceCellWave plus data.
Definition: MeshWave.H:56
Foam::patchWave::correct
virtual void correct()
Correct for mesh geom/topo changes.
Definition: patchWave.C:160
Foam::patchWave::getValues
label getValues(const MeshWave< wallPoint > &)
Copy MeshWave cell values. Return number of illegal/unset.
Definition: patchWave.C:70
Foam::patchWave::distance_
scalarField distance_
Distance at cell centres.
Definition: patchWave.H:72
Foam::patchWave::nUnset_
label nUnset_
Number of cells/faces unset after MeshWave has finished.
Definition: patchWave.H:69
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::cellDistFuncs::mesh
const polyMesh & mesh() const
Access mesh.
Definition: cellDistFuncs.H:95
Foam::patchWave::patchDistance
const FieldField< Field, scalar > & patchDistance() const
Definition: patchWave.H:136
Foam::patchWave::distance
scalarField & distance()
Non const access so we can 'transfer' contents for efficiency.
Definition: patchWave.H:131
Foam::cellDistFuncs
Collection of functions used in wall distance calculation.
Definition: cellDistFuncs.H:61
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::patchWave::distance
const scalarField & distance() const
Definition: patchWave.H:125
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:135
Foam::patchWave::nUnset
label nUnset() const
Definition: patchWave.H:120
Foam::patchWave::~patchWave
virtual ~patchWave()
Destructor.
Definition: patchWave.C:154