libMesh
parmetis_helper.h
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2019 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 #ifdef LIBMESH_HAVE_PARMETIS
28 
29 // Before we include a header wrapped in a namespace, we'd better make
30 // sure none of its dependencies end up in that namespace
31 #include <mpi.h>
32 
33 // Include the ParMETIS header files. We need this so we can use
34 // ParMetis' idx_t and real_t types directly.
35 namespace Parmetis {
36 extern "C" {
37 # include "libmesh/ignore_warnings.h"
38 # include "parmetis.h"
39 # include "libmesh/restore_warnings.h"
40 }
41 }
42 #endif // LIBMESH_HAVE_PARMETIS
43 
44 
45 namespace libMesh
46 {
47 
60 {
61 public:
65  ParmetisHelper () = default;
66  ParmetisHelper (const ParmetisHelper &) = default;
67  ParmetisHelper (ParmetisHelper &&) = default;
68  ParmetisHelper & operator= (const ParmetisHelper &) = default;
70  ~ParmetisHelper () = default;
71 
72 #ifdef LIBMESH_HAVE_PARMETIS
73 
78  std::vector<Parmetis::idx_t> vtxdist;
79  std::vector<Parmetis::idx_t> xadj;
80  std::vector<Parmetis::idx_t> adjncy;
81 
82  // We use dof_id_type for part so we can pass it directly to
83  // Partitioner:: methods expecting that type.
84  std::vector<dof_id_type> part;
85 
86  // But we plan to pass a pointer to part as a buffer to ParMETIS, so
87  // it had better be using a simply reinterpretable type!
88  static_assert(sizeof(Parmetis::idx_t) == sizeof(dof_id_type),
89  "ParMETIS and libMesh ID sizes must match!");
90 
91  std::vector<Parmetis::real_t> tpwgts;
92  std::vector<Parmetis::real_t> ubvec;
93  std::vector<Parmetis::idx_t> options;
94  std::vector<Parmetis::idx_t> vwgt;
95 
96  Parmetis::idx_t wgtflag;
97  Parmetis::idx_t ncon;
98  Parmetis::idx_t numflag;
99  Parmetis::idx_t nparts;
100  Parmetis::idx_t edgecut;
101 
102 #endif // LIBMESH_HAVE_PARMETIS
103 };
104 
105 } // namespace libMesh
106 
107 #endif // LIBMESH_PARMETIS_HELPER_H
libMesh::dof_id_type
uint8_t dof_id_type
Definition: id_types.h:67
libMesh::ParmetisHelper::ParmetisHelper
ParmetisHelper()=default
Defaulted constructors, assignment operators, and destructor.
libMesh::ParmetisHelper::operator=
ParmetisHelper & operator=(const ParmetisHelper &)=default
Parmetis
Definition: parmetis_helper.h:35
libMesh::ParmetisHelper::~ParmetisHelper
~ParmetisHelper()=default
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::ParmetisHelper
The ParmetisHelper class allows us to use a 'pimpl' strategy in the ParmetisPartitioner class.
Definition: parmetis_helper.h:59
libMesh::ParmetisHelper::vtxdist
std::vector< Parmetis::idx_t > vtxdist
Data structures used by ParMETIS to describe the connectivity graph of the mesh.
Definition: parmetis_helper.h:78
libMesh::ParmetisHelper::nparts
Parmetis::idx_t nparts
Definition: parmetis_helper.h:99
libMesh::ParmetisHelper::numflag
Parmetis::idx_t numflag
Definition: parmetis_helper.h:98
libMesh::ParmetisHelper::adjncy
std::vector< Parmetis::idx_t > adjncy
Definition: parmetis_helper.h:80
libMesh::ParmetisHelper::options
std::vector< Parmetis::idx_t > options
Definition: parmetis_helper.h:93
libMesh::ParmetisHelper::part
std::vector< dof_id_type > part
Definition: parmetis_helper.h:84
libMesh::ParmetisHelper::ubvec
std::vector< Parmetis::real_t > ubvec
Definition: parmetis_helper.h:92
libMesh::ParmetisHelper::ncon
Parmetis::idx_t ncon
Definition: parmetis_helper.h:97
libMesh::ParmetisHelper::edgecut
Parmetis::idx_t edgecut
Definition: parmetis_helper.h:100
libMesh::ParmetisHelper::xadj
std::vector< Parmetis::idx_t > xadj
Definition: parmetis_helper.h:79
libMesh::ParmetisHelper::wgtflag
Parmetis::idx_t wgtflag
Definition: parmetis_helper.h:96
libMesh::ParmetisHelper::tpwgts
std::vector< Parmetis::real_t > tpwgts
Definition: parmetis_helper.h:89
libMesh::ParmetisHelper::vwgt
std::vector< Parmetis::idx_t > vwgt
Definition: parmetis_helper.h:94