[petsc-users] MATNEST with shell matrices

Jed Brown jedbrown at mcs.anl.gov
Thu Feb 21 18:31:48 CST 2013


On Thu, Feb 21, 2013 at 6:22 PM, Boyce Griffith <griffith at cims.nyu.edu>wrote:

> For better or for worse, the "size" of the wrapped data can change
> dynamically.
>

Then your operators are not linear.

If you are in a Vec implementation, you should be able to
PetscLayoutSetSize(vec->map,newN).

Changing the size dynamically without telling anyone is dangerous in the
sense that it violates the API so you're totally on your own if it's
breaking. Many things will work, but when I write software, I like to write
it so that it works because it's correct, not just so that it works on my
machine with a specific compiler, etc. If you want your code to work
because it's correct, then you should only change the size at well-defined
places,  call KSPReset() or whatever, and generally follow the API.


>  Somehow it seems less dishonest to set the size to 0 instead of, e.g., 1.
>  At least when you get 0 you know that the size is bogus!  :-)  We've been
> using this stuff for ... a while now, and it hasn't caused any problems.
>
> That said, I would prefer to have tighter integration with PETSc.  I think
> that DMComposite is what I was thinking might work.
>

DMComposite is sort of tied to contiguous memory. In its current form,
you'd have to implement VecGetArray() and VecPlaceArray().
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130221/d0dde6a1/attachment-0001.html>


More information about the petsc-users mailing list