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 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 
76  // Private Member Functions
77 
78  //- The spring renumber implementation.
79  // The connections are CompactListList<label> or a labelListList.
80  template<class ConnectionListListType>
81  labelList renumberImpl
82  (
83  const ConnectionListListType& cellCellAddressing
84  ) const;
85 
86  //- No copy construct
87  springRenumber(const springRenumber&) = delete;
88 
89  //- No copy assignment
90  void operator=(const springRenumber&) = delete;
91 
92 
93 public:
94 
95  //- Runtime type information
96  TypeName("spring");
97 
98 
99  // Constructors
100 
101  //- Construct given the renumber dictionary
102  explicit springRenumber(const dictionary& dict);
103 
104 
105  //- Destructor
106  virtual ~springRenumber() = default;
107 
108 
109  // Member Functions
110 
111  //- Return the order in which cells need to be visited
112  //- (ie. from ordered back to original cell label).
113  // This is only defined for geometric renumberMethods.
114  virtual labelList renumber(const pointField&) const
115  {
117  return labelList();
118  }
119 
120  //- Return the order in which cells need to be visited
121  //- (ie. from ordered back to original cell label).
122  // Use the mesh connectivity (if needed)
123  virtual labelList renumber
124  (
125  const polyMesh& mesh,
126  const pointField&
127  ) const;
128 
129  //- Return the order in which cells need to be visited
130  //- (ie. from ordered back to original cell label).
131  virtual labelList renumber
132  (
133  const CompactListList<label>& cellCells,
134  const pointField& cellCentres
135  ) const;
136 
137  //- Return the order in which cells need to be visited
138  //- (ie. from ordered back to original cell label).
139  // The connectivity is equal to mesh.cellCells() except
140  // - the connections are across coupled patches
141  virtual labelList renumber
142  (
143  const labelListList& cellCells,
144  const pointField& cellCentres
145  ) const;
146 };
147 
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 } // End namespace Foam
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 #endif
156 
157 // ************************************************************************* //
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.
virtual labelList renumber(const pointField &) const
Return the order in which cells need to be visited (ie. from ordered back to original cell label)...
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:74
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:686
Namespace for OpenFOAM.