151 const std::vector<size_type> &row_lengths,
152 const bool is_symmetric)
159 const std::vector<PetscInt> int_row_lengths(row_lengths.begin(),
162 const PetscErrorCode ierr = MatCreateSeqAIJ(
163 PETSC_COMM_SELF,
m,
n, 0, int_row_lengths.data(), &
matrix);
178 const bool preset_nonzero_locations)
183 sparsity_pattern.n_rows());
185 sparsity_pattern.n_cols());
187 std::vector<size_type> row_lengths(sparsity_pattern.n_rows());
188 for (
size_type i = 0; i < sparsity_pattern.n_rows(); ++i)
189 row_lengths[i] = sparsity_pattern.row_length(i);
192 sparsity_pattern.n_cols(),
209 if (preset_nonzero_locations ==
true)
211 std::vector<PetscInt> row_entries;
212 std::vector<PetscScalar> row_values;
213 for (
size_type i = 0; i < sparsity_pattern.n_rows(); ++i)
215 row_entries.resize(row_lengths[i]);
216 row_values.resize(row_lengths[i]);
217 for (
size_type j = 0; j < row_lengths[i]; ++j)
220 static_cast<PetscInt
>(sparsity_pattern.column_number(i, j));
221 row_entries[j] = petsc_j;
224 const auto petsc_i =
static_cast<PetscInt
>(i);
225 const PetscErrorCode ierr = MatSetValues(
matrix,