On Wed, Jun 4, 2008 at 10:15 AM, Stephen R Ball <Stephen.R.Ball at awe.co.uk> wrote: > I am using PETSc via the Fortran interface. I don't think > MatGetOwnershipRanges() is available via Fortran.
As Barry noted, you can use MatGetOwnershipRange() Matt > ________________________________________ > From: owner-petsc-users at mcs.anl.gov [mailto:owner-petsc-users at > mcs.anl.gov] On Behalf Of Dave May > Sent: 04 June 2008 13:43 > To: petsc-users at mcs.anl.gov > Subject: EXTERNAL: Re: EXTERNAL: Re: MatGetArray() not supporting Mat type > mpiaij. > > You could use MatGetOwnershipRanges() > http://www-unix.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatGetOwnershipRanges.html > and then traverse the list "ranges[]" to determine which rank owns the global > row number of interest. > > Cheers, > Dave > On Wed, Jun 4, 2008 at 9:33 PM, Stephen R Ball <Stephen.R.Ball at awe.co.uk> > 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 > > -- 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
