How to copy global data to local ?

Dave May dave.mayhem23 at gmail.com
Tue Dec 1 01:38:06 CST 2009


If the rows you want on each processor are local to this processor, why not
try using MatGetRow().

http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatGetRow.html




On Tue, Dec 1, 2009 at 6:21 AM, ming zhu <foolishzhu at yahoo.com.cn> wrote:

> Hi
> I have a huge matrix U for all processors (PETSC_COMM_WORLD). I only want
> to copy only two rows (i,j) for each local processor. i,j is different for
> each processor and not related to rank.  I was trying to use a vector filter
> (like, 00000010000). However, if the vector is PETSC_COMM_WORLD, it will be
> changed by different processor. So, how to make it ?
> Thank you
>
> My original code is
>
> Vec filter
> VecCreate(PETSC_COMM_WORLD,&filter);
> VecSetsizes(filter,PETSC_DECIDE,m);
> VecSetFromOptions(filter);
>
> Vecset(filter,0);
> VecSetValue(filter,i,1,INSERT_VALUES);
>
> ...
> MatMult(U, filter,ui);
>
> If I create filter with PETSC_COMM_SELF, it is impossible for U and filter
> to multiply.
>
>
>
>
>
> ------------------------------
> 好玩贺卡等你发,邮箱贺卡全新上线!<http://cn.rd.yahoo.com/mail_cn/tagline/card/*http://card.mail.cn.yahoo.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20091201/bde08404/attachment.htm>


More information about the petsc-users mailing list