From 958e5a7d1dc13e6befc76e86b37a34f95284894c Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Thu, 27 Apr 2017 00:42:58 +0200 Subject: [PATCH] Fix PETScWrappers::MatrixBase::set for 64bit indices and complex scalar type --- include/deal.II/lac/petsc_matrix_base.h | 34 +++++++++++++++++-------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/include/deal.II/lac/petsc_matrix_base.h b/include/deal.II/lac/petsc_matrix_base.h index 5cbcfb16c1..a1f25a63cb 100644 --- a/include/deal.II/lac/petsc_matrix_base.h +++ b/include/deal.II/lac/petsc_matrix_base.h @@ -1208,26 +1208,32 @@ namespace PETScWrappers const PetscScalar *values, const bool elide_zero_values) { - (void)elide_zero_values; - prepare_action(VectorOperation::insert); const PetscInt petsc_i = row; - PetscInt *col_index_ptr; + PetscInt const *col_index_ptr; PetscScalar const *col_value_ptr; int n_columns; // If we don't elide zeros, the pointers are already available... -#ifndef PETSC_USE_64BIT_INDICES if (elide_zero_values == false) { - col_index_ptr = (int *)col_indices; +#ifndef PETSC_USE_64BIT_INDICES + col_index_ptr = reinterpret_cast(col_indices); +#else + if (column_indices.size() < n_cols) + column_indices.resize(n_cols); + + for (size_type j=0; j(col_indices); +#else + if (column_indices.size() < n_cols) + column_indices.resize(n_cols); + + for (size_type j=0; j