structuredRenumber.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) 2012-2016 OpenFOAM Foundation
9  Copyright (C) 2020-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::structuredRenumber
29 
30 Description
31  Renumbering according to mesh layers.
32  depthFirst = true:
33  first column gets ids 0..nLayer-1,
34  second nLayers..2*nLayers-1 etc.
35  depthFirst = false:
36  first layer gets ids 0,1,2 etc.
37 
38 SourceFiles
39  structuredRenumber.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef Foam_structuredRenumber_H
44 #define Foam_structuredRenumber_H
45 
46 #include "renumberMethod.H"
47 
48 namespace Foam
49 {
50 
51 // Forward Declarations
52 template<class Type> class topoDistanceData;
53 
54 /*---------------------------------------------------------------------------*\
55  Class structuredRenumber Declaration
56 \*---------------------------------------------------------------------------*/
57 
59 :
60  public renumberMethod
61 {
62 public:
63 
64  // Public Classes
65 
66  //- Function class for sorting according to column and layer
67  class layerLess
68  {
69  const bool depthFirst_;
70  const labelList& order_;
71  const List<topoDistanceData<label>>& distance_;
72 
73  public:
74 
75  layerLess
76  (
77  const bool depthFirst,
78  const labelList& order,
80  )
81  :
82  depthFirst_(depthFirst),
83  order_(order),
84  distance_(distance)
85  {}
86 
87  bool operator()(const label a, const label b) const;
88  };
89 
90 
91 private:
92 
93  // Private Data
94 
95  const dictionary& coeffsDict_;
96 
97  const wordRes patches_;
98 
99  const label nLayers_;
100 
101  const bool depthFirst_;
102 
103  const bool reverse_;
104 
105  const autoPtr<renumberMethod> method_;
106 
107 
108  // Private Member Functions
109 
110  //- No copy construct
111  structuredRenumber(const structuredRenumber&) = delete;
112 
113  //- No copy assignment
114  void operator=(const structuredRenumber&) = delete;
115 
116 
117 public:
118 
119  //- Runtime type information
120  TypeName("structured");
121 
122 
123  // Constructors
124 
125  //- Construct given the renumber dictionary
126  explicit structuredRenumber(const dictionary& dict);
127 
128 
129  //- Destructor
130  virtual ~structuredRenumber() = default;
131 
132 
133  // Member Functions
134 
135  //- Renumbering method requires a polyMesh!
136  virtual bool needs_mesh() const { return true; }
137 
138 
139  // With mesh topology
140 
141  //- Return the cell visit order (from ordered back to original cell id)
142  // using the mesh.
143  virtual labelList renumber
144  (
145  const polyMesh& mesh
146  ) const;
147 
148 
149  // With explicit topology - Not implemented!
150 
151  //- Return the cell visit order (from ordered back to original cell id).
152  //- Not implemented!
153  virtual labelList renumber
154  (
155  const CompactListList<label>& cellCells
156  ) const
157  {
159  return labelList();
160  }
161 
162  //- Return the cell visit order (from ordered back to original cell id).
163  //- Not implemented!
164  virtual labelList renumber
165  (
166  const labelListList& cellCells
167  ) const
168  {
170  return labelList();
171  }
172 };
173 
174 
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 
177 } // End namespace Foam
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 #endif
182 
183 // ************************************************************************* //
Renumbering according to mesh layers. depthFirst = true: first column gets ids 0..nLayer-1, second nLayers..2*nLayers-1 etc. depthFirst = false: first layer gets ids 0,1,2 etc.
dictionary dict
bool operator()(const label a, const label b) const
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
Function class for sorting according to column and layer.
scalar distance(const vector &p1, const vector &p2)
Definition: curveTools.C:12
virtual labelList renumber(const polyMesh &mesh) const
Return the cell visit order (from ordered back to original cell id)
Abstract base class for renumbering.
TypeName("structured")
Runtime type information.
dynamicFvMesh & mesh
layerLess(const bool depthFirst, const labelList &order, const List< topoDistanceData< label >> &distance)
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:53
A packed storage of objects of type <T> using an offset table for access.
virtual ~structuredRenumber()=default
Destructor.
virtual bool needs_mesh() const
Renumbering method requires a polyMesh!
For use with FaceCellWave. Determines topological distance to starting faces. Templated on passive tr...
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
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:696
Namespace for OpenFOAM.