parmetis_partitioner.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2018 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 
19 
20 #ifndef LIBMESH_PARMETIS_PARTITIONER_H
21 #define LIBMESH_PARMETIS_PARTITIONER_H
22 
23 // Local Includes
24 #include "libmesh/id_types.h"
25 #include "libmesh/partitioner.h"
26 #include "libmesh/auto_ptr.h" // libmesh_make_unique
27 
28 // C++ Includes
29 #include <cstddef>
30 #include <unordered_map>
31 #include <vector>
32 
33 namespace libMesh
34 {
35 
36 // Forward declarations
37 class ParmetisHelper;
38 
48 {
49 public:
50 
56 
62 
69 
74  virtual ~ParmetisPartitioner();
75 
79  virtual std::unique_ptr<Partitioner> clone () const override
80  {
81  return libmesh_make_unique<ParmetisPartitioner>(*this);
82  }
83 
84 
85 protected:
86 
93  virtual void _do_repartition (MeshBase & mesh,
94  const unsigned int n) override;
95 
99  virtual void _do_partition (MeshBase & mesh,
100  const unsigned int n) override;
101 
102 #ifdef LIBMESH_HAVE_PARMETIS
103 
106  virtual void build_graph (const MeshBase & mesh) override;
107 
108 private:
109 
110  // These methods and data only need to be available if the
111  // ParMETIS library is available.
112 
116  void initialize (const MeshBase & mesh, const unsigned int n_sbdmns);
117 
122  std::unique_ptr<ParmetisHelper> _pmetis;
123 
124 #endif
125 };
126 
127 } // namespace libMesh
128 
129 #endif // LIBMESH_PARMETIS_PARTITIONER_H
std::unique_ptr< ParmetisHelper > _pmetis
ParmetisPartitioner & operator=(const ParmetisPartitioner &)=delete
void initialize(const MeshBase &mesh, const unsigned int n_sbdmns)
virtual void _do_repartition(MeshBase &mesh, const unsigned int n) override
MeshBase & mesh
virtual void build_graph(const MeshBase &mesh) override
Partitioner which provides an interface to ParMETIS.
virtual std::unique_ptr< Partitioner > clone() const override
Base class for Mesh.
Definition: mesh_base.h:77
Base class for all concrete Partitioner instantiations.
Definition: partitioner.h:50
virtual void _do_partition(MeshBase &mesh, const unsigned int n) override