MeshWave.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-2016 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::MeshWave
26 
27 Description
28  FaceCellWave plus data
29 
30 SourceFiles
31  MeshWave.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef MeshWave_H
36 #define MeshWave_H
37 
38 #include "FaceCellWave.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class MeshWaveName Declaration
47 \*---------------------------------------------------------------------------*/
48 
49 TemplateName(MeshWave);
50 
51 
52 /*---------------------------------------------------------------------------*\
53  Class MeshWave Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 template<class Type, class TrackingData = int>
57 class MeshWave
58 :
59  public MeshWaveName
60 {
61  // Private data
62 
63  //- Wall information for all faces
64  List<Type> allFaceInfo_;
65 
66  //- Wall information for all cells
67  List<Type> allCellInfo_;
68 
69  //- Wave calculation engine.
71 
72  // Private Member Functions
73 
74  //- Disallow default bitwise copy construct
75  MeshWave(const MeshWave&);
76 
77  //- Disallow default bitwise assignment
78  void operator=(const MeshWave&);
79 
80  // Private static data
81 
82  //- Used as default trackdata value to satisfy default template
83  // argument.
84  static int dummyTrackData_;
85 
86 public:
87 
88  // Constructors
89 
90  //- Construct from mesh and list of changed faces with the Type
91  // for these faces. Iterates until nothing changes or maxIter reached.
92  // (maxIter can be 0)
93  MeshWave
94  (
95  const polyMesh& mesh,
96  const labelList& initialChangedFaces,
97  const List<Type>& changedFacesInfo,
98  const label maxIter,
99  TrackingData& td = dummyTrackData_
100  );
101 
102  //- Construct from mesh, list of changed faces with the Type
103  // for these faces and initial field.
104  // Iterates until nothing changes or maxIter reached.
105  // (maxIter can be 0)
106  MeshWave
107  (
108  const polyMesh& mesh,
109  const labelList& initialChangedFaces,
110  const List<Type>& changedFacesInfo,
111  const List<Type>& allCellInfo,
112  const label maxIter,
113  TrackingData& td = dummyTrackData_
114  );
115 
116 
117  // Member Functions
118 
119  //- Get allFaceInfo
120  const List<Type>& allFaceInfo() const
121  {
122  return allFaceInfo_;
123  }
124 
125  //- Get allCellInfo
126  const List<Type>& allCellInfo() const
127  {
128  return allCellInfo_;
129  }
130 
131  //- Additional data to be passed into container
132  const TrackingData& data() const
133  {
134  return calc_.data();
135  }
136 
137  //- Iterate until no changes or maxIter reached. Returns actual
138  // number of iterations.
139  label iterate(const label maxIter)
140  {
141  return calc_.iterate(maxIter);
142  }
143 
144  //- Get number of unvisited cells, i.e. cells that were not (yet)
145  // reached from walking across mesh. This can happen from
146  // - not enough iterations done
147  // - a disconnected mesh
148  // - a mesh without walls in it
149  label getUnsetCells() const
150  {
151  return calc_.getUnsetCells();
152  }
153 
154  //- Get number of unvisited faces
155  label getUnsetFaces() const
156  {
157  return calc_.getUnsetFaces();
158  }
159 };
160 
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 } // End namespace Foam
165 
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 #ifdef NoRepository
170  #include "MeshWave.C"
171 #endif
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 #endif
176 
177 // ************************************************************************* //
TemplateName(blendedSchemeBase)
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 label iterate(const label maxIter)
Iterate until no changes or maxIter reached. Returns actual.
label getUnsetCells() const
Get number of unvisited cells, i.e. cells that were not (yet)
Definition: MeshWave.H:148
label getUnsetFaces() const
Get number of unvisited faces.
Definition: MeshWave.H:154
Wave propagation of information through grid. Every iteration information goes through one layer of c...
Definition: FaceCellWave.H:75
const TrackingData & data() const
Additional data to be passed into container.
Definition: MeshWave.H:131
const List< Type > & allFaceInfo() const
Get allFaceInfo.
Definition: MeshWave.H:119
label getUnsetFaces() const
Get number of unvisited faces.
dynamicFvMesh & mesh
FaceCellWave plus data.
Definition: MeshWave.H:56
label iterate(const label maxIter)
Iterate until no changes or maxIter reached. Returns actual.
Definition: MeshWave.H:138
const List< Type > & allCellInfo() const
Get allCellInfo.
Definition: MeshWave.H:125
const TrackingData & data() const
Additional data to be passed into container.
Definition: FaceCellWave.H:337
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Namespace for OpenFOAM.
label getUnsetCells() const
Get number of unvisited cells, i.e. cells that were not (yet)