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-2022 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::MeshWave
29 
30 Description
31  FaceCellWave plus data
32 
33 SourceFiles
34  MeshWave.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef Foam_MeshWave_H
39 #define Foam_MeshWave_H
40 
41 #include "FaceCellWave.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class MeshWaveName Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 TemplateName(MeshWave);
53 
54 
55 /*---------------------------------------------------------------------------*\
56  Class MeshWave Declaration
57 \*---------------------------------------------------------------------------*/
58 
59 template<class Type, class TrackingData = int>
60 class MeshWave
61 :
62  public MeshWaveName
63 {
64  // Private Data
65 
66  //- Wall information for all faces
67  List<Type> allFaceInfo_;
68 
69  //- Wall information for all cells
70  List<Type> allCellInfo_;
71 
72  //- Wave calculation engine.
74 
75 
76  // Private Member Functions
77 
78  //- No copy construct
79  MeshWave(const MeshWave&) = delete;
80 
81  //- No copy assignment
82  void operator=(const MeshWave&) = delete;
83 
84 
85 public:
86 
87  // Constructors
88 
89  //- Construct from mesh and list of changed faces with the Type
90  //- for these faces.
91  // 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 = FaceCellWaveBase::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 = FaceCellWaveBase::dummyTrackData_
114  );
115 
116 
117  // Member Functions
118 
119  //- Get allFaceInfo
120  const List<Type>& allFaceInfo() const noexcept
121  {
122  return allFaceInfo_;
123  }
124 
125  //- Get allCellInfo
126  const List<Type>& allCellInfo() const noexcept
127  {
128  return allCellInfo_;
129  }
130 
131  //- Additional data to be passed into container
132  const TrackingData& data() const noexcept
133  {
134  return calc_.data();
135  }
136 
137  //- Iterate until no changes or maxIter reached.
138  // \return actual number of iterations.
139  label iterate(const label maxIter)
140  {
141  return calc_.iterate(maxIter);
142  }
143 
144  //- Current number of changed cells
145  label nChangedCells() const noexcept { return calc_.nChangedCells(); }
146 
147  //- Current number of changed faces
148  label nChangedFaces() const noexcept { return calc_.nChangedFaces(); }
150  //- Number of unvisited cells
151  label nUnvisitedCells() const noexcept
152  {
153  return calc_.nUnvisitedCells();
154  }
155 
156  //- Number of unvisited faces
157  label nUnvisitedFaces() const noexcept
158  {
159  return calc_.nUnvisitedFaces();
160  }
161 };
162 
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 } // End namespace Foam
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 #ifdef NoRepository
172  #include "MeshWave.C"
173 #endif
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 #endif
178 
179 // ************************************************************************* //
TemplateName(blendedSchemeBase)
static int dummyTrackData_
Default trackData value (for default template argument)
Definition: FaceCellWave.H:125
const List< Type > & allCellInfo() const noexcept
Get allCellInfo.
Definition: MeshWave.H:141
label nUnvisitedFaces() const noexcept
Get number of unvisited faces.
Definition: FaceCellWave.H:197
virtual label iterate(const label maxIter)
Iterate until no changes or maxIter reached.
const List< Type > & allFaceInfo() const noexcept
Get allFaceInfo.
Definition: MeshWave.H:133
label nChangedCells() const noexcept
Current number of changed cells.
Definition: MeshWave.H:167
Wave propagation of information through grid. Every iteration information goes through one layer of c...
Definition: FaceCellWave.H:206
const TrackingData & data() const noexcept
Additional data to be passed into container.
Definition: FaceCellWave.H:506
dynamicFvMesh & mesh
const TrackingData & data() const noexcept
Additional data to be passed into container.
Definition: MeshWave.H:149
label nChangedFaces() const noexcept
Current number of changed faces.
Definition: MeshWave.H:172
FaceCellWave plus data.
Definition: MeshWave.H:55
label iterate(const label maxIter)
Iterate until no changes or maxIter reached.
Definition: MeshWave.H:159
label nUnvisitedFaces() const noexcept
Number of unvisited faces.
Definition: MeshWave.H:185
const direction noexcept
Definition: Scalar.H:258
label nUnvisitedCells() const noexcept
Number of unvisited cells.
Definition: MeshWave.H:177
label nUnvisitedCells() const noexcept
Get number of unvisited cells, i.e. cells that were not (yet) reached from walking across mesh...
Definition: FaceCellWave.H:192
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
label nChangedFaces() const noexcept
Current number of changed faces.
Definition: FaceCellWave.H:181
Namespace for OpenFOAM.
label nChangedCells() const noexcept
Current number of changed cells.
Definition: FaceCellWave.H:176