initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / decompositionAgglomeration / parMetisDecomp / parMetisDecomp.H
blobe0744b36ec3200b9d7f0cbd29f1a99eac1495932
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 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::parMetisDecomp
28 Description
30 SourceFiles
31     parMetisDecomp.C
33 \*---------------------------------------------------------------------------*/
35 #ifndef parMetisDecomp_H
36 #define parMetisDecomp_H
38 #include "decompositionMethod.H"
40 namespace Foam
43 /*---------------------------------------------------------------------------*\
44                            Class parMetisDecomp Declaration
45 \*---------------------------------------------------------------------------*/
47 class parMetisDecomp
49     public decompositionMethod
51     // Private data
53         const polyMesh& mesh_;
56     // Private Member Functions
58         //- Insert list in front of list.
59         template<class Type>
60         static void prepend(const UList<Type>&, List<Type>&);
61         //- Insert list at end of list.
62         template<class Type>
63         static void append(const UList<Type>&, List<Type>&);
65         label decompose
66         (
67             Field<int>& xadj,
68             Field<int>& adjncy,
69             const pointField& cellCentres,
70             Field<int>& cellWeights,
71             Field<int>& faceWeights,
72             const List<int>& options,
74             List<int>& finalDecomp
75         );
78         //- Disallow default bitwise copy construct and assignment
79         void operator=(const parMetisDecomp&);
80         parMetisDecomp(const parMetisDecomp&);
83 public:
85     //- Runtime type information
86     TypeName("parMetis");
89     // Constructors
91         //- Construct given the decomposition dictionary and mesh
92         parMetisDecomp
93         (
94             const dictionary& decompositionDict,
95             const polyMesh& mesh
96         );
99     // Destructor
101         ~parMetisDecomp()
102         {}
105     // Member Functions
107         //- parMetis handles Foam processor boundaries
108         virtual bool parallelAware() const
109         {
110             return true;
111         }
113         //- Return for every coordinate the wanted processor number. Use the
114         //  mesh connectivity (if needed)
115         virtual labelList decompose(const pointField&);
117         //- Return for every coordinate the wanted processor number. Gets
118         //  passed agglomeration map (from fine to coarse cells) and coarse cell
119         //  location. Can be overridden by decomposers that provide this
120         //  functionality natively.
121         virtual labelList decompose
122         (
123             const labelList& agglom,
124             const pointField&
125         );
127         //- Return for every coordinate the wanted processor number. Explicitly
128         //  provided mesh connectivity.
129         //  The connectivity is equal to mesh.cellCells() except for
130         //  - in parallel the cell numbers are global cell numbers (starting
131         //    from 0 at processor0 and then incrementing all through the
132         //    processors)
133         //  - the connections are across coupled patches
134         virtual labelList decompose
135         (
136             const labelListList& globalCellCells,
137             const pointField& cc
138         );
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 } // End namespace Foam
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 #ifdef NoRepository
149 #   include "parMetisDecompTemplates.C"
150 #endif
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 #endif
156 // ************************************************************************* //