[petsc-users] VecStrideScatter question

Tabrez Ali stali at geology.wisc.edu
Wed May 15 10:26:16 CDT 2013


The error message (with stride of 2) is

[1]PETSC ERROR: --------------------- Error Message 
------------------------------------
[1]PETSC ERROR: Argument out of range!
[1]PETSC ERROR: Start of stride subvector (2) is too large for stride
  Have you set the vector blocksize (1) correctly with VecSetBlockSize()?!
[1]PETSC ERROR: 
------------------------------------------------------------------------

Do I have to use VecSetBlockSize as done in 
http://www.mcs.anl.gov/petsc/petsc-current/src/vec/vec/examples/tutorials/ex12.c.html

Actually my V1 (12 entries) and V2 (3 entries) are like

V1=[u1 v1 w1 u2 v2 w2 u3 v3 w3 a b c]' and

V2=[      x1       x2       x3      ]' what I eventually want is

V1=[u1 v1 w1+x1 u2 v2 w2+x2 u3 v3 w3+x3 a b c]

Would the [a b c] at the end of V1 cause problems?

Tabrez


On 05/15/2013 09:46 AM, Jed Brown wrote:
> Tabrez Ali<stali at geology.wisc.edu>  writes:
>
>> Hello
>>
>> I have two parallel vectors (same layout) of different lengths, e.g.,
>>
>> V1=[u1 v1 w1 u2 v2 w2 u3 v3 w3]' and
>> V2=[x1 x2 x3]'
>>
>> and I wish to add them in a way such that
>>
>> V3=[
>> u1
>> v1
>> w1+x1
>> u2
>> v2
>> w2+x2
>> u3
>> v3
>> w3+x3
>> ]
>>
>> Is VecStrideScatter appropriate for this? I tried
>>
>> call VecStrideScatter(V2,3,V1,Add_Values,ierr)
>>
>> but it seems to fail.
> "seems to fail" is not helpful, but in any case, the indexing starts at
> 0 (so pass 2 instead of 3).


-- 
No one trusts a model except the one who wrote it; Everyone trusts an observation except the one who made it- Harlow Shapley



More information about the petsc-users mailing list