bandCompression.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-2013 OpenFOAM Foundation
9  Copyright (C) 2022-2024 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 InNamespace
28  Foam
29 
30 Description
31  The bandCompression function renumbers the addressing such that the
32  band of the matrix is reduced. The algorithm uses a simple search
33  through the neighbour list in order of connectivity.
34 
35  See http://en.wikipedia.org/wiki/Cuthill-McKee_algorithm
36 
37 SourceFiles
38  bandCompression.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef Foam_bandCompression_H
43 #define Foam_bandCompression_H
44 
45 #include "labelList.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 // Forward Declarations
53 class polyMesh;
54 template<class T> class CompactListList;
55 
56 } // End namespace Foam
57 
58 
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 
61 namespace Foam
62 {
63 namespace meshTools
64 {
65 
66 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
67 
68 //- Renumber (mesh) addressing to reduce the band of the mesh connectivity,
69 //- using the Cuthill-McKee algorithm.
70 //
71 // \returns order in which the cells are to be visited (ordered to original)
72 labelList bandCompression(const polyMesh& mesh);
73 
74 //- Renumber (mesh) addressing to reduce the band of the matrix,
75 //- using the Cuthill-McKee algorithm.
76 //
77 // \returns order in which the cells are to be visited (ordered to original)
78 labelList bandCompression(const CompactListList<label>& addressing);
79 
80 //- Renumber (mesh) addressing to reduce the band of the matrix,
81 //- using the Cuthill-McKee algorithm.
82 //
83 // \returns order in which the cells are to be visited (ordered to original)
84 labelList bandCompression(const labelListList& addressing);
85 
86 //- Renumber with addressing in losort form (neighbour + start in neighbour),
87 //- using the Cuthill-McKee algorithm.
88 //
89 // \returns order in which the cells are to be visited (ordered to original)
91 (
92  const labelUList& cellCells,
93  const labelUList& offsets
94 );
95 
96 
97 } // End namespace meshTools
98 } // End namespace Foam
99 
100 
101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102 
103 namespace Foam
104 {
105 
106 //- Deprecated - prefer meshTools::bandCompression()
107 // \deprecated(2022-03) prefer meshTools::bandCompression()
108 FOAM_DEPRECATED_FOR(2022-03, "meshTools::bandCompression()")
109 inline labelList bandCompression(const labelListList& cellCellAddressing)
110 {
111  return meshTools::bandCompression(cellCellAddressing);
112 }
113 
114 //- Deprecated - prefer meshTools::bandCompression()
115 // \deprecated(2022-03) prefer meshTools::bandCompression()
116 FOAM_DEPRECATED_FOR(2022-03, "meshTools::bandCompression()")
118 (
119  const labelUList& cellCells,
120  const labelUList& offsets
121 )
122 {
123  return meshTools::bandCompression(cellCells, offsets);
124 }
125 
126 } // End namespace Foam
127 
128 
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130 
131 #endif
133 // ************************************************************************* //
List< labelList > labelListList
List of labelList.
Definition: labelList.H:38
UList< label > labelUList
A UList of labels.
Definition: UList.H:78
class FOAM_DEPRECATED_FOR(2017-05, "Foam::Enum") NamedEnum
Definition: NamedEnum.H:65
dynamicFvMesh & mesh
List< label > labelList
A List of labels.
Definition: List.H:62
labelList bandCompression(const polyMesh &mesh)
Renumber (mesh) addressing to reduce the band of the mesh connectivity, using the Cuthill-McKee algor...
labelList bandCompression(const labelListList &cellCellAddressing)
Deprecated - prefer meshTools::bandCompression()
Namespace for OpenFOAM.