[petsc-users] Scatter context for MatMult

John Fettig john.fettig at gmail.com
Fri Aug 17 15:06:38 CDT 2012


Thanks for your help!

John

On Fri, Aug 17, 2012 at 2:59 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
> On Fri, Aug 17, 2012 at 1:48 PM, John Fettig <john.fettig at gmail.com> wrote:
>>
>> On Fri, Aug 17, 2012 at 2:33 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
>> > Why do you want raw access?
>>
>> I'm trying to write my own RAP operator for AMG.
>>
>> > If you really need, you can either use MatMPIAIJGetSeqAIJ() or just
>> > include
>> > the private header.
>>
>> I presume you mean MatMPIAIJGetLocalMat.  This isn't quite what I
>> want.  I don't want the local matrix, I want to scatter a vector
>> according to the ghost values defined by the sparsity pattern of the
>> parallel matrix.
>
>
> PetscErrorCode  MatMPIAIJGetSeqAIJ(Mat A,Mat *Ad,Mat *Ao,PetscInt **colmap);
>
> But if you are writing an RAP, you should just include
> src/mat/impls/aij/mpi/mpiaij.h. You can set your implementation on an
> existing matrix using MatShellSetOperation(A, MATOP_PTAP,
> (void(*)(void))YourPtAPFunction).
>
>>
>> Could you give me a little more help with using the latter?  I see
>>
>> VecScatterBegin(a->Mvctx,xx,a->lvec,INSERT_VALUES,SCATTER_FORWARD);
>> (*a->A->ops->mult)(a->A,xx,yy);
>> VecScatterEnd(a->Mvctx,xx,a->lvec,INSERT_VALUES,SCATTER_FORWARD);
>> (*a->B->ops->multadd)(a->B,a->lvec,yy,yy);
>>
>>
>> So I guess a->Mvctx is what I want.  How do I figure out the mapping
>> of indices in a->lvec?
>
>
> a->garray. MatPtAP is not an easy operation to write. You'll have to get
> comfortable with diving into the source to understand what's happening.
>
>
>>
>>
>> John
>
>


More information about the petsc-users mailing list