structuredRenumber.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2012-2024 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::structuredRenumber
26 
27 Description
28  Renumbering according to mesh layers.
29  depthFirst = true:
30  first column gets ids 0..nLayer-1,
31  second nLayers..2*nLayers-1 etc.
32  depthFirst = false:
33  first layer gets ids 0,1,2 etc.
34 
35 SourceFiles
36  structuredRenumber.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef structuredRenumber_H
41 #define structuredRenumber_H
42 
43 #include "renumberMethod.H"
44 #include "topoDistanceData.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class structuredRenumber Declaration
53 \*---------------------------------------------------------------------------*/
54 
56 :
57  public renumberMethod
58 {
59  // Private constructors
60 
61  //- Construct given the renumber dictionary
63  (
64  const dictionary& renumberDict,
65  const dictionary& methodDict
66  );
67 
68 
69 public:
70 
71  // Public classes
72 
73  //- Less function class that can be used for sorting according to
74  // column and layer
75  class layerLess
76  {
77  const Switch depthFirst_;
78  const labelList& order_;
79  const List<topoDistanceData>& distance_;
80 
81  public:
82 
83  layerLess
84  (
85  const Switch depthFirst,
86  const labelList& order,
87  const List<topoDistanceData>& distance
88  )
89  :
90  depthFirst_(depthFirst),
91  order_(order),
92  distance_(distance)
93  {}
94 
95  bool operator()(const label a, const label b);
96  };
97 
98 
99  // Private Data
100 
101  const wordReList patches_;
102 
103  const label nLayers_;
104 
105  const Switch depthFirst_;
106 
108 
109  const Switch reverse_;
110 
111 
112 public:
113 
114  //- Runtime type information
115  TypeName("structured");
116 
117 
118  // Constructors
119 
120  //- Construct given the renumber dictionary
121  structuredRenumber(const dictionary& renumberDict);
122 
123  //- Disallow default bitwise copy construction
124  structuredRenumber(const structuredRenumber&) = delete;
125 
126 
127  //- Destructor
128  virtual ~structuredRenumber()
129  {}
130 
131 
132  // Member Functions
133 
134  //- Return the order in which cells need to be visited, i.e.
135  // from ordered back to original cell label.
136  // This is only defined for geometric renumberMethods.
137  virtual labelList renumber(const pointField&) const
138  {
140  return labelList(0);
141  }
142 
143  //- Return the order in which cells need to be visited, i.e.
144  // from ordered back to original cell label.
145  // Use the mesh connectivity (if needed)
146  virtual labelList renumber
147  (
148  const polyMesh& mesh,
149  const pointField& cc
150  ) const;
151 
152  //- Return the order in which cells need to be visited, i.e.
153  // from ordered back to original cell label.
154  // The connectivity is equal to mesh.cellCells() except
155  // - the connections are across coupled patches
156  virtual labelList renumber
157  (
158  const labelListList& cellCells,
159  const pointField& cc
160  ) const
161  {
163  return labelList(0);
164  }
165 
166 
167  // Member Operators
168 
169  //- Disallow default bitwise assignment
170  void operator=(const structuredRenumber&) = delete;
171 };
172 
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 } // End namespace Foam
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 #endif
181 
182 // ************************************************************************* //
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:61
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
Abstract base class for renumbering.
Less function class that can be used for sorting according to.
bool operator()(const label a, const label b)
layerLess(const Switch depthFirst, const labelList &order, const List< topoDistanceData > &distance)
Renumbering according to mesh layers. depthFirst = true: first column gets ids 0.....
virtual ~structuredRenumber()
Destructor.
TypeName("structured")
Runtime type information.
const autoPtr< renumberMethod > method_
virtual labelList renumber(const pointField &) const
Return the order in which cells need to be visited, i.e.
void operator=(const structuredRenumber &)=delete
Disallow default bitwise assignment.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:381
volScalarField & b
Definition: createFields.H:27
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition: labelList.H:56
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
int order(const scalar s)