[petsc-users] Vec Set DM and Mat Set DM

Jed Brown jed at jedbrown.org
Sat Jun 21 17:43:27 CDT 2014


"Sun, Hui" <hus003 at ucsd.edu> writes:

> If I have a DM object with dof=3. So in each grid point, there are 3 components. Now if I set a Mat according to this DM object, I have something like: 
> MatSetValuesStencil(jac,1,&row,5,col,v,INSERT_VALUES);
>
> What shall I put in col? Usually I should have something like: 
> col[0].i = i;   col[0].j = j-1;   col[1].i = i;   col[1].j = j;   etc  ...
>
> But now I want to do something like:
> col[0].i.u = i;   col[0].j.u = j-1;   col[0].i.v = i;   col[0].j.v = j-1;   col[0].i.p = i;   col[0].j.p = j-1;   etc  ...

MatStencil has col[0].c = 0 {1,2,...}, but I recommend using
MatSetValuesBlockedStencil() if possible.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140621/8be040e5/attachment.pgp>


More information about the petsc-users mailing list