[petsc-users] Insert values into matrix using MatSetValuesStencil or MatSetValuesLocal

Matthew Knepley knepley at gmail.com
Mon Aug 24 05:21:21 CDT 2015


On Mon, Aug 24, 2015 at 4:09 AM, Wee-Beng Tay <zonexo at gmail.com> wrote:

> Hi,
>
> I'm modifying my 3d fortran code from MPI along 1 direction (z) to MPI
> along 2 directions (y,z)
>
> Previously I was using MatSetValues with global indices. However, now I'm
> using DM and global indices is much more difficult.
>
> I come across MatSetValuesStencil or MatSetValuesLocal.
>
> So what's the difference bet the one since they both seem to work locally?
>

No. MatSetValuesLocal() takes local indices. MatSetValuesStencil() takes
global vertex numbers.


> Which is a simpler/better option?
>

MatSetValuesStencil()


> Is there an example in Fortran for MatSetValuesStencil?
>

Timothée Nicolas shows one in his reply.

Do I also need to use DMDAGetAO together with MatSetValuesStencil or
> MatSetValuesLocal?
>

No.

  Thanks,

     Matt


> Thanks!
>



-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150824/35e8b8c3/attachment.html>


More information about the petsc-users mailing list