FreeFOAM The Cross-Platform CFD Toolkit
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) 1991-2010 OpenCFD Ltd.
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 <OpenFOAM/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>
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.
70  FaceCellWave<Type> calc_;
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 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  );
94 
95  //- Construct from mesh, list of changed faces with the Type
96  // for these faces and initial field.
97  // Iterates until nothing changes or maxIter reached.
98  // (maxIter can be 0)
99  MeshWave
100  (
101  const polyMesh& mesh,
102  const labelList& initialChangedFaces,
103  const List<Type>& changedFacesInfo,
104  const List<Type>& allCellInfo,
105  const label maxIter
106  );
107 
108 
109  // Member Functions
110 
111  //- Get allFaceInfo
112  const List<Type>& allFaceInfo() const
113  {
114  return allFaceInfo_;
115  }
116 
117  //- Get allCellInfo
118  const List<Type>& allCellInfo() const
119  {
120  return allCellInfo_;
121  }
122 
123 
124  //- Iterate until no changes or maxIter reached. Returns number of
125  // unset cells (see getUnsetCells)
126  label iterate(const label maxIter)
127  {
128  return calc_.iterate(maxIter);
129  }
130 
131  //- Get number of unvisited cells, i.e. cells that were not (yet)
132  // reached from walking across mesh. This can happen from
133  // - not enough iterations done
134  // - a disconnected mesh
135  // - a mesh without walls in it
136  label getUnsetCells() const
137  {
138  return calc_.getUnsetCells();
139  }
140 
141  //- Get number of unvisited faces
142  label getUnsetFaces() const
143  {
144  return calc_.getUnsetFaces();
145  }
146 };
147 
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 } // End namespace Foam
152 
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 #ifdef NoRepository
157 # include <OpenFOAM/MeshWave.C>
158 #endif
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 #endif
163 
164 // ************************ vim: set sw=4 sts=4 et: ************************ //