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<const PetscInt *>(col_indices);
+#else
+ if (column_indices.size() < n_cols)
+ column_indices.resize(n_cols);
+
+ for (size_type j=0; j<n_cols; ++j)
+ column_indices[j] = col_indices[j];
+
+ col_index_ptr = &column_indices[0];
+#endif
col_value_ptr = values;
n_columns = n_cols;
}
else
-#endif
{
// Otherwise, extract nonzero values in each row and get the
// respective index.
prepare_action(VectorOperation::add);
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<const PetscInt *>(col_indices);
+#else
+ if (column_indices.size() < n_cols)
+ column_indices.resize(n_cols);
+
+ for (size_type j=0; j<n_cols; ++j)
+ column_indices[j] = col_indices[j];
+
+ col_index_ptr = &column_indices[0];
+#endif
col_value_ptr = values;
n_columns = n_cols;
}
else
-#endif
{
// Otherwise, extract nonzero values in each row and get the
// respective index.