From cd6ba64309264782b970a38c08aea9f50325fad7 Mon Sep 17 00:00:00 2001 From: David Wells Date: Mon, 13 May 2019 10:58:02 -0400 Subject: [PATCH] cppcheck: prefer ++i to i++ --- include/deal.II/lac/sparse_matrix.templates.h | 6 +++--- include/deal.II/lac/trilinos_vector.h | 4 ++-- source/lac/sparsity_pattern.cc | 8 ++++---- source/lac/trilinos_vector.cc | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/deal.II/lac/sparse_matrix.templates.h b/include/deal.II/lac/sparse_matrix.templates.h index d4ae0455fb..76ec303b34 100644 --- a/include/deal.II/lac/sparse_matrix.templates.h +++ b/include/deal.II/lac/sparse_matrix.templates.h @@ -897,7 +897,7 @@ namespace internal for (size_type i = begin_row; i < end_row; ++i) { typename InVector::value_type s = 0; - for (size_type j = rowstart[i]; j < rowstart[i + 1]; j++) + for (size_type j = rowstart[i]; j < rowstart[i + 1]; ++j) s += typename InVector::value_type(values[j]) * v(colnums[j]); norm_sqr += v(i) * @@ -963,7 +963,7 @@ namespace internal for (size_type i = begin_row; i < end_row; ++i) { typename InVector::value_type s = 0; - for (size_type j = rowstart[i]; j < rowstart[i + 1]; j++) + for (size_type j = rowstart[i]; j < rowstart[i + 1]; ++j) s += typename InVector::value_type(values[j]) * v(colnums[j]); norm_sqr += u(i) * @@ -1307,7 +1307,7 @@ namespace internal for (size_type i = begin_row; i < end_row; ++i) { typename OutVector::value_type s = b(i); - for (size_type j = rowstart[i]; j < rowstart[i + 1]; j++) + for (size_type j = rowstart[i]; j < rowstart[i + 1]; ++j) s -= typename OutVector::value_type(values[j]) * u(colnums[j]); dst(i) = s; norm_sqr += diff --git a/include/deal.II/lac/trilinos_vector.h b/include/deal.II/lac/trilinos_vector.h index 95a9a8fdc0..2eb90f7c05 100644 --- a/include/deal.II/lac/trilinos_vector.h +++ b/include/deal.II/lac/trilinos_vector.h @@ -1869,7 +1869,7 @@ namespace TrilinosWrappers // loop over all the elements because // Trilinos does not support lp norms - for (size_type i = 0; i < n_local; i++) + for (size_type i = 0; i < n_local; ++i) sum += std::pow(std::fabs((*vector)[0][i]), p); norm = std::pow(sum, static_cast(1. / p)); @@ -1981,7 +1981,7 @@ namespace TrilinosWrappers AssertIsFinite(s); size_type n_local = local_size(); - for (size_type i = 0; i < n_local; i++) + for (size_type i = 0; i < n_local; ++i) (*vector)[0][i] += s; } diff --git a/source/lac/sparsity_pattern.cc b/source/lac/sparsity_pattern.cc index 0f46463aed..17c1e7de4d 100644 --- a/source/lac/sparsity_pattern.cc +++ b/source/lac/sparsity_pattern.cc @@ -324,7 +324,7 @@ SparsityPattern::reinit(const size_type m, // if diagonal elements are special: let the first entry in each row be the // diagonal value if (store_diagonal_first_in_row) - for (size_type i = 0; i < rows; i++) + for (size_type i = 0; i < rows; ++i) colnums[rowstart[i]] = i; compressed = false; @@ -784,7 +784,7 @@ SparsityPatternBase::exists(const size_type i, const size_type j) const Assert(i < rows, ExcIndexRange(i, 0, rows)); Assert(j < cols, ExcIndexRange(j, 0, cols)); - for (size_type k = rowstart[i]; k < rowstart[i + 1]; k++) + for (size_type k = rowstart[i]; k < rowstart[i + 1]; ++k) { // entry already exists if (colnums[k] == j) @@ -802,7 +802,7 @@ SparsityPatternBase::row_position(const size_type i, const size_type j) const Assert(i < rows, ExcIndexRange(i, 0, rows)); Assert(j < cols, ExcIndexRange(j, 0, cols)); - for (size_type k = rowstart[i]; k < rowstart[i + 1]; k++) + for (size_type k = rowstart[i]; k < rowstart[i + 1]; ++k) { // entry exists if (colnums[k] == j) @@ -856,7 +856,7 @@ SparsityPatternBase::symmetrize() // 2. that the @p{add} function can be called on elements that already exist // without any harm for (size_type row = 0; row < rows; ++row) - for (size_type k = rowstart[row]; k < rowstart[row + 1]; k++) + for (size_type k = rowstart[row]; k < rowstart[row + 1]; ++k) { // check whether we are at the end of the entries of this row. if so, // go to next row diff --git a/source/lac/trilinos_vector.cc b/source/lac/trilinos_vector.cc index 5adf4bb6e3..8a0af6fdc0 100644 --- a/source/lac/trilinos_vector.cc +++ b/source/lac/trilinos_vector.cc @@ -718,7 +718,7 @@ namespace TrilinosWrappers return false; size_type i; - for (i = 0; i < local_size(); i++) + for (i = 0; i < local_size(); ++i) if ((*(v.vector))[0][i] != (*vector)[0][i]) return false; -- 2.39.5