From: Daniel Arndt Date: Wed, 26 Apr 2017 22:42:58 +0000 (+0200) Subject: Fix PETScWrappers::MatrixBase::set for 64bit indices and complex scalar type X-Git-Tag: v9.0.0-rc1~1639^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=958e5a7d1dc13e6befc76e86b37a34f95284894c;p=dealii.git Fix PETScWrappers::MatrixBase::set for 64bit indices and complex scalar type --- 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