[petsc-users] How to view draw a matrix?
    Florian Lindner 
    mailinglists at xgm.de
       
    Fri Nov  4 09:14:56 CDT 2016
    
    
  
Hello,
I want to print the sparsity structure of a matrix of type MPISBAIJ and try to use this code:
  PetscErrorCode ierr = 0;
  PetscViewer viewer;
  PetscDraw draw;
  ierr = PetscViewerCreate(communicator, &viewer); CHKERRV(ierr);
  ierr = PetscViewerSetType(viewer, PETSCVIEWERDRAW); CHKERRV(ierr);
  ierr = MatView(matrix, viewer); CHKERRV(ierr);
  ierr = PetscViewerDrawGetDraw(viewer, 0, &draw); CHKERRV(ierr);
  ierr = PetscDrawSetPause(draw, -1); CHKERRV(ierr); // Wait for user
  ierr = PetscDrawDestroy(&draw); CHKERRV(ierr);
  ierr = PetscViewerDestroy(&viewer); CHKERRV(ierr);
communicator is of type MPI_Comm and is PETSC_COMM_WORLD.
It opens an X window and shows the matrix just fine. The window closes after a right click and then my application crashes:
--------------------------------------------------------------------------
[1]PETSC ERROR: PetscDrawFlush() line 27 in /data/scratch/lindnefn/software/petsc/src/sys/classes/draw/interface/dflush.c
    Wrong type of object: Parameter # 1
--------------------------------------------------------------------------
I tried to swap the DrawDestroy and ViewerDestroy calls (though, imho the order is correct), but changes nothing.
Thanks,
Florian
    
    
More information about the petsc-users
mailing list