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 -------------------------------------------------------------------------------
11 License
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 "dlLibraryTable.H"
31 #include "globalMeshData.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace 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  }
78 
79  return autoPtr<renumberMethod>(ctorPtr(dict));
80 }
81 
82 
83 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
84 
86 {
88  return labelList();
89 }
90 
91 
93 {
95  return labelList();
96 }
97 
98 
100 (
101  const polyMesh& mesh
102 ) const
103 {
104  // Local mesh connectivity
105  CompactListList<label> cellCells;
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 // ************************************************************************* //
dictionary dict
void size(const label n)
Older name for setAddressableSize.
Definition: UList.H:116
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:125
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Renumber the values within a list.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
static dlLibraryTable & libs()
Table of global libraries.
defineTypeName(manifoldCellsMeshObject)
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...
Abstract base class for renumbering.
dynamicFvMesh & mesh
A packed storage of objects of type <T> using an offset table for access.
static wordList supportedMethods()
Return a list of the known methods.
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
List< word > wordList
List of word.
Definition: fileName.H:59
static autoPtr< renumberMethod > New(const dictionary &dict)
Construct/select a renumbering method.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:75
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.
List< label > labelList
A List of labels.
Definition: List.H:62
bool open(bool verbose=true)
Open named, but unopened libraries. These names will normally have been added with push_back()...
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:696
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:645
Namespace for OpenFOAM.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL IO ERROR&#39; header text and ...