Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor cleanups. #13558

Merged
merged 1 commit into from
Mar 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 13 additions & 13 deletions source/lac/sparsity_tools.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<signed int>(sparsity_pattern.n_rows()),
ncon = 1, // number of balancing constraints (should be >0)
nparts =
static_cast<int>(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<signed int>(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<idx_t>(
n_partitions)); // number of subdomains to create

// use default options for METIS
idx_t options[METIS_NOPTIONS];
Expand All @@ -110,7 +109,7 @@ namespace SparsityTools

std::vector<idx_t> int_partition_indices(sparsity_pattern.n_rows());

// Setup cell weighting option
// Set up cell weighting option
std::vector<idx_t> int_cell_weights;
if (cell_weights.size() > 0)
{
Expand All @@ -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,
Expand Down