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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::MeshWave
29
30Description
31 FaceCellWave plus data
32
33SourceFiles
34 MeshWave.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef MeshWave_H
39#define MeshWave_H
40
41#include "FaceCellWave.H"
42
43// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44
45namespace Foam
46{
47
48/*---------------------------------------------------------------------------*\
49 Class MeshWaveName Declaration
50\*---------------------------------------------------------------------------*/
53
54
55/*---------------------------------------------------------------------------*\
56 Class MeshWave Declaration
57\*---------------------------------------------------------------------------*/
58
59template<class Type, class TrackingData = int>
60class MeshWave
61:
62 public MeshWaveName
63{
64 // Private Static Data
65
66 //- Default trackdata value to satisfy default template argument.
67 static int dummyTrackData_;
68
69
70 // Private Data
71
72 //- Wall information for all faces
73 List<Type> allFaceInfo_;
74
75 //- Wall information for all cells
76 List<Type> allCellInfo_;
77
78 //- Wave calculation engine.
80
81
82 // Private Member Functions
83
84 //- No copy construct
85 MeshWave(const MeshWave&) = delete;
86
87 //- No copy assignment
88 void operator=(const MeshWave&) = delete;
89
90
91public:
92
93 // Constructors
94
95 //- Construct from mesh and list of changed faces with the Type
96 //- for these faces.
97 // Iterates until nothing changes or maxIter reached.
98 // (maxIter can be 0)
100 (
101 const polyMesh& mesh,
102 const labelList& initialChangedFaces,
103 const List<Type>& changedFacesInfo,
104 const label maxIter,
105 TrackingData& td = dummyTrackData_
106 );
107
108 //- Construct from mesh, list of changed faces with the Type
109 //- for these faces and initial field.
110 // Iterates until nothing changes or maxIter reached.
111 // (maxIter can be 0)
113 (
114 const polyMesh& mesh,
115 const labelList& initialChangedFaces,
116 const List<Type>& changedFacesInfo,
117 const List<Type>& allCellInfo,
118 const label maxIter,
119 TrackingData& td = dummyTrackData_
120 );
121
122
123 // Member Functions
124
125 //- Get allFaceInfo
126 const List<Type>& allFaceInfo() const
127 {
128 return allFaceInfo_;
129 }
130
131 //- Get allCellInfo
132 const List<Type>& allCellInfo() const
133 {
134 return allCellInfo_;
135 }
136
137 //- Additional data to be passed into container
138 const TrackingData& data() const
139 {
140 return calc_.data();
141 }
142
143 //- Iterate until no changes or maxIter reached.
144 // \return actual number of iterations.
145 label iterate(const label maxIter)
146 {
147 return calc_.iterate(maxIter);
148 }
149
150 //- Number of unvisited cells, i.e. cells that were not (yet)
151 //- reached from walking across mesh.
152 //
153 // This can happen from
154 // - not enough iterations done
155 // - a disconnected mesh
156 // - a mesh without walls in it
157 label nUnvisitedCells() const
158 {
159 return calc_.nUnvisitedCells();
160 }
161
162 //- Number of unvisited faces
163 label nUnvisitedFaces() const
164 {
165 return calc_.nUnvisitedFaces();
166 }
167};
168
169
170// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171
172} // End namespace Foam
173
174
175// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176
177#ifdef NoRepository
178 #include "MeshWave.C"
179#endif
180
181// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182
183#endif
184
185// ************************************************************************* //
Wave propagation of information through grid. Every iteration information goes through one layer of c...
Definition: FaceCellWave.H:81
label nUnvisitedCells() const
virtual label iterate(const label maxIter)
Iterate until no changes or maxIter reached.
label nUnvisitedFaces() const
Get number of unvisited faces.
const TrackingData & data() const
Additional data to be passed into container.
Definition: FaceCellWave.H:348
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:77
FaceCellWave plus data.
Definition: MeshWave.H:62
label iterate(const label maxIter)
Iterate until no changes or maxIter reached.
Definition: MeshWave.H:144
const List< Type > & allFaceInfo() const
Get allFaceInfo.
Definition: MeshWave.H:125
label nUnvisitedFaces() const
Number of unvisited faces.
Definition: MeshWave.H:162
label nUnvisitedCells() const
Definition: MeshWave.H:156
const List< Type > & allCellInfo() const
Get allCellInfo.
Definition: MeshWave.H:131
const TrackingData & data() const
Additional data to be passed into container.
Definition: MeshWave.H:137
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
#define TemplateName(TemplateNameString)
Add typeName information from argument TypeNameString to a.
Definition: className.H:79
dynamicFvMesh & mesh
Namespace for OpenFOAM.