springRenumber.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-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::springRenumber
29 
30 Description
31  Use spring analogy - attract neighbouring cells according to the distance
32  of their cell indices.
33 
34  // Maximum jump of cell indices. Is fraction of number of cells
35  maxCo 0.1;
36 
37  // Limit the amount of movement; the fraction maxCo gets decreased
38  // with every iteration.
39  freezeFraction 0.9;
40 
41  // Maximum number of iterations
42  maxIter 1000;
43 
44 SourceFiles
45  springRenumber.C
46 
47 \*---------------------------------------------------------------------------*/
48 
49 #ifndef Foam_springRenumber_H
50 #define Foam_springRenumber_H
51 
52 #include "renumberMethod.H"
53 
54 namespace Foam
55 {
56 
57 /*---------------------------------------------------------------------------*\
58  Class springRenumber Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 class springRenumber
62 :
63  public renumberMethod
64 {
65  // Private Data
66 
67  const dictionary& coeffsDict_;
68 
69  const label maxIter_;
70 
71  const scalar maxCo_;
72 
73  const scalar freezeFraction_;
74 
75  //- Verbose reporting of progress
76  bool verbose_;
77 
78 
79  // Private Member Functions
80 
81  //- The spring renumber implementation.
82  // The connections are CompactListList<label> or a labelListList.
83  template<class ConnectionListListType>
84  labelList renumberImpl
85  (
86  const ConnectionListListType& cellCellAddressing
87  ) const;
88 
89  //- No copy construct
90  springRenumber(const springRenumber&) = delete;
91 
92  //- No copy assignment
93  void operator=(const springRenumber&) = delete;
94 
95 
96 public:
97 
98  //- Runtime type information
99  TypeName("spring");
100 
101 
102  // Constructors
103 
104  //- Construct given the renumber dictionary
105  explicit springRenumber(const dictionary& dict);
106 
107 
108  //- Destructor
109  virtual ~springRenumber() = default;
110 
111 
112  // Member Functions
113 
114  // With mesh topology
115 
116  //- Return the cell visit order (from ordered back to original cell id)
117  //- using the mesh to determine the connectivity.
118  virtual labelList renumber
119  (
121  const polyMesh& mesh
122  ) const;
123 
124 
125  // With explicit topology
126 
127  //- Return the cell visit order (from ordered back to original cell id)
128  virtual labelList renumber
129  (
131  const CompactListList<label>& cellCells
132  ) const;
133 
134  //- Return the cell visit order (from ordered back to original cell id)
135  virtual labelList renumber
136  (
138  const labelListList& cellCells
139  ) const;
140 };
141 
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 } // End namespace Foam
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 #endif
150 
151 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual ~springRenumber()=default
Destructor.
TypeName("spring")
Runtime type information.
Abstract base class for renumbering.
dynamicFvMesh & mesh
A packed storage of objects of type <T> using an offset table for access.
Use spring analogy - attract neighbouring cells according to the distance of their cell indices...
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:75
virtual labelList renumber(const polyMesh &mesh) const
Return the cell visit order (from ordered back to original cell id) using the mesh to determine the c...
Namespace for OpenFOAM.