]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Minor cleanups. 13558/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 22 Mar 2022 16:09:12 +0000 (10:09 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Tue, 22 Mar 2022 16:09:12 +0000 (10:09 -0600)
source/lac/sparsity_tools.cc

index 783b6dea3b4f1e0fa2a3531a6f7ba0f10b17f34a..5499524d03145d31812f6ecb0c7e3e3e3f651b2d 100644 (file)
@@ -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];
@@ -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)
         {
@@ -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,

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.