metisLikeDecomp.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) 2017-2021 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::metisLikeDecomp
28
29Description
30 Domain decomposition using METIS-like data structures.
31
32 When run in parallel will collect the entire graph on to the master,
33 decompose and send back.
34
35SourceFiles
36 metisLikeDecomp.C
37
38\*---------------------------------------------------------------------------*/
39
40#ifndef metisLikeDecomp_H
41#define metisLikeDecomp_H
42
43#include "decompositionMethod.H"
44
45namespace Foam
46{
47
48/*---------------------------------------------------------------------------*\
49 Class metisLikeDecomp Declaration
50\*---------------------------------------------------------------------------*/
53:
55{
56protected:
57
58 // Protected Data
59
60 //- Coefficients for all derived methods
62
63
64 // Protected Member Functions
65
66 //- Serial and/or collect/distribute for parallel operation
67 virtual label decomposeGeneral
68 (
69 const labelList& adjncy,
70 const labelList& xadj,
71 const List<scalar>& cellWeights,
72 labelList& decomp
73 ) const;
74
75 //- Decomposition with metis-like parameters
76 virtual label decomposeSerial
77 (
78 const labelList& adjncy,
79 const labelList& xadj,
80 const List<scalar>& cellWeights,
81 labelList& decomp
82 ) const = 0;
83
84
85 //- No copy construct
86 metisLikeDecomp(const metisLikeDecomp&) = delete;
87
88 //- No copy assignment
89 void operator=(const metisLikeDecomp&) = delete;
90
91
92 // Constructors
93
94 //- Construct for derived type name and decomposition dictionary.
96 (
97 const word& derivedType,
98 const dictionary& decompDict,
99 int select = selectionType::NULL_DICT
100 )
101 :
102 metisLikeDecomp(derivedType, decompDict, "", select)
103 {}
104
105 //- Construct for derived type name, decomposition dictionary
106 //- and (optional) region name
107 // The default search for the coefficients will return dictionary::null
108 // on failure. This avoids a name clash of a metis "method" with the
109 // top level.
111 (
112 const word& derivedType,
113 const dictionary& decompDict,
114 const word& regionName,
115 int select = selectionType::NULL_DICT
116 );
117
118public:
119
120 //- Destructor
121 virtual ~metisLikeDecomp() = default;
122
123
124 // Member Functions
125
126 //- Inherit decompose from decompositionMethod
128
129 //- Return for every coordinate the wanted processor number.
130 // Uses the mesh connectivity (if needed).
131 // Weights get normalised so the minimum value is 1 before truncation
132 // to an integer so the weights should be multiples of the minimum
133 // value. The overall sum of weights might otherwise overflow.
134 virtual labelList decompose
135 (
136 const polyMesh& mesh,
137 const pointField& points,
138 const scalarField& pointWeights
139 ) const;
140
141 //- Return for every coordinate the wanted processor number.
142 // Gets passed agglomeration map (from fine to coarse cells) and coarse
143 // cell location. Can be overridden by decomposers that provide this
144 // functionality natively.
145 // See note on weights above.
146 virtual labelList decompose
147 (
148 const polyMesh& mesh,
149 const labelList& agglom,
150 const pointField& regionPoints,
151 const scalarField& regionWeights
152 ) const;
153
154 //- Return for every coordinate the wanted processor number.
155 // Explicitly provided mesh connectivity.
156 // The connectivity is equal to mesh.cellCells() except for
157 // - in parallel the cell numbers are global cell numbers (starting
158 // from 0 at processor0 and then incrementing all through the
159 // processors)
160 // - the connections are across coupled patches
161 // See note on weights above.
162 virtual labelList decompose
163 (
164 const labelListList& globalCellCells,
165 const pointField& cellCentres,
166 const scalarField& cellWeights
167 ) const;
168};
169
170
171// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172
173} // End namespace Foam
174
175// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176
177#endif
178
179// ************************************************************************* //
Abstract base class for domain decomposition.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Domain decomposition using METIS-like data structures.
const dictionary & coeffsDict_
Coefficients for all derived methods.
metisLikeDecomp(const metisLikeDecomp &)=delete
No copy construct.
virtual label decomposeSerial(const labelList &adjncy, const labelList &xadj, const List< scalar > &cellWeights, labelList &decomp) const =0
Decomposition with metis-like parameters.
virtual ~metisLikeDecomp()=default
Destructor.
virtual labelList decompose(const polyMesh &mesh, const pointField &points, const scalarField &pointWeights) const
Return for every coordinate the wanted processor number.
metisLikeDecomp(const word &derivedType, const dictionary &decompDict, int select=selectionType::NULL_DICT)
Construct for derived type name and decomposition dictionary.
virtual label decomposeGeneral(const labelList &adjncy, const labelList &xadj, const List< scalar > &cellWeights, labelList &decomp) const
Serial and/or collect/distribute for parallel operation.
void operator=(const metisLikeDecomp &)=delete
No copy assignment.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:81
bool decompose() const noexcept
Query the decompose flag (normally off)
A class for handling words, derived from Foam::string.
Definition: word.H:68
dynamicFvMesh & mesh
Foam::word regionName(Foam::polyMesh::defaultRegion)
const pointField & points
Namespace for OpenFOAM.