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-2021 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 multiLevelDecomp_H
39 #define 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  //- No copy construct
103  multiLevelDecomp(const multiLevelDecomp&) = delete;
104 
105  //- No copy assignment
106  void operator=(const multiLevelDecomp&) = delete;
107 
108 
109 public:
110 
111  //- Runtime type information
112  TypeName("multiLevel");
113 
114 
115  // Constructors
116 
117  //- Construct given decomposition dictionary and optional region name
118  explicit multiLevelDecomp
119  (
120  const dictionary& decompDict,
121  const word& regionName = ""
122  );
123 
124 
125  //- Destructor
126  virtual ~multiLevelDecomp() = default;
127 
128 
129  // Member Functions
130 
131  //- Is method parallel aware?
132  // i.e. does it synchronize domains across proc boundaries
133  virtual bool parallelAware() const;
134 
135  //- Inherit decompose from decompositionMethod
137 
138  //- Return for every coordinate the wanted processor number.
139  // Use the mesh connectivity (if needed)
140  virtual labelList decompose
141  (
142  const polyMesh& mesh,
143  const pointField& points,
144  const scalarField& pointWeights
145  ) const;
146 
147  //- Return for every coordinate the wanted processor number.
148  // Explicitly provided connectivity - does not use mesh_.
149  virtual labelList decompose
150  (
151  const labelListList& globalCellCells,
152  const pointField& cc,
153  const scalarField& cWeights
154  ) const;
155 };
156 
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 } // End namespace Foam
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 #endif
165 
166 // ************************************************************************* //
Foam::BitOps::set
void set(List< bool > &bools, const labelRange &range)
Set the specified range 'on' in a boolList.
Definition: BitOps.C:37
Foam::multiLevelDecomp::~multiLevelDecomp
virtual ~multiLevelDecomp()=default
Destructor.
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
decompositionMethod.H
Foam::multiLevelDecomp
Decompose given using consecutive application of decomposers.
Definition: multiLevelDecomp.H:49
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::multiLevelDecomp::parallelAware
virtual bool parallelAware() const
Is method parallel aware?
Definition: multiLevelDecomp.C:588
regionName
Foam::word regionName
Definition: createNamedDynamicFvMesh.H:1
Foam::Field< vector >
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:59
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::decompositionMethod
Abstract base class for domain decomposition.
Definition: decompositionMethod.H:51
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::decompositionMethod::decompose
virtual labelList decompose(const pointField &points, const scalarField &pointWeights) const
Return the wanted processor number for every coordinate.
Definition: decompositionMethod.C:1325
Foam::List< label >
Foam::UList< label >
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::decompositionMethod::nDomains
label nDomains() const noexcept
Number of domains.
Definition: decompositionMethod.H:209
Foam::multiLevelDecomp::TypeName
TypeName("multiLevel")
Runtime type information.