Hi all, I need to manually create a PETSc sparsity matrix (not the system matrix) in parallel computing for other purposes. I only know the number of nonzero values per row before I initialize the sparsity matrix. Thus I use the following codes to initialize the PETSc sparsity matrix and add entries to this matrix:
SparsityPattern sparsity_pattern; sparsity_pattern.reinit(dof_handler_DG.n_dofs(), dof_handler_DG.n_dofs(), n_nonzero_per_row); sparsity_pattern.compress(); filter_matrix.reinit( locally_owned_dofs_DG, locally_owned_dofs_DG, sparsity_pattern, mpi_communicator); ... filter_matrix.add(current_dof_index, col_indices, weights); Then I got the following errors: *[0]PETSC ERROR: Argument out of range[0]PETSC ERROR: Inserting a new nonzero at global row/column (0, 1) into matrix* I guess it may be caused by the improperly settings of the sparsity pattern. How can I correct these errors, and should I use dynamic sparsity pattern or just the SparsityPattern? Any help will be appreciated. -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to dealii+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.