[petsc-users] check status of reading matrix from a file

Michael Povolotskyi mpovolot at purdue.edu
Tue Feb 13 11:10:00 CST 2018


Dear Petsc developers,

I'm reading a matrix from a file like this:

PetscViewer viewer;
PetscErrorCode ierr;

MatCreate(comm,&matrix);

MatSetType(matrix,MATDENSE);

ierr = PetscViewerBinaryOpen(comm,file_name,FILE_MODE_READ,&viewer);
ierr = MatLoad(matrix,viewer);


Sometimes the file that is needed is not present and the code execution 
becomes frozen.

Is it possible to catch this situation looking at the ierr variable?

Thank you,

Michael.



More information about the petsc-users mailing list