[petsc-users] PETSc Error when writing a vector object to a binary file

amrit poudel amrit_pou at hotmail.com
Wed Sep 7 21:17:31 CDT 2011


I am using the following sequence of commands to write a Vec b to a binary file  and then eventually read it in MATLAB, but I get an error when I try writing this vector to a file in PETSc.

ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD, filesol, FILE_MODE_WRITE, &binviewersol) ; CHKERRQ(ierr) ;    
ierr = PetscViewerBinaryGetDescriptor(binviewersol, &fd); CHKERRQ(ierr) ;
ierr = PetscBinaryWrite(fd, b, 5, PETSC_SCALAR, PETSC_FALSE);    CHKERRQ(ierr) ;



Here is the error :


[1]PETSC ERROR: Write to file failed!
[1]PETSC ERROR: Error writing to file.!



NOTE : Petsc is configured with complex option and Vec b has complex entries. Length of Vec b is 5 .
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110908/98a7144c/attachment.htm>


More information about the petsc-users mailing list