Loading...
Searching...
No Matches
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-2023 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 Foam_metisLikeDecomp_H
41#define Foam_metisLikeDecomp_H
42
43#include "decompositionMethod.H"
44
45namespace Foam
46{
48/*---------------------------------------------------------------------------*\
49 Class metisLikeDecomp Declaration
50\*---------------------------------------------------------------------------*/
51
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 with number of domains (no coefficients or constraints)
95 explicit metisLikeDecomp(const label numDomains);
96
97 //- Construct for derived type name and decomposition dictionary.
99 (
100 const word& derivedType,
101 const dictionary& decompDict,
102 int select = selectionType::NULL_DICT
103 )
104 :
105 metisLikeDecomp(derivedType, decompDict, "", select)
106 {}
108 //- Construct for derived type name, decomposition dictionary
109 //- and (optional) region name
110 // The default search for the coefficients will return dictionary::null
111 // on failure. This avoids a name clash of a metis "method" with the
112 // top level.
114 (
115 const word& derivedType,
116 const dictionary& decompDict,
117 const word& regionName,
118 int select = selectionType::NULL_DICT
119 );
120
121public:
122
123 //- Destructor
124 virtual ~metisLikeDecomp() = default;
125
126
127 // Member Functions
128
129 //- Inherit decompose from decompositionMethod
131
132 //- Return for every coordinate the wanted processor number.
133 // Uses the mesh connectivity (if needed).
134 // Weights get normalised so the minimum value is 1 before truncation
135 // to an integer so the weights should be multiples of the minimum
136 // value. The overall sum of weights might otherwise overflow.
137 virtual labelList decompose
139 const polyMesh& mesh,
141 const scalarField& pointWeights = scalarField::null()
142 ) const;
143
144 //- Return for every coordinate the wanted processor number.
145 // Gets passed agglomeration map (from fine to coarse cells) and coarse
146 // cell location. Can be overridden by decomposers that provide this
147 // functionality natively.
148 // See note on weights above.
149 virtual labelList decompose
150 (
151 const polyMesh& mesh,
152 const labelList& agglom,
153 const pointField& agglomPoints,
154 const scalarField& agglomWeights = scalarField::null()
155 ) const;
156
157 //- Return for every coordinate the wanted processor number.
158 // Explicitly provided mesh connectivity.
159 // The connectivity is equal to mesh.cellCells() except for
160 // - in parallel the cell numbers are global cell numbers (starting
161 // from 0 at processor0 and then incrementing all through the
162 // processors)
163 // - the connections are across coupled patches
164 // See note on weights above.
165 virtual labelList decompose
166 (
167 const CompactListList<label>& globalCellCells,
168 const pointField& cellCentres = pointField::null(),
169 const scalarField& cellWeights = scalarField::null()
170 ) const;
171
172 //- Return for every coordinate the wanted processor number.
173 // Explicitly provided mesh connectivity.
174 // The connectivity is equal to mesh.cellCells() except for
175 // - in parallel the cell numbers are global cell numbers (starting
176 // from 0 at processor0 and then incrementing all through the
177 // processors)
178 // - the connections are across coupled patches
179 // See note on weights above.
180 virtual labelList decompose
181 (
182 const labelListList& globalCellCells,
183 const pointField& cellCentres = pointField::null(),
184 const scalarField& cellWeights = scalarField::null()
185 ) const;
186};
187
188
189// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190
191} // End namespace Foam
192
193// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194
195#endif
196
197// ************************************************************************* //
A packed storage of objects of type <T> using an offset table for access.
static const Field< vector > & null() noexcept
Definition Field.H:192
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
decompositionMethod(const label numDomains)
Construct with specified number of domains, no coefficients or constraints.
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.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
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 labelList decompose(const polyMesh &mesh, const pointField &points=pointField::null(), const scalarField &pointWeights=scalarField::null()) const
Return for every coordinate the wanted processor number.
virtual ~metisLikeDecomp()=default
Destructor.
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:79
A class for handling words, derived from Foam::string.
Definition word.H:66
dynamicFvMesh & mesh
Foam::word regionName(args.getOrDefault< word >("region", Foam::polyMesh::defaultRegion))
const pointField & points
Namespace for OpenFOAM.
List< labelList > labelListList
List of labelList.
Definition labelList.H:38
List< label > labelList
A List of labels.
Definition List.H:62
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
vectorField pointField
pointField is a vectorField.