From 08ee874abc0fee4b8222a80632f6606a293f57cf Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Wed, 15 Sep 2021 12:56:05 -0400 Subject: [PATCH] Fix zero comparison --- source/numerics/matrix_tools.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/source/numerics/matrix_tools.cc b/source/numerics/matrix_tools.cc index 8a7d3b60fe..4aded6ad24 100644 --- a/source/numerics/matrix_tools.cc +++ b/source/numerics/matrix_tools.cc @@ -282,7 +282,7 @@ namespace MatrixTools { for (unsigned int i = 0; i < matrix.block(diag_block, diag_block).n(); ++i) - if (matrix.block(diag_block, diag_block).diag_element(i) != 0) + if (matrix.block(diag_block, diag_block).diag_element(i) != number{}) { first_nonzero_diagonal_entry = matrix.block(diag_block, diag_block).diag_element(i); @@ -291,12 +291,12 @@ namespace MatrixTools // check whether we have found // something in the present // block - if (first_nonzero_diagonal_entry != 0) + if (first_nonzero_diagonal_entry != number{}) break; } // nothing found on all diagonal // blocks? if so, use 1.0 instead - if (first_nonzero_diagonal_entry == 0) + if (first_nonzero_diagonal_entry == number{}) first_nonzero_diagonal_entry = 1; @@ -361,7 +361,7 @@ namespace MatrixTools // the gauss step more efficient number new_rhs; if (matrix.block(block_index.first, block_index.first) - .diag_element(block_index.second) != 0.0) + .diag_element(block_index.second) != number{}) new_rhs = dof->second * matrix.block(block_index.first, block_index.first) .diag_element(block_index.second); @@ -563,15 +563,15 @@ namespace MatrixTools // everything remains positive, or // by the average diagonal value if // zero - if (local_matrix(i, i) == 0.) + if (local_matrix(i, i) == number{}) { // if average diagonal hasn't // yet been computed, do so now - if (average_diagonal == 0.) + if (average_diagonal == number{}) { unsigned int nonzero_diagonals = 0; for (unsigned int k = 0; k < n_local_dofs; ++k) - if (local_matrix(k, k) != 0.) + if (local_matrix(k, k) != number{}) { average_diagonal += std::fabs(local_matrix(k, k)); ++nonzero_diagonals; @@ -585,7 +585,7 @@ namespace MatrixTools // only if all diagonal entries // are zero, then resort to the // last measure: choose one - if (average_diagonal == 0.) + if (average_diagonal == number{}) average_diagonal = 1.; local_matrix(i, i) = average_diagonal; -- 2.39.5