initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / decompositionMethods / decompositionMethods / metisDecomp / metisDecomp.H
bloba91427a8e9118f66a5f301017ab61327bfe0641e
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     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, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::metisDecomp
28 Description
29     Metis domain decomposition
31 SourceFiles
32     metisDecomp.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef metisDecomp_H
37 #define metisDecomp_H
39 #include "decompositionMethod.H"
41 namespace Foam
44 /*---------------------------------------------------------------------------*\
45                            Class metisDecomp Declaration
46 \*---------------------------------------------------------------------------*/
48 class metisDecomp
50     public decompositionMethod
52     // Private data
54         const polyMesh& mesh_;
57     // Private Member Functions
59         label decompose
60         (
61             const List<int>& adjncy,
62             const List<int>& xadj,
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         virtual labelList decompose(const pointField&);
105         //- Return for every coordinate the wanted processor number. Gets
106         //  passed agglomeration map (from fine to coarse cells) and coarse cell
107         //  location. Can be overridden by decomposers that provide this
108         //  functionality natively.
109         virtual labelList decompose
110         (
111             const labelList& agglom,
112             const pointField&
113         );
115         //- Return for every coordinate the wanted processor number. Explicitly
116         //  provided mesh connectivity.
117         //  The connectivity is equal to mesh.cellCells() except for
118         //  - in parallel the cell numbers are global cell numbers (starting
119         //    from 0 at processor0 and then incrementing all through the
120         //    processors)
121         //  - the connections are across coupled patches
122         virtual labelList decompose
123         (
124             const labelListList& globalCellCells,
125             const pointField& cc
126         );
128         //- Helper to convert cellcells into Metis storage
129         static void calcMetisCSR
130         (
131             const labelListList& globalCellCells,
132             List<int>& adjncy,
133             List<int>& xadj
134         );
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 } // End namespace Foam
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 #endif
147 // ************************************************************************* //