CuthillMcKeeRenumber.C
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-2017 OpenFOAM Foundation
9 Copyright (C) 2020-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
27\*---------------------------------------------------------------------------*/
28
31#include "bandCompression.H"
32#include "decompositionMethod.H"
33
34// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35
36namespace Foam
37{
39
41 (
45 );
46}
47
48
49// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
50
52:
54 reverse_
55 (
56 dict.optionalSubDict(typeName + "Coeffs")
57 .getOrDefault("reverse", false)
58 )
59{}
60
61
62// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
63
65(
66 const polyMesh& mesh,
67 const pointField& points
68) const
69{
70 CompactListList<label> cellCells;
71 decompositionMethod::calcCellCells
72 (
73 mesh,
75 mesh.nCells(),
76 false, // local only
77 cellCells
78 );
79
80 labelList orderedToOld = meshTools::bandCompression(cellCells);
81
82 if (reverse_)
83 {
84 reverse(orderedToOld);
85 }
86
87 return orderedToOld;
88}
89
90
92(
93 const labelList& cellCells,
94 const labelList& offsets,
95 const pointField& cc
96) const
97{
98 labelList orderedToOld = meshTools::bandCompression(cellCells, offsets);
99
100 if (reverse_)
101 {
102 reverse(orderedToOld);
103 }
104
105 return orderedToOld;
106}
107
108
110(
111 const CompactListList<label>& cellCells,
112 const pointField& cc
113) const
114{
115 labelList orderedToOld = meshTools::bandCompression(cellCells);
116
117 if (reverse_)
118 {
119 reverse(orderedToOld);
120 }
121
122 return orderedToOld;
123}
124
125
127(
128 const labelListList& cellCells,
129 const pointField& points
130) const
131{
132 labelList orderedToOld = meshTools::bandCompression(cellCells);
133
134 if (reverse_)
135 {
136 reverse(orderedToOld);
137 }
138
139 return orderedToOld;
140}
141
142
143// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
The bandCompression function renumbers the addressing such that the band of the matrix is reduced....
A packed storage unstructured matrix of objects of type <T> using an offset table for access.
Cuthill-McKee renumbering.
virtual labelList renumber(const pointField &) const
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
label nCells() const noexcept
Number of mesh cells.
Abstract base class for renumbering.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
dynamicFvMesh & mesh
const pointField & points
labelList bandCompression(const CompactListList< label > &addressing)
Namespace for OpenFOAM.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
Definition: labelList.C:38
void reverse(UList< T > &list, const label n)
Reverse the first n elements of the list.
Definition: UListI.H:449
dictionary dict