Skip to content

Commit

Permalink
update parmetis interface (#640)
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorBaratta authored and garth-wells committed Nov 14, 2019
1 parent 63eb205 commit 2b67be3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
5 changes: 1 addition & 4 deletions cpp/dolfin/graph/ParMETIS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ using namespace dolfin;

//-----------------------------------------------------------------------------
std::pair<std::vector<int>, std::map<std::int64_t, std::vector<int>>>
dolfin::graph::ParMETIS::partition(MPI_Comm mpi_comm,
dolfin::graph::ParMETIS::partition(MPI_Comm mpi_comm, idx_t nparts,
const CSRGraph<idx_t>& csr_graph)
{
std::map<std::int64_t, std::vector<int>> ghost_procs;
Expand All @@ -115,9 +115,6 @@ dolfin::graph::ParMETIS::partition(MPI_Comm mpi_comm,
options[1] = 0;
options[2] = 15;

// Number of partitions (one for each process)
idx_t nparts = dolfin::MPI::size(mpi_comm);

// Strange weight arrays needed by ParMETIS
idx_t ncon = 1;

Expand Down
2 changes: 1 addition & 1 deletion cpp/dolfin/graph/ParMETIS.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class ParMETIS
public:
// Standard ParMETIS partition
static std::pair<std::vector<int>, std::map<std::int64_t, std::vector<int>>>
partition(MPI_Comm mpi_comm, const CSRGraph<idx_t>& csr_graph);
partition(MPI_Comm mpi_comm, idx_t nparts, const CSRGraph<idx_t>& csr_graph);

private:
// ParMETIS adaptive repartition, so has to be non-const here
Expand Down
3 changes: 2 additions & 1 deletion cpp/dolfin/mesh/Partitioning.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,8 @@ PartitionData Partitioning::partition_cells(
{
#ifdef HAS_PARMETIS
graph::CSRGraph<idx_t> csr_graph(mpi_comm, local_graph);
return PartitionData(graph::ParMETIS::partition(mpi_comm, csr_graph));
return PartitionData(
graph::ParMETIS::partition(mpi_comm, (idx_t)nparts, csr_graph));
#else
throw std::runtime_error("ParMETIS not available");
#endif
Expand Down

0 comments on commit 2b67be3

Please sign in to comment.