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

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