1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
32 \*---------------------------------------------------------------------------*/
34 #ifndef parMetisDecomp_H
35 #define parMetisDecomp_H
37 #include "decompositionMethod.H"
42 /*---------------------------------------------------------------------------*\
43 Class parMetisDecomp Declaration
44 \*---------------------------------------------------------------------------*/
48 public decompositionMethod
52 const polyMesh& mesh_;
55 // Private Member Functions
57 //- Insert list in front of list.
59 static void prepend(const UList<Type>&, List<Type>&);
60 //- Insert list at end of list.
62 static void append(const UList<Type>&, List<Type>&);
68 const pointField& cellCentres,
69 Field<int>& cellWeights,
70 Field<int>& faceWeights,
71 const List<int>& options,
73 List<int>& finalDecomp
77 //- Disallow default bitwise copy construct and assignment
78 void operator=(const parMetisDecomp&);
79 parMetisDecomp(const parMetisDecomp&);
84 //- Runtime type information
90 //- Construct given the decomposition dictionary and mesh
93 const dictionary& decompositionDict,
106 //- parMetis handles Foam processor boundaries
107 virtual bool parallelAware() const
112 //- Return for every coordinate the wanted processor number. Use the
113 // mesh connectivity (if needed)
114 // Weights get normalised so the minimum value is 1 before truncation
115 // to an integer so the weights should be multiples of the minimum
116 // value. The overall sum of weights might otherwise overflow.
117 virtual labelList decompose
119 const pointField& points,
120 const scalarField& pointWeights
123 //- Return for every coordinate the wanted processor number. Gets
124 // passed agglomeration map (from fine to coarse cells) and coarse cell
125 // location. Can be overridden by decomposers that provide this
126 // functionality natively.
127 // See note on weights above.
128 virtual labelList decompose
130 const labelList& cellToRegion,
131 const pointField& regionPoints,
132 const scalarField& regionWeights
135 //- Same but with uniform weights
136 virtual labelList decompose
138 const labelList& cellToRegion,
139 const pointField& regionPoints
146 scalarField(regionPoints.size(), 1.0)
150 //- Return for every coordinate the wanted processor number. Explicitly
151 // provided mesh connectivity.
152 // The connectivity is equal to mesh.cellCells() except for
153 // - in parallel the cell numbers are global cell numbers (starting
154 // from 0 at processor0 and then incrementing all through the
156 // - the connections are across coupled patches
157 // See note on weights above.
158 virtual labelList decompose
160 const labelListList& globalCellCells,
161 const pointField& cc,
162 const scalarField& cWeights
165 //- Helper to convert mesh connectivity into distributed CSR
166 static void calcMetisDistributedCSR
175 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 } // End namespace Foam
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 # include "parMetisDecompTemplates.C"
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 // ************************************************************************* //