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

scotchDecomp.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::scotchDecomp
00027 
00028 Description
00029     Scotch domain decomposition
00030 
00031 SourceFiles
00032     scotchDecomp.C
00033 
00034 \*---------------------------------------------------------------------------*/
00035 
00036 #ifndef scotchDecomp_H
00037 #define scotchDecomp_H
00038 
00039 #include "decompositionMethod.H"
00040 
00041 namespace Foam
00042 {
00043 
00044 /*---------------------------------------------------------------------------*\
00045                            Class scotchDecomp Declaration
00046 \*---------------------------------------------------------------------------*/
00047 
00048 class scotchDecomp
00049 :
00050     public decompositionMethod
00051 {
00052     // Private data
00053 
00054         const polyMesh& mesh_;
00055 
00056 
00057     // Private Member Functions
00058 
00059         //- Check and print error message
00060         static void check(const int, const char*);
00061 
00062         label decompose
00063         (
00064             const List<int>& adjncy,
00065             const List<int>& xadj,
00066             List<int>& finalDecomp
00067         );
00068 
00069         //- Disallow default bitwise copy construct and assignment
00070         void operator=(const scotchDecomp&);
00071         scotchDecomp(const scotchDecomp&);
00072 
00073 
00074 public:
00075 
00076     //- Runtime type information
00077     TypeName("scotch");
00078 
00079 
00080     // Constructors
00081 
00082         //- Construct given the decomposition dictionary and mesh
00083         scotchDecomp
00084         (
00085             const dictionary& decompositionDict,
00086             const polyMesh& mesh
00087         );
00088 
00089 
00090     // Destructor
00091 
00092         virtual ~scotchDecomp()
00093         {}
00094 
00095 
00096     // Member Functions
00097 
00098         virtual bool parallelAware() const
00099         {
00100             // Metis does not know about proc boundaries
00101             return false;
00102         }
00103 
00104         //- Return for every coordinate the wanted processor number. Use the
00105         //  mesh connectivity (if needed)
00106         virtual labelList decompose(const pointField&);
00107 
00108         //- Return for every coordinate the wanted processor number. Gets
00109         //  passed agglomeration map (from fine to coarse cells) and coarse cell
00110         //  location. Can be overridden by decomposers that provide this
00111         //  functionality natively.
00112         virtual labelList decompose
00113         (
00114             const labelList& agglom,
00115             const pointField&
00116         );
00117 
00118         //- Return for every coordinate the wanted processor number. Explicitly
00119         //  provided mesh connectivity.
00120         //  The connectivity is equal to mesh.cellCells() except for
00121         //  - in parallel the cell numbers are global cell numbers (starting
00122         //    from 0 at processor0 and then incrementing all through the
00123         //    processors)
00124         //  - the connections are across coupled patches
00125         virtual labelList decompose
00126         (
00127             const labelListList& globalCellCells,
00128             const pointField& cc
00129         );
00130 
00131         //- Helper to convert cellcells into compact row storage
00132         static void calcMetisCSR
00133         (
00134             const labelListList& globalCellCells,
00135             List<int>& adjncy,
00136             List<int>& xadj
00137         );
00138 
00139 };
00140 
00141 
00142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00143 
00144 } // End namespace Foam
00145 
00146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00147 
00148 #endif
00149 
00150 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd