parmetis_helper.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 #ifndef LIBMESH_PARMETIS_HELPER_H
19 #define LIBMESH_PARMETIS_HELPER_H
20 
21 // Local Includes
22 #include "libmesh/libmesh_config.h"
23 
24 // C++ Includes
25 #include <vector>
26 
27 // Include the ParMETIS header files. We need this so we can use
28 // ParMetis' idx_t and real_t types directly.
29 #ifdef LIBMESH_HAVE_PARMETIS
30 namespace Parmetis {
31 extern "C" {
32 # include "libmesh/ignore_warnings.h"
33 # include "parmetis.h"
35 }
36 }
37 #endif // LIBMESH_HAVE_PARMETIS
38 
39 
40 namespace libMesh
41 {
42 
55 {
56 public:
60  ParmetisHelper () = default;
61  ParmetisHelper (const ParmetisHelper &) = default;
62  ParmetisHelper (ParmetisHelper &&) = default;
63  ParmetisHelper & operator= (const ParmetisHelper &) = default;
65  ~ParmetisHelper () = default;
66 
67 #ifdef LIBMESH_HAVE_PARMETIS
68 
73  std::vector<Parmetis::idx_t> vtxdist;
74  std::vector<Parmetis::idx_t> xadj;
75  std::vector<Parmetis::idx_t> adjncy;
76 
77  // We use dof_id_type for part so we can pass it directly to
78  // Partitioner:: methods expecting that type.
79  std::vector<dof_id_type> part;
80 
81  // But we plan to pass a pointer to part as a buffer to ParMETIS, so
82  // it had better be using a simply reinterpretable type!
83  static_assert(sizeof(Parmetis::idx_t) == sizeof(dof_id_type),
84  "ParMETIS and libMesh ID sizes must match!");
85 
86  std::vector<Parmetis::real_t> tpwgts;
87  std::vector<Parmetis::real_t> ubvec;
88  std::vector<Parmetis::idx_t> options;
89  std::vector<Parmetis::idx_t> vwgt;
90 
91  Parmetis::idx_t wgtflag;
92  Parmetis::idx_t ncon;
93  Parmetis::idx_t numflag;
94  Parmetis::idx_t nparts;
95  Parmetis::idx_t edgecut;
96 
97 #endif // LIBMESH_HAVE_PARMETIS
98 };
99 
100 } // namespace libMesh
101 
102 #endif // LIBMESH_PARMETIS_HELPER_H
std::vector< Parmetis::idx_t > xadj
Pointer-to-implementation class used by ParmetisPartitioner.
std::vector< Parmetis::idx_t > vwgt
std::vector< dof_id_type > part
Parmetis::idx_t wgtflag
std::vector< Parmetis::idx_t > vtxdist
std::vector< Parmetis::idx_t > options
Parmetis::idx_t edgecut
std::vector< Parmetis::idx_t > adjncy
std::vector< Parmetis::real_t > ubvec
std::vector< Parmetis::real_t > tpwgts
Parmetis::idx_t nparts
ParmetisHelper & operator=(const ParmetisHelper &)=default
Parmetis::idx_t numflag
uint8_t dof_id_type
Definition: id_types.h:64