$extrastylesheet
00001 // The libMesh Finite Element Library. 00002 // Copyright (C) 2002-2014 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner 00003 00004 // This library is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public 00006 // License as published by the Free Software Foundation; either 00007 // version 2.1 of the License, or (at your option) any later version. 00008 00009 // This library is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 // Lesser General Public License for more details. 00013 00014 // You should have received a copy of the GNU Lesser General Public 00015 // License along with this library; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 00019 00020 #ifndef LIBMESH_PARMETIS_PARTITIONER_H 00021 #define LIBMESH_PARMETIS_PARTITIONER_H 00022 00023 // Local Includes ----------------------------------- 00024 #include "libmesh/id_types.h" 00025 #include "libmesh/partitioner.h" 00026 #include "libmesh/vectormap.h" 00027 00028 typedef int idxtype; 00029 00030 // C++ Includes ----------------------------------- 00031 #include <cstddef> 00032 #include <vector> 00033 00034 namespace libMesh 00035 { 00036 00037 00038 00044 // ------------------------------------------------------------ 00045 // ParmetisPartitioner class definition 00046 class ParmetisPartitioner : public Partitioner 00047 { 00048 public: 00049 00053 ParmetisPartitioner () {} 00054 00059 virtual UniquePtr<Partitioner> clone () const 00060 { 00061 return UniquePtr<Partitioner>(new ParmetisPartitioner()); 00062 } 00063 00064 00065 protected: 00066 00073 virtual void _do_repartition (MeshBase& mesh, 00074 const unsigned int n); 00075 00079 virtual void _do_partition (MeshBase& mesh, 00080 const unsigned int n); 00081 00082 private: 00083 00084 // These methods & data only need to be available if the 00085 // ParMETIS library is available. 00086 #ifdef LIBMESH_HAVE_PARMETIS 00087 00091 void initialize (const MeshBase& mesh, const unsigned int n_sbdmns); 00092 00096 void build_graph (const MeshBase& mesh); 00097 00101 void assign_partitioning (MeshBase& mesh); 00102 00108 std::vector<dof_id_type> _n_active_elem_on_proc; 00109 00113 vectormap<dof_id_type, dof_id_type> _global_index_by_pid_map; 00114 00119 std::vector<int> _vtxdist; 00120 std::vector<int> _xadj; 00121 std::vector<int> _adjncy; 00122 std::vector<int> _part; 00123 std::vector<float> _tpwgts; 00124 std::vector<float> _ubvec; 00125 std::vector<int> _options; 00126 std::vector<int> _vwgt; 00127 00128 int _wgtflag; 00129 int _ncon; 00130 int _numflag; 00131 int _nparts; 00132 int _edgecut; 00133 00134 #endif 00135 }; 00136 00137 00138 } // namespace libMesh 00139 00140 00141 00142 #endif // LIBMESH_PARMETIS_PARTITIONER_H