[petsc-dev] [petsc-users] How to create and assemble matrices for DA vectors??
Jed Brown
jed at 59A2.org
Thu Apr 21 06:07:36 CDT 2011
2011/4/21 Алексей Рязанов <ram at ibrae.ac.ru>
> I think I understand this now. But it seems strange that the DA*Get*Matrix
> procedure *creates* the matrix and I need call the MatDestroy after the
> "get" proceure to properly free the memory.
>
Indeed, it should be named DACreateMatrix().
@petsc-dev
This comes up way too often and we've all agreed that it should change.
Let's do it before 3.2 is released. In what other cases does the following
model not hold?
1. XCreateY(X,...,&Y); user has ownership to the new Y and should destroy
with YDestroy(Y)
2. XGetY(X,...,&Y); user has a "cheap" reference to an object owned by X,
reference count is not incremented, no need to do anything when the user is
done with Y
3. XGetY(X,...,&Y); the new Y may require setup or other resources, user
calls XRestoreY(X,...,&Y) when they are finished with Y
I wish there was a nice naming convention to distinguish 2 from 3, but I
think we should shoot for no exceptions to following 1 versus (2,3).
What about MatGetSubMatrix()? For internal use, e.g. in PCFieldSplit, I
think that model 3 would be better because it exposes more optimizations
when assembly is lagged.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20110421/906cac20/attachment.html>
More information about the petsc-dev
mailing list