From 68a587cefee43b523a7a9f02fffb40b0ab4e8163 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 22 Mar 2022 10:09:12 -0600 Subject: [PATCH] Minor cleanups. --- source/lac/sparsity_tools.cc | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/source/lac/sparsity_tools.cc b/source/lac/sparsity_tools.cc index 783b6dea3b..5499524d03 100644 --- a/source/lac/sparsity_tools.cc +++ b/source/lac/sparsity_tools.cc @@ -69,24 +69,23 @@ namespace SparsityTools AssertThrow(false, ExcMETISNotInstalled()); #else - // generate the data structures for - // METIS. Note that this is particularly - // simple, since METIS wants exactly our - // compressed row storage format. we only - // have to set up a few auxiliary arrays - idx_t n = static_cast(sparsity_pattern.n_rows()), - ncon = 1, // number of balancing constraints (should be >0) - nparts = - static_cast(n_partitions), // number of subdomains to create - dummy; // the numbers of edges cut by the - // resulting partition + // Generate the data structures for METIS. Note that this is particularly + // simple, since METIS wants exactly our compressed row storage format. + // We only have to set up a few auxiliary arrays and convert from our + // unsigned cell weights to signed ones. + idx_t n = static_cast(sparsity_pattern.n_rows()); + + idx_t ncon = 1; // number of balancing constraints (should be >0) // We can not partition n items into more than n parts. METIS will // generate non-sensical output (everything is owned by a single process) // and complain with a message (but won't return an error code!): // ***Cannot bisect a graph with 0 vertices! // ***You are trying to partition a graph into too many parts! - nparts = std::min(n, nparts); + idx_t nparts = + std::min(n, + static_cast( + n_partitions)); // number of subdomains to create // use default options for METIS idx_t options[METIS_NOPTIONS]; @@ -110,7 +109,7 @@ namespace SparsityTools std::vector int_partition_indices(sparsity_pattern.n_rows()); - // Setup cell weighting option + // Set up cell weighting option std::vector int_cell_weights; if (cell_weights.size() > 0) { @@ -134,6 +133,7 @@ namespace SparsityTools // Select which type of partitioning to create // Use recursive if the number of partitions is less than or equal to 8 + idx_t dummy; // output: # of edges cut by the resulting partition if (nparts <= 8) ierr = METIS_PartGraphRecursive(&n, &ncon, -- 2.39.5