Loading...
Searching...
No Matches
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-2024 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
32
33// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34
35namespace Foam
36{
39
41 (
45 );
46
48 (
52 );
53
54 // Select under the name "RCM"
56 (
60 RCM
61 );
62}
63
64
65// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
66
77 reverse_
78 (
79 dict.optionalSubDict(typeName + "Coeffs")
80 .getOrDefault("reverse", false)
81 )
82{}
83
84
86(
87 const dictionary& dict,
88 const bool reverse
90:
92 reverse_(reverse)
93{}
94
103(
104 const dictionary& dict
105)
107 CuthillMcKeeRenumber(dict, true) // reverse = true
108{}
109
110
111// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
112
114(
115 const polyMesh& mesh
116) const
117{
119
120 if (reverse_)
121 {
122 Foam::reverse(orderedToOld);
123 }
124
125 return orderedToOld;
126}
127
128
130(
131 const CompactListList<label>& cellCells
132) const
133{
134 labelList orderedToOld = meshTools::bandCompression(cellCells);
135
136 if (reverse_)
137 {
138 Foam::reverse(orderedToOld);
139 }
140
141 return orderedToOld;
142}
143
144
146(
147 const labelListList& cellCells
148) const
149{
150 labelList orderedToOld = meshTools::bandCompression(cellCells);
151
152 if (reverse_)
153 {
154 Foam::reverse(orderedToOld);
155 }
156
157 return orderedToOld;
158}
159
160
161// Foam::labelList Foam::CuthillMcKeeRenumber::renumber
162// (
163// const labelUList& cellCells,
164// const labelUList& offsets
165// ) const
166// {
167// labelList orderedToOld = meshTools::bandCompression(cellCells, offsets);
168//
169// if (reverse_)
170// {
171// Foam::reverse(orderedToOld);
172// }
173//
174// return orderedToOld;
175// }
176
177
178// ************************************************************************* //
Macros for easy insertion into run-time selection tables.
#define addNamedToRunTimeSelectionTable(baseType, thisType, argNames, lookupName)
Add to construction table with 'lookupName' as the key.
#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 of objects of type <T> using an offset table for access.
Cuthill-McKee renumbering (CM or RCM).
void reverse(bool on) noexcept
Toggle reverse on/off.
virtual labelList renumber(const polyMesh &mesh) const
Return the cell visit order (from ordered back to original cell id) using the mesh to determine the c...
CuthillMcKeeRenumber(const bool reverse=false)
Default construct, optionally with reverse.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
Abstract base class for renumbering.
renumberMethod()
Default construct.
Reverse Cuthill-McKee renumbering.
reverseCuthillMcKeeRenumber()
Default construct.
#define defineTypeName(Type)
Define the typeName.
Definition className.H:113
dynamicFvMesh & mesh
labelList bandCompression(const polyMesh &mesh)
Renumber (mesh) addressing to reduce the band of the mesh connectivity, using the Cuthill-McKee algor...
Namespace for OpenFOAM.
List< labelList > labelListList
List of labelList.
Definition labelList.H:38
List< label > labelList
A List of labels.
Definition List.H:62
void reverse(UList< T > &list, const label n)
Reverse the first n elements of the list.
Definition UListI.H:539
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
dictionary dict