]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Minor cleanups in PETSc interfaces. 14767/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Wed, 8 Feb 2023 00:30:12 +0000 (17:30 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Wed, 8 Feb 2023 00:30:12 +0000 (17:30 -0700)
Specifically, silence a warning about an unused variable. While there,
mark a couple more variables as 'const'.

source/lac/petsc_parallel_sparse_matrix.cc

index 1e4106fa7bc9ab150d6e17dd05686909931314b6..32981d4451151caf38119b6afeb753ed6647ffc1 100644 (file)
@@ -486,9 +486,9 @@ namespace PETScWrappers
 #    ifdef DEBUG
       {
         // check indexsets
-        types::global_dof_index row_owners =
+        const types::global_dof_index row_owners =
           Utilities::MPI::sum(local_rows.n_elements(), communicator);
-        types::global_dof_index col_owners =
+        const types::global_dof_index col_owners =
           Utilities::MPI::sum(local_columns.n_elements(), communicator);
         Assert(row_owners == sparsity_pattern.n_rows(),
                ExcMessage(
@@ -510,8 +510,9 @@ namespace PETScWrappers
       PetscErrorCode ierr;
 
       // create the local to global mappings as arrays.
-      IndexSet::size_type n_local_active_rows = local_active_rows.n_elements();
-      IndexSet::size_type n_local_active_cols =
+      const IndexSet::size_type n_local_active_rows =
+        local_active_rows.n_elements();
+      const IndexSet::size_type n_local_active_cols =
         local_active_columns.n_elements();
       std::vector<PetscInt> idx_glob_row(n_local_active_rows);
       std::vector<PetscInt> idx_glob_col(n_local_active_cols);
@@ -674,6 +675,7 @@ namespace PETScWrappers
 #  else
       {
         // Use this to avoid unused variables warning
+        (void)communicator;
         (void)local_rows;
         (void)local_active_rows;
         (void)local_columns;

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.