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 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
27InNamespace
28 Foam
29
30Description
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
37SourceFiles
38 bandCompression.C
39
40\*---------------------------------------------------------------------------*/
41
42#ifndef Foam_bandCompression_H
43#define Foam_bandCompression_H
44
45#include "labelList.H"
46
47// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48
49namespace Foam
50{
51
52// Forward Declarations
53template<class T> class CompactListList;
54
55} // End namespace Foam
56
57
58// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59
60namespace Foam
61{
62namespace meshTools
63{
64
65// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
66
67//- Renumber (mesh) addressing to reduce the band of the matrix,
68//- using the Cuthill-McKee algorithm.
69//
70// \returns order in which the cells are to be visited (ordered to original)
71labelList bandCompression(const CompactListList<label>& addressing);
72
73//- Renumber (mesh) addressing to reduce the band of the matrix,
74//- using the Cuthill-McKee algorithm.
75//
76// \returns order in which the cells are to be visited (ordered to original)
77labelList bandCompression(const labelListList& addressing);
78
79//- Renumber with addressing in losort form (neighbour + start in neighbour),
80//- using the Cuthill-McKee algorithm.
81//
82// \returns order in which the cells are to be visited (ordered to original)
84(
85 const labelUList& cellCells,
86 const labelUList& offsets
87);
88
89
90} // End namespace meshTools
91} // End namespace Foam
92
93
94// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
95
96namespace Foam
97{
98
99//- Forward to meshTools::bandCompression
100inline labelList bandCompression(const labelListList& cellCellAddressing)
101{
102 return meshTools::bandCompression(cellCellAddressing);
103}
104
105//- Forward to meshTools::bandCompression
107(
108 const labelUList& cellCells,
109 const labelUList& offsets
110)
111{
112 return meshTools::bandCompression(cellCells, offsets);
113}
114
115} // End namespace Foam
116
117
118// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119
120#endif
121
122// ************************************************************************* //
labelList bandCompression(const CompactListList< label > &addressing)
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition: List.H:66
List< labelList > labelListList
A List of labelList.
Definition: labelList.H:56
labelList bandCompression(const labelListList &cellCellAddressing)
Forward to meshTools::bandCompression.
UList< label > labelUList
A UList of labels.
Definition: UList.H:85