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 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 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class renumberMethod Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 class renumberMethod
53 {
54 protected:
55 
56  // Protected Data
57 
59 
60 
61  // Protected Member Functions
62 
63  //- No copy construct
64  renumberMethod(const renumberMethod&) = delete;
65 
66  //- No copy assignment
67  void operator=(const renumberMethod&) = delete;
68 
69 
70 public:
71 
72  //- Runtime type information
73  TypeName("renumberMethod");
74 
75 
76  // Declare run-time constructor selection tables
77 
79  (
80  autoPtr,
82  dictionary,
83  (
84  const dictionary& renumberDict
85  ),
86  (renumberDict)
87  );
88 
89 
90  // Selectors
91 
92  //- Return a reference to the selected renumbering method
94  (
95  const dictionary& renumberDict
96  );
97 
98 
99  // Constructors
100 
101  //- Construct given the renumber dictionary
102  explicit renumberMethod(const dictionary& dict)
103  :
105  {}
106 
108  //- Destructor
109  virtual ~renumberMethod() = default;
110 
111 
112  // Member Functions
113 
114  //- Return the order in which cells need to be visited
115  //- (ie. from ordered back to original cell label).
116  // This is only defined for geometric renumberMethods.
117  virtual labelList renumber(const pointField&) const
118  {
120  return labelList();
121  }
122 
123  //- Return the order in which cells need to be visited
124  //- (ie. from ordered back to original cell label).
125  // Use the mesh connectivity (if needed)
126  virtual labelList renumber(const polyMesh&, const pointField&) const;
128  //- Return the order in which cells need to be visited
129  //- (ie. from ordered back to original cell label).
130  // Addressing in losort addressing (= neighbour + offsets into
131  // neighbour)
132  virtual labelList renumber
133  (
134  const labelList& cellCells,
135  const labelList& offsets,
136  const pointField&
137  ) const;
138 
139  //- Return the order in which cells need to be visited
140  //- (ie. from ordered back to original cell label).
141  // Gets passed agglomeration map (from fine to coarse cells) and coarse
142  // cell
143  // location. Can be overridden by renumberMethods that provide this
144  // functionality natively. Coarse cells are local to the processor
145  // (if in parallel). If you want to have coarse cells spanning
146  // processors use the globalCellCells instead.
147  virtual labelList renumber
148  (
149  const polyMesh& mesh,
150  const labelList& fineToCoarse,
151  const pointField& coarsePoints
152  ) const;
153 
154  //- Return the order in which cells need to be visited
155  //- (ie. from ordered back to original cell label).
156  // Uses 'unpack' internally, so should be overloaded when possible
157  virtual labelList renumber
158  (
159  const CompactListList<label>& cellCells,
160  const pointField& cellCentres
161  ) const;
162 
163  //- Return the order in which cells need to be visited
164  //- (ie. from ordered back to original cell label).
165  // The connectivity is equal to mesh.cellCells() except
166  // - the connections are across coupled patches
167  virtual labelList renumber
168  (
169  const labelListList& cellCells,
170  const pointField& cellCentres
171  ) const = 0;
172 };
173 
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 } // End namespace Foam
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 #endif
182 
183 // ************************************************************************* //
virtual labelList renumber(const pointField &) const
Return the order in which cells need to be visited (ie. from ordered back to original cell label)...
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
const dictionary & renumberDict_
static autoPtr< renumberMethod > New(const dictionary &renumberDict)
Return a reference to the selected renumbering method.
declareRunTimeSelectionTable(autoPtr, renumberMethod, dictionary,(const dictionary &renumberDict),(renumberDict))
virtual ~renumberMethod()=default
Destructor.
Abstract base class for renumbering.
dynamicFvMesh & mesh
TypeName("renumberMethod")
Runtime type information.
A packed storage of objects of type <T> using an offset table for access.
void operator=(const renumberMethod &)=delete
No copy assignment.
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:74
List< label > labelList
A List of labels.
Definition: List.H:62
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:686
renumberMethod(const renumberMethod &)=delete
No copy construct.
Namespace for OpenFOAM.