renumberMethod.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-2015 OpenFOAM Foundation
9 Copyright (C) 2019-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
29#include "renumberMethod.H"
30#include "decompositionMethod.H"
31
32// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33
34namespace Foam
35{
38}
39
40// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
41
43(
44 const dictionary& dict
45)
46{
47 const word methodType(dict.get<word>("method"));
48
49 //Info<< "Selecting renumberMethod " << methodType << endl;
50
51 auto* ctorPtr = dictionaryConstructorTable(methodType);
52
53 if (!ctorPtr)
54 {
56 (
57 dict,
58 "renumberMethod",
59 methodType,
60 *dictionaryConstructorTablePtr_
61 ) << exit(FatalIOError);
62 }
63
64 return autoPtr<renumberMethod>(ctorPtr(dict));
65}
66
67
68// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
69
71(
72 const polyMesh& mesh,
73 const pointField& points
74) const
75{
76 CompactListList<label> cellCells;
77 decompositionMethod::calcCellCells
78 (
79 mesh,
81 mesh.nCells(),
82 false, // local only
83 cellCells
84 );
85
86 return renumber(cellCells, points);
87}
88
89
91(
92 const CompactListList<label>& cellCells,
93 const pointField& points
94) const
95{
96 return renumber(cellCells.unpack(), points);
97}
98
99
101(
102 const labelList& cellCells,
103 const labelList& offsets,
104 const pointField& cc
105) const
106{
108 return labelList();
109}
110
111
113(
114 const polyMesh& mesh,
115 const labelList& fineToCoarse,
116 const pointField& coarsePoints
117) const
118{
119 CompactListList<label> coarseCellCells;
120 decompositionMethod::calcCellCells
121 (
122 mesh,
123 fineToCoarse,
124 coarsePoints.size(),
125 false, // local only
126 coarseCellCells
127 );
128
129 // Renumber based on agglomerated points
130 labelList coarseDistribution
131 (
132 renumber(coarseCellCells, coarsePoints)
133 );
134
135 // Rework back into renumbering for original mesh_
136 labelList fineDistribution(fineToCoarse.size());
137
138 forAll(fineDistribution, i)
139 {
140 fineDistribution[i] = coarseDistribution[fineToCoarse[i]];
141 }
142
143 return fineDistribution;
144}
145
146
147// ************************************************************************* //
A packed storage unstructured matrix of objects of type <T> using an offset table for access.
List< SubListType > unpack() const
Return non-compact list of lists.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
Definition: Time.C:717
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:114
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
label nCells() const noexcept
Number of mesh cells.
Abstract base class for renumbering.
virtual labelList renumber(const pointField &) const
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition: className.H:121
dynamicFvMesh & mesh
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:478
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
const pointField & points
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
List< label > labelList
A List of labels.
Definition: List.H:66
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Renumber the values (not the indices) of a list.
IOerror FatalIOError
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
dictionary dict
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333