[petsc-dev] attaching field information to PetscLayout?

Matthew Knepley knepley at gmail.com
Sat May 14 15:13:14 CDT 2011


On Sat, May 14, 2011 at 11:51 AM, Barry Smith <bsmith at mcs.anl.gov> wrote:

>
>    I have a proposal for a moderate/major change for how we handle
> knowledge of subfields/splits in PETSc.
>
>    Currently one can call PCFieldSplitSetIS() or PCFieldSplitSetFields() to
> indicate the splitting of vectors(fields) into subvectors(subfields).  But,
> in fact, the knowledge of what splits make sense really comes in the
> generation of the vectors and matrices and it is bad that the user needs to
> stash that information somewhere and then bring it out and attach it to the
> PCFieldSplit. It is especially annoying if one is using a fieldsplit inside,
> say a multigrid preconditioner, and one has to somehow get that information
> down into the inner PC.
>
>   I propose an alternative. All Vecs and Mats currently have associated
> PetscLayouts and when a Vec or Mat is duplicated the new Vec or Mat has that
> same PetscLayout. I propose each PetscLayout have associated with it an
> optional set of IS indicating the subfields/subvectors (note that this is
> sort of already true when you set a blocksize larger than 1 the PCFieldSplit
> will by default use the strides for subfields). Thus PCFieldSplit can get
> directly from its matrix the appropriate default splits.   Similarly the
> VecStrideXXX() operations can be made more general becoming VecSubVecXXX().
> We also add VecGetSubVec() to get appropriated sized subvectors easily.
>
>   The end result will be a relatively small change in the PETSc API and for
> most users little or absolutely no change, but the power to compose easily
> will really increase.
>
>   Comments, objections, improvements?
>
>    Do this before or after the next release? (I guess the conventional
> wisdom answer would be after?).
>

I have put something a little beyond this into petsc-dev (on my machine),
but it sounds like it could merge in. I need to have an IS pair,
(size, offset) to describe layout. You can use more of these to describe
splitting of fields into subfields (I do) and boundary conditions (if you
want).
I have an FEM example using this for SNES which I will push when I get back.
Its a totally C Sieve DM example using only normal Vecs.

    Matt


>    Barry
>
>
> BTW: It is true that parallel vectors and matrices share the PetscLayout
> from their parent object (via VecDuplicate/MatDuplicate) but this is not
> true to sequential Vec and Mat. Before adding Field information to
> PetscLayouts I would need to change all the sequential duplicates to get a
> reference to their parents PetscLayout instead of creating a new one.
>
>


-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20110514/cb0652d4/attachment.html>


More information about the petsc-dev mailing list