Read matrix

Knut Erik Teigen knutert at stud.ntnu.no
Mon Jul 23 03:29:56 CDT 2007


Hello,

Can't you just use MatView, with a file writer viewer? You can save to
both ASCII and binary files, using PetscViewerASCIIOpen and
PetscViewerBinaryOpen.

Regards,
Knut Erik Teigen

On Mon, 2007-07-23 at 10:08 +0200, Tim Kröger wrote:
> Dear all,
> 
> I am assembling a matrix using several calls to MatSetValues(). 
> Then, I call MatAssemblyBegin() and MatAssemblyEnd() as usual.  After 
> that, I would like to write the complete matrix into a file (for 
> debugging purposes).  My idea was to call MatGetRow() for each matrix 
> row and write the values out.  This seems to work in one-processor 
> mode, but in parallel, I get
> 
> [14]PETSC ERROR: MatGetRow_MPIAIJ() line 1185 in src/mat/impls/aij/mpi/mpiaij.c
> [14]PETSC ERROR: Object is in wrong state!
> [14]PETSC ERROR: Already active!
> [14]PETSC ERROR: MatGetRow() line 106 in src/mat/interface/matrix.c
> 
> What did I do wrong?
> 
> Best Regards,
> 
> Tim
> 




More information about the petsc-users mailing list