[petsc-users] [PATCH 2/2] Call KSPSetFromOptions before setting fieldsplit-specific options
Jed Brown
jedbrown at mcs.anl.gov
Sun Sep 8 08:57:55 CDT 2013
Umut Tabak <u.tabak at tudelft.nl> writes:
> On 09/08/2013 03:45 PM, Jed Brown wrote:
>>
>> This is an invalid memory access and does not use ISCreateBlock correctly.
>>
>> PetscInt sz1 = 1490, sz2 = 2432;
>>
>> PetscInt bs = 2, n1=1, n2=1, inputindices[]={0}; /* block size is 2 */
>>
>> ISCreateBlock(PETSC_COMM_SELF,sz1,n1,inputindices,
>> PETSC_COPY_VALUES,&is_row1);
>> ISCreateBlock(PETSC_COMM_SELF,sz2,n2,inputindices+n1,
>> PETSC_COPY_VALUES,&is_row2);
> Ok, I am trying to understand what my mistake is.
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().
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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130908/3c702bfb/attachment.pgp>
More information about the petsc-users
mailing list