renumberMethod.H
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) 2022-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 Class
28  Foam::renumberMethod
29 
30 Description
31  Abstract base class for renumbering
32 
33 SourceFiles
34  renumberMethod.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef Foam_renumberMethod_H
39 #define Foam_renumberMethod_H
40 
41 #include "polyMesh.H"
42 #include "pointField.H"
43 #include "CompactListList.H"
44 #include "wordList.H"
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class renumberMethod Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class renumberMethod
54 {
55 public:
56 
57  //- Runtime type information
58  TypeNameNoDebug("renumberMethod");
59 
60 
61  // Declare run-time constructor selection tables
62 
64  (
65  autoPtr,
67  dictionary,
68  (
69  const dictionary& renumberDict
70  ),
71  (renumberDict)
72  );
73 
74 
75  // Constructors
76 
77  //- Default construct
79  {}
80 
81  //- Construct with renumber dictionary (which is currently unused)
82  explicit renumberMethod(const dictionary&)
83  {}
84 
85 
86  // Selectors
87 
88  //- Construct/select a renumbering method
90 
91  //- Return a list of the known methods
92  static wordList supportedMethods();
93 
94 
95  //- Destructor
96  virtual ~renumberMethod() = default;
97 
98 
99  // Member Functions
100 
101  //- Renumbering method without mesh or cell-cell topology
102  //- (very special case)
103  virtual bool no_topology() const { return false; }
104 
105  //- Renumbering method requires a polyMesh for its topology
106  virtual bool needs_mesh() const { return false; }
107 
108 
109  // No topology
110 
111  //- Return the cell visit order (from ordered back to original cell id)
112  //- based solely on the number of cells.
113  // Only applicable for no_topology() methods.
114  virtual labelList renumber(const label nCells) const;
115 
116  //- Return the cell visit order (from ordered back to original cell id)
117  //- based solely on the cell centres (or number of cell centres).
118  // Only applicable for no_topology() methods.
119  virtual labelList renumber(const pointField&) const;
120 
121 
122  // With mesh topology
123 
124  //- Return the cell visit order (from ordered back to original cell id)
125  //- using the mesh to determine the connectivity.
126  virtual labelList renumber(const polyMesh& mesh) const;
127 
128 
129  // With explicit topology
130 
131  //- Return the cell visit order (from ordered back to original cell id),
132  virtual labelList renumber
133  (
135  const CompactListList<label>& cellCells
136  ) const = 0;
137 
138  //- Return the cell visit order (from ordered back to original cell id),
139  virtual labelList renumber
140  (
142  const labelListList& cellCells
143  ) const = 0;
144 
145 
146  // Housekeeping
147 
148  //- Deprecated - the pointField is unused
149  // \deprecated(2024-03) the pointField is unused
150  FOAM_DEPRECATED_FOR(2024-03, "renumber(const polyMesh&)")
151  virtual labelList renumber
152  (
153  const polyMesh& mesh,
154  const pointField&
155  ) const
156  {
157  return renumber(mesh);
158  }
159 
160  //- Deprecated - the pointField is unused
161  // \deprecated(2024-03) the pointField is unused
162  FOAM_DEPRECATED_FOR(2024-03, "renumber(const CompactListList<label>&)")
163  virtual labelList renumber
164  (
165  const CompactListList<label>& cellCells,
166  const pointField&
167  ) const
168  {
169  return renumber(cellCells);
170  }
171 
172  //- Deprecated - the pointField is unused
173  // \deprecated(2024-03) the pointField is unused
174  FOAM_DEPRECATED_FOR(2024-03, "renumber(const labelListList&)")
175  virtual labelList renumber
176  (
177  const labelListList& cellCells,
178  const pointField&
179  ) const
180  {
181  return renumber(cellCells);
182  }
183 
184  //- Deprecated - renumbering with agglomeration map.
185  //- Calculate globalCellCells directly
186  // \deprecated(2024-03) calculate globalCellCells directly
187  FOAM_DEPRECATED_FOR(2024-03, "calcCellCells and renumber separately")
188  virtual labelList renumber
189  (
190  const polyMesh& mesh,
191  const labelUList& fineToCoarse,
192  const pointField& coarsePoints
193  ) const;
194 };
195 
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 } // End namespace Foam
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 #endif
204 
205 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual bool no_topology() const
Renumbering method without mesh or cell-cell topology (very special case)
declareRunTimeSelectionTable(autoPtr, renumberMethod, dictionary,(const dictionary &renumberDict),(renumberDict))
List< labelList > labelListList
List of labelList.
Definition: labelList.H:38
class FOAM_DEPRECATED_FOR(2017-05, "Foam::Enum") NamedEnum
Definition: NamedEnum.H:65
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...
virtual ~renumberMethod()=default
Destructor.
Abstract base class for renumbering.
dynamicFvMesh & mesh
virtual bool needs_mesh() const
Renumbering method requires a polyMesh for its topology.
TypeNameNoDebug("renumberMethod")
Runtime type information.
A packed storage of objects of type <T> using an offset table for access.
static wordList supportedMethods()
Return a list of the known methods.
renumberMethod()
Default construct.
static autoPtr< renumberMethod > New(const dictionary &dict)
Construct/select a renumbering method.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:75
List< label > labelList
A List of labels.
Definition: List.H:62
Namespace for OpenFOAM.