Loading...
Searching...
No Matches
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-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
29#include "renumberMethod.H"
32
33// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34
35namespace Foam
36{
39}
40
41
42// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
43
45{
46 if (dictionaryConstructorTablePtr_)
47 {
48 return dictionaryConstructorTablePtr_->sortedToc();
49 }
50 return wordList();
51}
52
53
55(
56 const dictionary& dict
57)
58{
59 const word methodType(dict.get<word>("method"));
60
61 //Info<< "Selecting renumberMethod " << methodType << endl;
62
63 // Load any additional libs (verbose = false)
64 dlLibraryTable::libs().open("libs", dict, false);
65
66 auto* ctorPtr = dictionaryConstructorTable(methodType);
67
68 if (!ctorPtr)
69 {
71 (
72 dict,
73 "renumberMethod",
74 methodType,
75 *dictionaryConstructorTablePtr_
76 ) << exit(FatalIOError);
77 }
79 return autoPtr<renumberMethod>(ctorPtr(dict));
80}
81
82
83// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
84
86{
88 return labelList();
89}
90
91
103{
104 // Local mesh connectivity
107
108 return renumber(cellCells);
109}
110
111
113(
114 const polyMesh& mesh,
115 const labelUList& fineToCoarse,
116 const pointField& coarsePoints
117) const
118{
119 CompactListList<label> coarseCellCells;
121 (
122 mesh,
123 fineToCoarse,
124 coarsePoints.size(), // nLocalCoarse
125 false, // local only (parallel = false)
126 coarseCellCells
127 );
128
129 // Renumber based on agglomerated points
130 labelList coarseDistribution = renumber(coarseCellCells);
131
132 // From coarse back to fine for original mesh
133 return labelList(coarseDistribution, fineToCoarse);
134}
135
136
137// ************************************************************************* //
A packed storage of objects of type <T> using an offset table for access.
void size(const label n)
Older name for setAddressableSize.
Definition UList.H:118
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
bool open(bool verbose=true)
Open named, but unopened libraries. These names will normally have been added with push_back().
static dlLibraryTable & libs()
Table of global libraries.
static void calcCellCells(const polyMesh &mesh, const labelUList &agglom, const label nLocalCoarse, const bool parallel, CompactListList< label > &cellCells)
Determine (local or global) cellCells from mesh agglomeration.
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
Abstract base class for renumbering.
virtual labelList renumber(const label nCells) const
Return the cell visit order (from ordered back to original cell id) based solely on the number of cel...
static autoPtr< renumberMethod > New(const dictionary &dict)
Construct/select a renumbering method.
renumberMethod()
Default construct.
static wordList supportedMethods()
Return a list of the known methods.
A class for handling words, derived from Foam::string.
Definition word.H:66
#define defineTypeName(Type)
Define the typeName.
Definition className.H:113
dynamicFvMesh & mesh
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition error.H:637
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition error.H:688
Namespace for OpenFOAM.
List< word > wordList
List of word.
Definition fileName.H:60
List< label > labelList
A List of labels.
Definition List.H:62
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Renumber the values within a list.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
vectorField pointField
pointField is a vectorField.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition errorManip.H:125
UList< label > labelUList
A UList of labels.
Definition UList.H:75
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
dictionary dict