]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Attempt to work around a compiler warning. 10861/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Mon, 31 Aug 2020 03:10:21 +0000 (21:10 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Mon, 31 Aug 2020 03:27:59 +0000 (21:27 -0600)
include/deal.II/lac/affine_constraints.templates.h

index 7e558104f57f0938256a83fa89e8f4be3585e06e..a9f0bfcc1ea389399076557e8f985392c22c68e6 100644 (file)
@@ -3284,19 +3284,33 @@ namespace internal
             {
               const size_type local_row  = global_rows.constraint_origin(i);
               const size_type global_row = local_dof_indices[local_row];
-              const number    new_diagonal =
-                (std::abs(local_matrix(local_row, local_row)) != 0. ?
-                   std::abs(local_matrix(local_row, local_row)) :
-                   average_diagonal);
-              global_matrix.add(global_row, global_row, new_diagonal);
-
-              // if the use_inhomogeneities_for_rhs flag is set to true, the
-              // inhomogeneities are used to create the global vector. instead
-              // of fill in a zero in the ith components with an inhomogeneity,
-              // we set those to: inhomogeneity(i)*global_matrix (i,i).
-              if (use_inhomogeneities_for_rhs == true)
-                global_vector(global_row) +=
-                  new_diagonal * constraints.get_inhomogeneity(global_row);
+
+              const number current_diagonal =
+                local_matrix(local_row, local_row);
+              if (std::abs(current_diagonal) != 0.)
+                {
+                  global_matrix.add(global_row,
+                                    global_row,
+                                    std::abs(current_diagonal));
+                  // if the use_inhomogeneities_for_rhs flag is set to true, the
+                  // inhomogeneities are used to create the global vector.
+                  // instead of fill in a zero in the ith components with an
+                  // inhomogeneity, we set those to:
+                  // inhomogeneity(i)*global_matrix (i,i).
+                  if (use_inhomogeneities_for_rhs == true)
+                    global_vector(global_row) +=
+                      current_diagonal *
+                      constraints.get_inhomogeneity(global_row);
+                }
+              else
+                {
+                  global_matrix.add(global_row, global_row, average_diagonal);
+
+                  if (use_inhomogeneities_for_rhs == true)
+                    global_vector(global_row) +=
+                      average_diagonal *
+                      constraints.get_inhomogeneity(global_row);
+                }
             }
         }
     }

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.