[petsc-users] MatSetValues vs MatSetValuesBlocked

Nidish nb25 at rice.edu
Mon Aug 10 15:26:33 CDT 2020


Hello,

I've written a basic FE code of an Euler-Bernoulli Beam (4th order 
spatial deriv interpolated using Hermite elements).

While assembling matrices I noticed something peculiar - if I conducted 
assembly using MatSetValues it works, while if I did so using 
MatSetValuesBlocked it throws me an argument out of range error. You can 
observe this in the attached file in lines 94-95 where I have one 
version commented out and the other version active.

I.O.W., using
     MatSetValues(jac, 4, (const PetscInt*)idx, 4, (const 
PetscInt*)idx,(const PetscScalar*)elstiff, ADD_VALUES);
works, while
     MatSetValuesBlocked(jac, 4, (const PetscInt*)idx, 4, (const 
PetscInt*)idx,(const PetscScalar*)elstiff, ADD_VALUES);
does NOT work.

Also from the documentation I could not really understand what the 
difference was between these two.

Thank you,
Nidish
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fe1dbeam.c
Type: text/x-csrc
Size: 2980 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200810/553a4a2d/attachment.bin>


More information about the petsc-users mailing list