On Fri, Feb 10, 2012 at 12:01 AM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
> On Thu, Feb 9, 2012 at 23:55, Dmitry Karpeev <karpeev at mcs.anl.gov> wrote: > >> In a somewhat related matter, it appears that I cannot duplicate a >> preallocated MATXXXAIJ until it has been assembled: >> if my DM implementation keeps a preallocated MATSEQAIJ, which it wants to >> duplicate on every call to DMGetMatrix, >> it would have to put in fake entries before any duplication is possible. >> > > Doesn't it already do this (inserting 0)? > I don't think so. Preallocating doesn't set any values and seems to leave the matrix marked !assembled. MatDuplicate for such a matrix will fail. Assemblying it before setting values (just to force an assembled flag) will squeeze out the extra values, won't it? I think it would just be reasonable to allow to duplicate unassembled matrices, or, better yet, have a matrix be "assembled" by default until MatSetValues has been called. But I'm not sure whether either solution will break something else. Dmitry. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120210/90b2d398/attachment.html>
