[petsc-users] Insert values into matrix using MatSetValuesStencil or MatSetValuesLocal
Matthew Knepley
knepley at gmail.com
Mon Aug 24 21:11:29 CDT 2015
On Mon, Aug 24, 2015 at 9:01 PM, Wee Beng Tay <zonexo at gmail.com> wrote:
>
>
> Sent using CloudMagic
> <https://cloudmagic.com/k/d/mailapp?ct=pa&cv=7.2.9&pv=5.0.2>
> On Mon, Aug 24, 2015 at 6:21 PM, Matthew Knepley <knepley at gmail.com>
> wrote:
>
> 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.
>
>
> So MatSetValuesStencil() takes global vertex numbers. Do you mean the
> natural or petsc ordering?
>
There is no PETSc ordering for vertices, only the natural ordering.
Thanks,
Matt
> 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
>
>
--
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/dd035139/attachment.html>
More information about the petsc-users
mailing list