[petsc-users] MATNEST with shell matrices

Jed Brown jedbrown at mcs.anl.gov
Thu Feb 21 17:33:03 CST 2013


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

> Sorry I couldn't jump in earlier --- I had a proposal going out today and
> am just now catching up on other email.
>
> Amneet is trying to solve a system the couples together some field data
> that is described using SAMRAI data structures along with particles that
> are stored in a standard PETSc Vec.  The hook between the SAMRAI data and
> PETSc is via a version of Bobby Philip's SAMRAI-to-PETSc interface that
> I've bastardized for my own purposes.  There is no support for
> {Mat,Vec}SetValues here --- the wrapper just provides standard vector space
> operations required by Krylov and Newton-Krylov solvers.
>

Boyce, thanks for explaining. We *always* need to know this sort of
background in order to make useful suggestions.


>
> I used to have some code to make collections of Mat's and Vec's to make it
> feasible to solve systems involving both native and non-native PETSc data
> structures.  (It was similar to some code for making Vec's of Vec's that
> someone --- Dave May? --- used to maintain.)  I ripped this stuff out of my
> code a while ago, and I suggested that Amneet investigate {Vec,Mat}Nest
> before we tried to resurrect that old code.
>

That was called PetscExt. Dave and I wrote MatNest out of desire to do the
sort of things that PetscExt did in a way that was more flexible and would
interoperate better with the rest of PETSc. It, and PCFieldSplit should be
a complete replacement for anything you might have used PetscExt for in the
past.

If you already have MatShells around for all the blocks, you can easily
wire them together with MatNest.

Note that MatNest does *not* depend on VecNest, and in general, I recommend
not using VecNest. If you call VecGetSubVector() with a contiguous index
set, you'll get a subvec back without a copy. This means that your residual
evaluation only needs to provide a map from your non-contiguous local
representation to a contiguous global representation. This should be no
overhead and will interoperate better.

But if you really want to use those other vector space wrappers, you can
use VecNest.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130221/42e57ddc/attachment-0001.html>


More information about the petsc-users mailing list