EXTERNAL: Re: MatGetArray() not supporting Mat type mpiaij.

Barry Smith bsmith at mcs.anl.gov
Wed Jun 4 09:30:20 CDT 2008


    Stephan,

    For all built in PETSc matrix types, the rows are stored  
contiguously so
you can use MatGetOwnershipRange() to get the global indices for the  
local
rows and thus call MatGetRow().

    Barry


On Jun 4, 2008, at 6:33 AM, Stephen R Ball wrote:

> Ok, I am looking into using MatGetRow(). However this requires the
> global row number for input. I was looking to use  
> MatGetOwnershipRange()
> to obtain the range of global row numbers owned by each processor but
> the documentation states that this routine assumes that the matrix is
> laid out with the first n1 rows on the first processor, the next n2  
> rows
> on the second, etc and that for certain parallel layouts this range  
> may
> not be well defined.
>
> This is the case for me. Do you have a routine where I can specify a
> global row number and it will tell me the rank of the processor that
> owns it? This is to ensure that MatGetRow() only gets called by the
> owner processor for each global row number.
>
> Regards
>
> Stephen
>
>
> -----Original Message-----
> From: owner-petsc-users at mcs.anl.gov
> [mailto:owner-petsc-users at mcs.anl.gov] On Behalf Of Matthew Knepley
> Sent: 03 June 2008 15:29
> To: petsc-users at mcs.anl.gov
> Subject: EXTERNAL: Re: MatGetArray() not supporting Mat type mpiaij.
>
> On Tue, Jun 3, 2008 at 8:11 AM, Stephen R Ball
> <Stephen.R.Ball at awe.co.uk> wrote:
>> Hi
>>
>> I have been trying to extract an array containing the local matrix
>> values using MatGetArray() via the Fortran interface but get the  
>> error
>> message that Mat type mpiaij is not supported with this routine.  
>> All I
>> want to do is to extract the local matrix values so that I can output
>> them to file in the format I want rather than via use of the  
>> MatView()
>> routine. Can you suggest a way of how I can go about extracting the
>> local matrix values?
>
> This is no "local matrix". The Mat interface is supposed to be data
> structure
> neutral so we can optimize for different architectures. If you want  
> the
> values
> directly, I would use MatGetRow() for each row.
>
>  Matt
>
>> Thanks
>>
>> Stephen
>>
>>
>
>
>
> -- 
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which
> their experiments lead.
> -- Norbert Wiener
>
>




More information about the petsc-users mailing list