[petsc-users] MatSetValuesStencil correct usage

iwaddington . iwaddington at gmail.com
Wed Nov 13 15:39:15 CST 2013


Thanks very much, now I get it.


On Wed, Nov 13, 2013 at 6:34 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:

>
> On Nov 13, 2013, at 2:20 PM, iwaddington . <iwaddington at gmail.com> wrote:
>
> >   Hi everyone, I am having trouble understanding the usage of
> MatSetValuesStencil. My doubt is in the roles played by the arguments idxm
> and idxn, which are passed as arguments according to the function
> documentation. For example, as I was reading example file
> > "src/ksp/ksp/examples/tutorials/ex32.c.html" line 191 I was wondering,
> ok, we want to insert a 1x5 submatrix inside our global matrix, and we
> somehow have to pass the grid coordinates of the points we want to insert,
> so why is the "row" variable needed, the "col" vector seems to contain all
> the grid coordinates of all the 5 points we are inserting.
> \
>    The col vector only contains the grid coordinates (i,j,k,color) of the
> 5 columns of the matrix. The row contains the grid coordinates of the
> single row.
>
>    The i,j,k,color get mapped to a single location in a vector. Every
> entry in a matrix has TWO single coordinates into a vector: the I,J
> coordinates in matrix. So
>
>     the row i,j,k,color -> I and a column i,j,k,color coordinate -> J.
>
>    Barry
>
> >   I know this doubt will sound trivial to some of you, but I am learning
> Petsc all by myself, so any help is very much appreciated.
> >
> >   Thanks a lot.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20131113/8ea4246b/attachment.html>


More information about the petsc-users mailing list