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 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 structuredRenumber_H
44 #define structuredRenumber_H
45 
46 #include "renumberMethod.H"
47 
48 namespace Foam
49 {
50 
51 template<class Type> class topoDistanceData;
52 
53 /*---------------------------------------------------------------------------*\
54  Class structuredRenumber Declaration
55 \*---------------------------------------------------------------------------*/
56 
58 :
59  public renumberMethod
60 {
61 public:
62 
63  // Public classes
64 
65  //- Less function class that can be used for sorting according to
66  // 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 
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);
88  };
89 
90 
91  // Private data
92 
93  const dictionary methodDict_;
94 
95  const wordRes patches_;
96 
97  const label nLayers_;
98 
99  const bool depthFirst_;
100 
101  const bool reverse_;
102 
104 
105 
106  // Private Member Functions
107 
108  //- No copy construct
109  structuredRenumber(const structuredRenumber&) = delete;
110 
111  //- No copy assignment
112  void operator=(const structuredRenumber&) = delete;
113 
114 
115 public:
116 
117  //- Runtime type information
118  TypeName("structured");
119 
120 
121  // Constructors
122 
123  //- Construct given the renumber dictionary
124  structuredRenumber(const dictionary& renumberDict);
125 
126 
127  //- Destructor
128  virtual ~structuredRenumber() = default;
129 
130 
131  // Member Functions
132 
133  //- Return the order in which cells need to be visited, i.e.
134  // from ordered back to original cell label.
135  // This is only defined for geometric renumberMethods.
136  virtual labelList renumber(const pointField&) const
137  {
139  return labelList(0);
140  }
141 
142  //- Return the order in which cells need to be visited, i.e.
143  // from ordered back to original cell label.
144  // Use the mesh connectivity (if needed)
145  virtual labelList renumber
146  (
147  const polyMesh& mesh,
148  const pointField& cc
149  ) const;
150 
151  //- Return the order in which cells need to be visited, i.e.
152  // from ordered back to original cell label.
153  // The connectivity is equal to mesh.cellCells() except
154  // - the connections are across coupled patches
156  (
157  const labelListList& cellCells,
158  const pointField& cc
159  ) const
160  {
162  return labelList(0);
163  }
164 };
165 
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 } // End namespace Foam
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #endif
174 
175 // ************************************************************************* //
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:67
Foam::topoDistanceData
For use with FaceCellWave. Determines topological distance to starting faces. Templated on passive tr...
Definition: topoDistanceData.H:53
Foam::structuredRenumber::depthFirst_
const bool depthFirst_
Definition: structuredRenumber.H:98
Foam::structuredRenumber
Renumbering according to mesh layers. depthFirst = true: first column gets ids 0.....
Definition: structuredRenumber.H:56
Foam::structuredRenumber::layerLess
Less function class that can be used for sorting according to.
Definition: structuredRenumber.H:66
Foam::structuredRenumber::operator=
void operator=(const structuredRenumber &)=delete
No copy assignment.
Foam::structuredRenumber::nLayers_
const label nLayers_
Definition: structuredRenumber.H:96
Foam::structuredRenumber::layerLess::layerLess
layerLess(const bool depthFirst, const labelList &order, const List< topoDistanceData< label >> &distance)
Definition: structuredRenumber.H:75
Foam::structuredRenumber::reverse_
const bool reverse_
Definition: structuredRenumber.H:100
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
renumberMethod.H
Foam::structuredRenumber::~structuredRenumber
virtual ~structuredRenumber()=default
Destructor.
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
Foam::Field< vector >
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::structuredRenumber::structuredRenumber
structuredRenumber(const structuredRenumber &)=delete
No copy construct.
Foam::distance
scalar distance(const vector &p1, const vector &p2)
Definition: curveTools.C:12
Foam::renumberMethod
Abstract base class for renumbering.
Definition: renumberMethod.H:50
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::List< label >
Foam::structuredRenumber::patches_
const wordRes patches_
Definition: structuredRenumber.H:94
Foam::wordRes
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:51
Foam::structuredRenumber::method_
const autoPtr< renumberMethod > method_
Definition: structuredRenumber.H:102
Foam::structuredRenumber::TypeName
TypeName("structured")
Runtime type information.
Foam::structuredRenumber::renumber
virtual labelList renumber(const pointField &) const
Return the order in which cells need to be visited, i.e.
Definition: structuredRenumber.H:135
Foam::structuredRenumber::methodDict_
const dictionary methodDict_
Definition: structuredRenumber.H:92
Foam::structuredRenumber::layerLess::operator()
bool operator()(const label a, const label b)
Definition: structuredRenumber.C:70