[petsc-users] [PATCH 2/2] Call KSPSetFromOptions before setting fieldsplit-specific options

Umut Tabak u.tabak at tudelft.nl
Sun Sep 8 09:09:28 CDT 2013


On 09/08/2013 03:57 PM, Jed Brown wrote:
>
> In the second call, ISCreateBlock looks at the array of block indices of
> length n2 starting from inputindices+n1.  That references
> inputindices[n1], which is off the end of the array you created above.
> Simply extending that array won't work either because you can't describe
> the starting point correctly for one "block" of different length.  I.e.,
> if inputindices[1] == 1, then the second call above would be creating
> the index set
>
>    {sz2, sz2+1,..., 2*sz2-1}
>
> This should be obvious if you look at ISView().
Yes, but then there is a problem with my understanding of the block 
structure.

What I would like to do at the end is to create a first block of size 
1490 and then create a block of size 2432 and stack these. This is how 
the original system is built up.

Of what if I use the below code,

PetscInt sz1 = 1490, sz2 = 2432;

   /* ----- */

   PetscInt n1=1, n2=1,
       inputindices1[]={0}, inputindices2[]={1}; /* block size is 2 */

   ISCreateBlock(PETSC_COMM_SELF,sz1,n1,inputindices1,
                 PETSC_COPY_VALUES,&is_row1);
   ISCreateBlock(PETSC_COMM_SELF,sz2,n2,inputindices2,
                 PETSC_COPY_VALUES,&is_row2);

Because if I look at

http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/IS/ISCreateBlock.html

I am getting the impression that bs and n are the same and on top idx is 
the global block number of the large matrix blocks.

I will look at the below option in a minute.
>
> If your vectors are ordered so that the blocks are separate and
> contiguous (as opposed to interlaced in some way), I suggest using
>
>    ISCreateStride(PETSC_COMM_SELF,sz1,0,1,&is_row1);
>    ISCreateStride(PETSC_COMM_SELF,sz2,sz1,1,is_row2);



More information about the petsc-users mailing list