[petsc-users] What's the binary function corresponding to "PetscViewerASCIIPrintf"?

Barry Smith bsmith at mcs.anl.gov
Wed Dec 1 08:12:27 CST 2010


  You can write raw strings into binary viewers with PetscViewerBinaryWrite(), BUT you will need to have your program that processes the data in the binary file be able to read out the strings. Another alternative is to use PetscViewerBinaryGetInfoPointer() and write your additional information into the corresponding .info ASCII file that is automatically generated. Again whatever program that processes your data will need to read that file to get the information out of it.

  Barry


On Dec 1, 2010, at 12:15 AM, Li, Zhisong (lizs) wrote:

>  Hi, Petsc Team,
> 
> 
> I once read that when we write large volume of data into an output data file, it's best to write in binary format rather than in ASCII format. I forget the origin of this statement and could not find it any more. What I found in the example code is about writing array into a binary file. Besides data stored in arrays, I also want to include some other info such as document title, data dimensions and line changing, which are not arrays, into the output file. So a "PetscViewerASCIIPrintf" is very convenient for doing this if we use ASCII format. But I could not find its correspondent function for binary format. Can you tell me how to do this? A sample code will be most helpful.
> 
> 
> Best Regards,
> 
> Zhisong Li
> 



More information about the petsc-users mailing list