MeshWave.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-2019 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 
73  // Private static data
74 
75  //- Used as default trackdata value to satisfy default template
76  // argument.
77  static int dummyTrackData_;
78 
79 
80 public:
81 
82  // Constructors
83 
84  //- Construct from mesh and list of changed faces with the Type
85  // for these faces. Iterates until nothing changes or maxIter reached.
86  // (maxIter can be 0)
87  MeshWave
88  (
89  const polyMesh& mesh,
90  const labelList& initialChangedFaces,
91  const List<Type>& changedFacesInfo,
92  const label maxIter,
93  TrackingData& td = dummyTrackData_
94  );
95 
96  //- Construct from mesh, list of changed faces with the Type
97  // for these faces and initial field.
98  // Iterates until nothing changes or maxIter reached.
99  // (maxIter can be 0)
100  MeshWave
101  (
102  const polyMesh& mesh,
103  const labelList& initialChangedFaces,
104  const List<Type>& changedFacesInfo,
105  const List<Type>& allCellInfo,
106  const label maxIter,
107  TrackingData& td = dummyTrackData_
108  );
109 
110  //- Disallow default bitwise copy construction
111  MeshWave(const MeshWave&) = delete;
112 
113 
114  // Member Functions
115 
116  //- Get allFaceInfo
117  const List<Type>& allFaceInfo() const
118  {
119  return allFaceInfo_;
120  }
121 
122  //- Get allCellInfo
123  const List<Type>& allCellInfo() const
124  {
125  return allCellInfo_;
126  }
127 
128  //- Additional data to be passed into container
129  const TrackingData& data() const
130  {
131  return calc_.data();
132  }
133 
134  //- Iterate until no changes or maxIter reached. Returns actual
135  // number of iterations.
136  label iterate(const label maxIter)
137  {
138  return calc_.iterate(maxIter);
139  }
140 
141  //- Get number of unvisited cells, i.e. cells that were not (yet)
142  // reached from walking across mesh. This can happen from
143  // - not enough iterations done
144  // - a disconnected mesh
145  // - a mesh without walls in it
146  label getUnsetCells() const
147  {
148  return calc_.getUnsetCells();
149  }
150 
151  //- Get number of unvisited faces
152  label getUnsetFaces() const
153  {
154  return calc_.getUnsetFaces();
155  }
156 
157 
158  // Member Operators
159 
160  //- Disallow default bitwise assignment
161  void operator=(const MeshWave&) = delete;
162 };
163 
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 } // End namespace Foam
168 
169 
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 
172 #ifdef NoRepository
173  #include "MeshWave.C"
174 #endif
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #endif
179 
180 // ************************************************************************* //
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:145
label getUnsetFaces() const
Get number of unvisited faces.
Definition: MeshWave.H:151
Wave propagation of information through grid. Every iteration information goes through one layer of c...
Definition: FaceCellWave.H:76
const TrackingData & data() const
Additional data to be passed into container.
Definition: MeshWave.H:128
void operator=(const MeshWave &)=delete
Disallow default bitwise assignment.
const List< Type > & allFaceInfo() const
Get allFaceInfo.
Definition: MeshWave.H:116
label getUnsetFaces() const
Get number of unvisited faces.
MeshWave(const polyMesh &mesh, const labelList &initialChangedFaces, const List< Type > &changedFacesInfo, const label maxIter, TrackingData &td=dummyTrackData_)
Construct from mesh and list of changed faces with the Type.
Definition: MeshWave.C:42
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:135
const List< Type > & allCellInfo() const
Get allCellInfo.
Definition: MeshWave.H:122
const TrackingData & data() const
Additional data to be passed into container.
Definition: FaceCellWave.H:340
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)