multiLevelDecomp.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) 2017-2023 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::multiLevelDecomp
29 
30 Description
31  Decompose given using consecutive application of decomposers.
32 
33 SourceFiles
34  multiLevelDecomp.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef Foam_multiLevelDecomp_H
39 #define Foam_multiLevelDecomp_H
40 
41 #include "decompositionMethod.H"
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class multiLevelDecomp Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 class multiLevelDecomp
51 :
52  public decompositionMethod
53 {
54  // Private Data
55 
56  //- Original coefficients for this method
57  const dictionary& coeffsDict_;
58 
59  //- Rewritten dictionary of individual methods
60  dictionary methodsDict_;
61 
63 
64 
65  // Private Member Functions
66 
67  //- Fill the methodsDict_
68  void createMethodsDict();
69 
70  //- Set methods based on the contents of the methodsDict_
71  void setMethods();
72 
73 
74  //- Given connectivity across processors work out connectivity
75  // for a (consistent) subset
76  void subsetGlobalCellCells
77  (
78  const label nDomains,
79  const label domainI,
80  const labelList& dist,
81 
82  const labelListList& cellCells,
83  const labelList& set,
84  labelListList& subCellCells,
85  labelList& cutConnections
86  ) const;
87 
88  //- Decompose at 'currLevel' without addressing
89  void decompose
90  (
91  const labelListList& pointPoints,
92  const pointField& points,
93  const scalarField& pointWeights,
94  const labelUList& pointMap, // map back to original points
95  const label currLevel,
96  const label leafOffset,
97 
98  labelList& finalDecomp
99  ) const;
100 
101 
102 public:
103 
104  // Generated Methods
105 
106  //- No copy construct
107  multiLevelDecomp(const multiLevelDecomp&) = delete;
108 
109  //- No copy assignment
110  void operator=(const multiLevelDecomp&) = delete;
111 
112 
113  //- Runtime type information
114  TypeName("multiLevel");
115 
116 
117  // Constructors
118 
119  //- Construct given decomposition dictionary and optional region name
120  explicit multiLevelDecomp
121  (
122  const dictionary& decompDict,
123  const word& regionName = ""
124  );
125 
126 
127  //- Destructor
128  virtual ~multiLevelDecomp() = default;
129 
130 
131  // Member Functions
132 
133  //- Is parallel aware when all sub-methods are also parallel-aware
134  virtual bool parallelAware() const;
135 
136  //- Inherit decompose from decompositionMethod
138 
139  //- Return for every coordinate the wanted processor number.
140  // Use the mesh connectivity (if needed)
141  virtual labelList decompose
142  (
143  const polyMesh& mesh,
144  const pointField& points,
145  const scalarField& pointWeights = scalarField::null()
146  ) const;
147 
148  //- Return for every coordinate the wanted processor number.
149  // Explicitly provided connectivity - does not use mesh_.
150  virtual labelList decompose
151  (
152  const CompactListList<label>& globalCellCells,
153  const pointField& cc,
154  const scalarField& cWeights = scalarField::null()
155  ) const;
156 
157  //- Return for every coordinate the wanted processor number.
158  // Explicitly provided connectivity - does not use mesh_.
159  virtual labelList decompose
160  (
161  const labelListList& globalCellCells,
162  const pointField& cc,
163  const scalarField& cWeights = scalarField::null()
164  ) const;
165 };
166 
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 } // End namespace Foam
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 #endif
175 
176 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual ~multiLevelDecomp()=default
Destructor.
dynamicFvMesh & mesh
Decompose given using consecutive application of decomposers.
const pointField & points
A class for handling words, derived from Foam::string.
Definition: word.H:63
Abstract base class for domain decomposition.
label nDomains() const noexcept
Number of domains.
A packed storage of objects of type <T> using an offset table for access.
Foam::word regionName(args.getOrDefault< word >("region", Foam::polyMesh::defaultRegion))
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Definition: List.H:55
static const Field< scalar > & null()
Return nullObject reference Field.
Definition: FieldI.H:24
multiLevelDecomp(const multiLevelDecomp &)=delete
No copy construct.
void operator=(const multiLevelDecomp &)=delete
No copy assignment.
TypeName("multiLevel")
Runtime type information.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
virtual bool parallelAware() const
Is parallel aware when all sub-methods are also parallel-aware.
Namespace for OpenFOAM.
virtual labelList decompose(const pointField &points, const scalarField &pointWeights=scalarField::null()) const
Return the wanted processor number for every coordinate, using uniform or specified point weights...