[petsc-users] On the usage of MatSetValuesBlocked

Barry Smith bsmith at petsc.dev
Fri Nov 4 10:44:55 CDT 2022



> On Nov 4, 2022, at 6:55 AM, Edoardo alinovi <edoardo.alinovi at gmail.com> wrote:
> 
> Thanks Matt,
> 
> I have found out that setValuesblocked will work if I do:
> 
> call MatCreateVecs(A, x, y, ierr)
> call setValuesBlocked(x, nblocks, varray, ierr) 

  Ah, likely the block size for the vector was not correct, leading to the memory corruption. MatCreateVecs() creates a vector compatible with the matrix, same block size and parallel layout so you don't need to worry about setting those values yourself.

  Barry

> 
> However, there is nogetValuesBlocked. Not the end of the world, it is handy to set and get stuff by block and not by single entry :)
> 
> Cheers



More information about the petsc-users mailing list