From: Wolfgang Bangerth Date: Mon, 31 Aug 2020 03:10:21 +0000 (-0600) Subject: Attempt to work around a compiler warning. X-Git-Tag: v9.3.0-rc1~1159^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=55281a85e79f1228617d9bcd50f04181bc7bff51;p=dealii.git Attempt to work around a compiler warning. --- diff --git a/include/deal.II/lac/affine_constraints.templates.h b/include/deal.II/lac/affine_constraints.templates.h index 7e558104f5..a9f0bfcc1e 100644 --- a/include/deal.II/lac/affine_constraints.templates.h +++ b/include/deal.II/lac/affine_constraints.templates.h @@ -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); + } } } }