FIX: Update foamPackSource for new SF upload scheme
[freefoam.git] / src / decompositionMethods / metisDecomp / metisDecomp.H
blob8d61f2fd75b03ff2e67f7feba8ecad5ff5bc3747
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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/>.
24 Class
25     Foam::metisDecomp
27 Description
28     Metis domain decomposition
30 SourceFiles
31     metisDecomp.C
33 \*---------------------------------------------------------------------------*/
35 #ifndef metisDecomp_H
36 #define metisDecomp_H
38 #include <decompositionMethods/decompositionMethod.H>
40 namespace Foam
43 /*---------------------------------------------------------------------------*\
44                            Class metisDecomp Declaration
45 \*---------------------------------------------------------------------------*/
47 class metisDecomp
49     public decompositionMethod
51     // Private data
53         const polyMesh& mesh_;
56     // Private Member Functions
58         label decompose
59         (
60             const List<int>& adjncy,
61             const List<int>& xadj,
62             const scalarField& cellWeights,
63             List<int>& finalDecomp
64         );
66         //- Disallow default bitwise copy construct and assignment
67         void operator=(const metisDecomp&);
68         metisDecomp(const metisDecomp&);
71 public:
73     //- Runtime type information
74     TypeName("metis");
77     // Constructors
79         //- Construct given the decomposition dictionary and mesh
80         metisDecomp
81         (
82             const dictionary& decompositionDict,
83             const polyMesh& mesh
84         );
87     // Destructor
89         virtual ~metisDecomp()
90         {}
93     // Member Functions
95         virtual bool parallelAware() const
96         {
97             // Metis does not know about proc boundaries
98             return false;
99         }
101         //- Return for every coordinate the wanted processor number. Use the
102         //  mesh connectivity (if needed)
103         //  Weights get normalised so the minimum value is 1 before truncation
104         //  to an integer so the weights should be multiples of the minimum
105         //  value. The overall sum of weights might otherwise overflow.
106         virtual labelList decompose
107         (
108             const pointField& points,
109             const scalarField& pointWeights
110         );
112         //- Return for every coordinate the wanted processor number. Gets
113         //  passed agglomeration map (from fine to coarse cells) and coarse cell
114         //  location. Can be overridden by decomposers that provide this
115         //  functionality natively.
116         //  See note on weights above.
117         virtual labelList decompose
118         (
119             const labelList& agglom,
120             const pointField& regionPoints,
121             const scalarField& regionWeights
122         );
124         //- Same but with uniform weights
125         virtual labelList decompose
126         (
127             const labelList& agglom,
128             const pointField& regionPoints
129         )
130         {
131             return decompose
132             (
133                 agglom,
134                 regionPoints,
135                 scalarField(regionPoints.size(), 1.0)
136             );
137         }
139         //- Return for every coordinate the wanted processor number. Explicitly
140         //  provided mesh connectivity.
141         //  The connectivity is equal to mesh.cellCells() except for
142         //  - in parallel the cell numbers are global cell numbers (starting
143         //    from 0 at processor0 and then incrementing all through the
144         //    processors)
145         //  - the connections are across coupled patches
146         //  See note on weights above.
147         virtual labelList decompose
148         (
149             const labelListList& globalCellCells,
150             const pointField& cc,
151             const scalarField& cWeights
152         );
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 } // End namespace Foam
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 #endif
165 // ************************ vim: set sw=4 sts=4 et: ************************ //