From cb7ac0ef9891f2eb4bae2832f73782bf4f7a03b2 Mon Sep 17 00:00:00 2001 From: bangerth Date: Tue, 4 Sep 2012 13:47:56 +0000 Subject: [PATCH] Make code the same in debug and optimized mode. Otherwise this is a prescription for subtle bugs. git-svn-id: https://svn.dealii.org/trunk@26234 0785d39b-7218-0410-832d-ea1e28bc413d --- .../deal.II/lac/constraint_matrix.templates.h | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/deal.II/include/deal.II/lac/constraint_matrix.templates.h b/deal.II/include/deal.II/lac/constraint_matrix.templates.h index db31f44eb4..970ee190aa 100644 --- a/deal.II/include/deal.II/lac/constraint_matrix.templates.h +++ b/deal.II/include/deal.II/lac/constraint_matrix.templates.h @@ -1455,7 +1455,7 @@ namespace internals // check whether the // constraints are really empty. const unsigned int length = size(); -#ifdef DEBUG + // make sure that we are in the // range of the vector AssertIndexRange (length, total_row_indices.size()+1); @@ -1463,7 +1463,6 @@ namespace internals Assert (total_row_indices[i].constraint_position == numbers::invalid_unsigned_int, ExcInternalError()); -#endif step = length/2; while (step > 0) @@ -1757,25 +1756,20 @@ namespace internals AssertIndexRange (column_end-1, global_rows.size()); const SparsityPattern & sparsity = sparse_matrix->get_sparsity_pattern(); -#ifndef DEBUG + if (sparsity.n_nonzero_elements() == 0) return; -#endif + const std::size_t * row_start = sparsity.get_rowstart_indices(); const unsigned int * sparsity_struct = sparsity.get_column_numbers(); const unsigned int row = global_rows.global_row(i); const unsigned int loc_row = global_rows.local_row(i); -#ifdef DEBUG const unsigned int * col_ptr = sparsity.row_length(row) == 0 ? 0 : &sparsity_struct[row_start[row]]; number * val_ptr = sparsity.row_length(row) == 0 ? 0 : &sparse_matrix->global_entry (row_start[row]); -#else - const unsigned int * col_ptr = &sparsity_struct[row_start[row]]; - number * val_ptr = &sparse_matrix->global_entry (row_start[row]); -#endif const bool optimize_diagonal = sparsity.optimize_diagonal(); unsigned int counter = optimize_diagonal; -- 2.39.5