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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::structuredRenumber
28 
29 Description
30  Renumbering according to mesh layers.
31  depthFirst = true:
32  first column gets ids 0..nLayer-1,
33  second nLayers..2*nLayers-1 etc.
34  depthFirst = false:
35  first layer gets ids 0,1,2 etc.
36 
37 SourceFiles
38  structuredRenumber.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef structuredRenumber_H
43 #define structuredRenumber_H
44 
45 #include "renumberMethod.H"
46 #include "topoDistanceData.H"
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class structuredRenumber Declaration
53 \*---------------------------------------------------------------------------*/
54 
56 :
57  public renumberMethod
58 {
59 public:
60 
61  // Public classes
62 
63  //- Less function class that can be used for sorting according to
64  // column and layer
65  class layerLess
66  {
67  const bool depthFirst_;
68  const labelList& order_;
69  const List<topoDistanceData>& distance_;
70 
71  public:
72 
74  (
75  const bool depthFirst,
76  const labelList& order,
78  )
79  :
80  depthFirst_(depthFirst),
81  order_(order),
82  distance_(distance)
83  {}
84 
85  bool operator()(const label a, const label b);
86  };
87 
88 
89  // Private data
90 
91  const dictionary methodDict_;
92 
93  const wordRes patches_;
94 
95  const label nLayers_;
96 
97  const bool depthFirst_;
98 
99  const bool reverse_;
100 
102 
103 
104  // Private Member Functions
105 
106  //- No copy construct
107  structuredRenumber(const structuredRenumber&) = delete;
108 
109  //- No copy assignment
110  void operator=(const structuredRenumber&) = delete;
111 
112 
113 public:
114 
115  //- Runtime type information
116  TypeName("structured");
117 
118 
119  // Constructors
120 
121  //- Construct given the renumber dictionary
122  structuredRenumber(const dictionary& renumberDict);
123 
124 
125  //- Destructor
126  virtual ~structuredRenumber() = default;
127 
128 
129  // Member Functions
130 
131  //- Return the order in which cells need to be visited, i.e.
132  // from ordered back to original cell label.
133  // This is only defined for geometric renumberMethods.
134  virtual labelList renumber(const pointField&) const
135  {
137  return labelList(0);
138  }
139 
140  //- Return the order in which cells need to be visited, i.e.
141  // from ordered back to original cell label.
142  // Use the mesh connectivity (if needed)
143  virtual labelList renumber
144  (
145  const polyMesh& mesh,
146  const pointField& cc
147  ) const;
148 
149  //- Return the order in which cells need to be visited, i.e.
150  // from ordered back to original cell label.
151  // The connectivity is equal to mesh.cellCells() except
152  // - the connections are across coupled patches
154  (
155  const labelListList& cellCells,
156  const pointField& cc
157  ) const
158  {
160  return labelList(0);
161  }
162 };
163 
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 } // End namespace Foam
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 #endif
172 
173 // ************************************************************************* //
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:74
topoDistanceData.H
Foam::structuredRenumber::depthFirst_
const bool depthFirst_
Definition: structuredRenumber.H:96
Foam::structuredRenumber
Renumbering according to mesh layers. depthFirst = true: first column gets ids 0.....
Definition: structuredRenumber.H:54
Foam::structuredRenumber::layerLess
Less function class that can be used for sorting according to.
Definition: structuredRenumber.H:64
Foam::structuredRenumber::operator=
void operator=(const structuredRenumber &)=delete
No copy assignment.
Foam::structuredRenumber::nLayers_
const label nLayers_
Definition: structuredRenumber.H:94
Foam::structuredRenumber::reverse_
const bool reverse_
Definition: structuredRenumber.H:98
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:419
renumberMethod.H
Foam::label
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:62
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:121
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:92
Foam::wordRes
A List of wordRe with additional matching capabilities.
Definition: wordRes.H:51
Foam::structuredRenumber::layerLess::layerLess
layerLess(const bool depthFirst, const labelList &order, const List< topoDistanceData > &distance)
Definition: structuredRenumber.H:73
Foam::structuredRenumber::method_
const autoPtr< renumberMethod > method_
Definition: structuredRenumber.H:100
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:133
Foam::structuredRenumber::methodDict_
const dictionary methodDict_
Definition: structuredRenumber.H:90
Foam::structuredRenumber::layerLess::operator()
bool operator()(const label a, const label b)
Definition: structuredRenumber.C:70