[petsc-users] preallocation after DMCreateMatrix?

Matthew Knepley knepley at gmail.com
Fri Nov 24 19:05:39 CST 2017


On Fri, Nov 24, 2017 at 4:21 PM, Matteo Semplice <matteo.semplice at unito.it>
wrote:

> Hi.
>
> The manual for DMCreateMatrix says "Notes: This properly preallocates the
> number of nonzeros in the sparse matrix so you do not need to do it
> yourself", so I got the impression that one does not need to call the
> preallocation routine for the matrix and indeed in most examples listed in
> the manual page for DMCreateMatrix this is not done or (KSP tutorial ex4)
> it is called declaring 0 entries per row.
>
> However, if read in a mesh in a DMPlex ore create a DMDA and then call
> DMCreateMatrix, the resulting matrix errors out when I call MatSetValues. I
> have currently followed the suggestion of the error message and call
> MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE), but I'd
> like to fix this properly.
>

It sounds like your nonzero pattern does not obey the topology. What
nonzero pattern are you trying to input?

  Thanks,

     Matt


> How should I interpret that note in the manual?
>
> Thanks,
>
>     Matteo
>
>


-- 
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

https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20171124/e0e66ed9/attachment-0001.html>


More information about the petsc-users mailing list