Init a (PETSc-) matrix
Hi,
I'm trying to create a sparse matrix that has the same sparsity pattern as a standard mass matrix but which I can't assemble using UFL. When I use uBLASSparseMatrix everything works fine since uBLAS supports random insertion and no sparsity pattern is needed. For PETSc however, I'm currently trying to do the following (where I have given the form "a" generated with ffc in order to provide the sparsity pattern)
PETScMatrix A;
AssemblerBase ab;
ab.init_
The assembly procedure then sets the values using
A.setitem(
and causes the error (during runtime):
*** Error: Unable to successfully call PETSc function 'MatSetValues'.
*** Reason: PETSc error code is: 63.
and more precisely
[0]PETSC ERROR: -------
[0]PETSC ERROR: Argument out of range!
[0]PETSC ERROR: New nonzero at (84,84) caused a malloc!
I should also methion that the size of the matrix is large enough, since A.size(0) and A.size(1) each outputs 289. If I use assemble(A,a) and then A.zero() instead of above code (using init_global_
Thank's for any help!!
PS: During my search I've seen that it might be possible to set the option
MatSetOption(*A, MAT_NEW_
However, since the standard assemble function works, this should be possible to do somehow.
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- DOLFIN Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask jau for more information if necessary.