00001 /*---------------------------------------------------------------------------*\ 00002 ========= | 00003 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox 00004 \\ / O peration | 00005 \\ / A nd | Copyright (C) 1991-2010 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 00013 the Free Software Foundation, either version 3 of the License, or 00014 (at your 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, see <http://www.gnu.org/licenses/>. 00023 00024 Class 00025 Foam::metisDecomp 00026 00027 Description 00028 Metis domain decomposition 00029 00030 SourceFiles 00031 metisDecomp.C 00032 00033 \*---------------------------------------------------------------------------*/ 00034 00035 #ifndef metisDecomp_H 00036 #define metisDecomp_H 00037 00038 #include <decompositionMethods/decompositionMethod.H> 00039 00040 namespace Foam 00041 { 00042 00043 /*---------------------------------------------------------------------------*\ 00044 Class metisDecomp Declaration 00045 \*---------------------------------------------------------------------------*/ 00046 00047 class metisDecomp 00048 : 00049 public decompositionMethod 00050 { 00051 // Private data 00052 00053 const polyMesh& mesh_; 00054 00055 00056 // Private Member Functions 00057 00058 label decompose 00059 ( 00060 const List<int>& adjncy, 00061 const List<int>& xadj, 00062 const scalarField& cellWeights, 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 // Weights get normalised so the minimum value is 1 before truncation 00104 // to an integer so the weights should be multiples of the minimum 00105 // value. The overall sum of weights might otherwise overflow. 00106 virtual labelList decompose 00107 ( 00108 const pointField& points, 00109 const scalarField& pointWeights 00110 ); 00111 00112 //- Return for every coordinate the wanted processor number. Gets 00113 // passed agglomeration map (from fine to coarse cells) and coarse cell 00114 // location. Can be overridden by decomposers that provide this 00115 // functionality natively. 00116 // See note on weights above. 00117 virtual labelList decompose 00118 ( 00119 const labelList& agglom, 00120 const pointField& regionPoints, 00121 const scalarField& regionWeights 00122 ); 00123 00124 //- Same but with uniform weights 00125 virtual labelList decompose 00126 ( 00127 const labelList& agglom, 00128 const pointField& regionPoints 00129 ) 00130 { 00131 return decompose 00132 ( 00133 agglom, 00134 regionPoints, 00135 scalarField(regionPoints.size(), 1.0) 00136 ); 00137 } 00138 00139 //- Return for every coordinate the wanted processor number. Explicitly 00140 // provided mesh connectivity. 00141 // The connectivity is equal to mesh.cellCells() except for 00142 // - in parallel the cell numbers are global cell numbers (starting 00143 // from 0 at processor0 and then incrementing all through the 00144 // processors) 00145 // - the connections are across coupled patches 00146 // See note on weights above. 00147 virtual labelList decompose 00148 ( 00149 const labelListList& globalCellCells, 00150 const pointField& cc, 00151 const scalarField& cWeights 00152 ); 00153 00154 }; 00155 00156 00157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00158 00159 } // End namespace Foam 00160 00161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 00162 00163 #endif 00164 00165 // ************************ vim: set sw=4 sts=4 et: ************************ //