[petsc-users] A question of VecSetValues
Hong Zhang
hzhang at mcs.anl.gov
Fri Feb 15 11:08:12 CST 2013
Yonghui :
...
ierr = VecSet(x,one);CHKERRQ(ierr); // set x= [ 1, 1, 1, 1, 1, 1]
RANK 0:
do 100 i=0,N-1 (N=6)
^
call VecSetValues(x,1,i,1,ADD_VALUES,ierr)
100 continue
// x = [2, 2, 2, 2, 2, 2]
RANK 1:
do 100 i=0,N-2
^
call VecSetValues(x,1,i,1,ADD_VALUES,ierr)
100 continue
// x = [3, 3, 3, 3, 3, 2]
RANK 2:
do 100 i=0,N-3
^
call VecSetValues(x,1,i,1,ADD_VALUES,ierr)
100 continue
// x = [4, 4, 4, 4, 3, 2]
Hong
> Dear PESTc users,
>
>
>
> I don’t understand VecSetValues very well. I compiled ex2 and run with
> mpiexec –n 3. I got result like this:
>
>
>
> Vector Object: 3 MPI processes
>
> type: mpi
>
> Process [0]
>
> 4
>
> Process [1]
>
> 4
>
> 4
>
> Process [2]
>
> 4
>
> 3
>
> 2
>
>
>
> Here is how I am comfused:
>
> RANK 0:
>
> do 100 i=0,0
>
> call VecSetValues(x,1,i,1,ADD_VALUES,ierr)
>
> 100 continue
>
>
>
> RANK 1:
>
> do 100 i=0,1
>
> call VecSetValues(x,1,i,1,ADD_VALUES,ierr)
>
> 100 continue
>
>
>
> RANK 2:
>
> do 100 i=0,2
>
> call VecSetValues(x,1,i,1,ADD_VALUES,ierr)
>
> 100 continue
>
>
>
> I don’t see any clue for getting the result above. Please show me how it
> works! Thanks.
More information about the petsc-users
mailing list