Feng  Shi <[email protected]> writes:

> Hi Jed,
>
> Thank you very much!
>
> I think I understand that now. It's really helpful to me and other beginners 
> who will use Finite Difference with Petsc in solving 2-D and 3-D problems. 
> Thank you.
>
> row.i=i, row.j=j, row.k=k and col[1:7].i=i,i+/-1, col[1:7].j=j,j+/-1,
> col[1:7].k=k,k+/-1. 

Note that it's really col[0] through col[6].

> then call: MatSetValuesBlockedStencil(B,1,&row, 7, &col,
> &Value[0][0],INSERT_VALUES); where Value[][] should be an array with
> 7*36=252 elements.

Yes.  If it makes the indexing more clear, you can use

PetscScalar Value[1][bs][7][bs];

there is only one row and the columns are laid out as above (same as is
most natural for a scalar problem).

Attachment: pgpTOw6ZPe4qe.pgp
Description: PGP signature

Reply via email to