From: Wolfgang Bangerth Date: Tue, 24 Mar 2015 02:39:26 +0000 (-0500) Subject: Ensure that the body of the check_* function is only visible in debug X-Git-Tag: v8.3.0-rc1~361^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=048a8a117c4f8243bf81837a3527794fa78f4a5a;p=dealii.git Ensure that the body of the check_* function is only visible in debug mode. Rename it to AssertNoZerosOnDiagonal to make its purpose clearer. --- diff --git a/include/deal.II/lac/sparse_matrix.templates.h b/include/deal.II/lac/sparse_matrix.templates.h index 94a0bebc29..a912d13c43 100644 --- a/include/deal.II/lac/sparse_matrix.templates.h +++ b/include/deal.II/lac/sparse_matrix.templates.h @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 1999 - 2014 by the deal.II authors +// Copyright (C) 1999 - 2015 by the deal.II authors // // This file is part of the deal.II library. // @@ -1316,9 +1316,12 @@ SparseMatrix::residual (Vector &dst, namespace { + // assert that the matrix has no zeros on the diagonal. this is important + // for preconditioners such as Jacobi or SSOR template - void check_nonzero_diagonal (const SparseMatrix &matrix) + void AssertNoZerosOnDiagonal (const SparseMatrix &matrix) { +#ifdef DEBUG for (typename SparseMatrix::size_type row=0; row::precondition_Jacobi (Vector &dst, AssertDimension (dst.size(), n()); AssertDimension (src.size(), n()); - check_nonzero_diagonal(*this); + AssertNoZerosOnDiagonal(*this); const size_type n = src.size(); somenumber *dst_ptr = dst.begin(); @@ -1398,7 +1402,7 @@ SparseMatrix::precondition_SSOR (Vector &dst, AssertDimension (dst.size(), n()); AssertDimension (src.size(), n()); - check_nonzero_diagonal(*this); + AssertNoZerosOnDiagonal(*this); const size_type n = src.size(); const std::size_t *rowstart_ptr = &cols->rowstart[0]; @@ -1550,7 +1554,7 @@ SparseMatrix::SOR (Vector &dst, AssertDimension (m(), n()); AssertDimension (dst.size(), n()); - check_nonzero_diagonal(*this); + AssertNoZerosOnDiagonal(*this); for (size_type row=0; row::TSOR (Vector &dst, AssertDimension (m(), n()); AssertDimension (dst.size(), n()); - check_nonzero_diagonal(*this); + AssertNoZerosOnDiagonal(*this); size_type row=m()-1; while (true) @@ -1616,7 +1620,7 @@ SparseMatrix::PSOR (Vector &dst, Assert (m() == inverse_permutation.size(), ExcDimensionMismatch(m(), inverse_permutation.size())); - check_nonzero_diagonal(*this); + AssertNoZerosOnDiagonal(*this); for (size_type urow=0; urow::TPSOR (Vector &dst, Assert (m() == inverse_permutation.size(), ExcDimensionMismatch(m(), inverse_permutation.size())); - check_nonzero_diagonal(*this); + AssertNoZerosOnDiagonal(*this); for (size_type urow=m(); urow != 0;) { @@ -1719,7 +1723,7 @@ SparseMatrix::SOR_step (Vector &v, Assert (m() == v.size(), ExcDimensionMismatch(m(),v.size())); Assert (m() == b.size(), ExcDimensionMismatch(m(),b.size())); - check_nonzero_diagonal(*this); + AssertNoZerosOnDiagonal(*this); for (size_type row=0; row::TSOR_step (Vector &v, Assert (m() == v.size(), ExcDimensionMismatch(m(),v.size())); Assert (m() == b.size(), ExcDimensionMismatch(m(),b.size())); - check_nonzero_diagonal(*this); + AssertNoZerosOnDiagonal(*this); for (int row=m()-1; row>=0; --row) { @@ -1789,7 +1793,7 @@ SparseMatrix::SSOR (Vector &dst, AssertDimension (m(), n()); Assert (m() == dst.size(), ExcDimensionMismatch(m(),dst.size())); - check_nonzero_diagonal(*this); + AssertNoZerosOnDiagonal(*this); const size_type n = dst.size(); size_type j;