OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

metisDecomp.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::metisDecomp
00027 
00028 Description
00029     Metis domain decomposition
00030 
00031 SourceFiles
00032     metisDecomp.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef metisDecomp_H
00037 #define metisDecomp_H
00038 
00039 #include "decompositionMethod.H"
00040 
00041 namespace Foam
00042 {
00043 
00044 /*---------------------------------------------------------------------------*\
00045                            Class metisDecomp Declaration
00046 \*---------------------------------------------------------------------------*/
00047 
00048 class metisDecomp
00049 :
00050     public decompositionMethod
00051 {
00052     // Private data
00053 
00054         const polyMesh& mesh_;
00055 
00056 
00057     // Private Member Functions
00058 
00059         label decompose
00060         (
00061             const List<int>& adjncy,
00062             const List<int>& xadj,
00063             List<int>& finalDecomp
00064         );
00065 
00066         //- Disallow default bitwise copy construct and assignment
00067         void operator=(const metisDecomp&);
00068         metisDecomp(const metisDecomp&);
00069 
00070 
00071 public:
00072 
00073     //- Runtime type information
00074     TypeName("metis");
00075 
00076 
00077     // Constructors
00078 
00079         //- Construct given the decomposition dictionary and mesh
00080         metisDecomp
00081         (
00082             const dictionary& decompositionDict,
00083             const polyMesh& mesh
00084         );
00085 
00086 
00087     // Destructor
00088 
00089         virtual ~metisDecomp()
00090         {}
00091 
00092 
00093     // Member Functions
00094 
00095         virtual bool parallelAware() const
00096         {
00097             // Metis does not know about proc boundaries
00098             return false;
00099         }
00100 
00101         //- Return for every coordinate the wanted processor number. Use the
00102         //  mesh connectivity (if needed)
00103         virtual labelList decompose(const pointField&);
00104 
00105         //- Return for every coordinate the wanted processor number. Gets
00106         //  passed agglomeration map (from fine to coarse cells) and coarse cell
00107         //  location. Can be overridden by decomposers that provide this
00108         //  functionality natively.
00109         virtual labelList decompose
00110         (
00111             const labelList& agglom,
00112             const pointField&
00113         );
00114 
00115         //- Return for every coordinate the wanted processor number. Explicitly
00116         //  provided mesh connectivity.
00117         //  The connectivity is equal to mesh.cellCells() except for
00118         //  - in parallel the cell numbers are global cell numbers (starting
00119         //    from 0 at processor0 and then incrementing all through the
00120         //    processors)
00121         //  - the connections are across coupled patches
00122         virtual labelList decompose
00123         (
00124             const labelListList& globalCellCells,
00125             const pointField& cc
00126         );
00127 
00128         //- Helper to convert cellcells into Metis storage
00129         static void calcMetisCSR
00130         (
00131             const labelListList& globalCellCells,
00132             List<int>& adjncy,
00133             List<int>& xadj
00134         );
00135 
00136 };
00137 
00138 
00139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00140 
00141 } // End namespace Foam
00142 
00143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00144 
00145 #endif
00146 
00147 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd