[petsc-users] PetscViewerBinaryMatlab example for petsc-3.4.1

Bishesh Khanal bisheshkh at gmail.com
Wed Jun 26 08:44:45 CDT 2013


Dear all,
I'm just starting to learn using Petsc. I was trying the example
(../src/dm/examples/tutorials/ex7.c)
for petsc-3.4.1 . However it seems this file has not been updated for the
3.4.1 version since it uses
PetscViewerBinaryMatlabOpen() and friends which have been removed from this
newer version.
Now I tried to change them but I have some questions:

The lines I wanted to change are the ones that use following funcitons:
1. PetscViewerBinaryMatlabOpen(PETSC_COMM_WORLD,params->filename,&viewer)
2. PetscViewerBinaryMatlabOutputBag(viewer,"params",bag)
3. PetscViewerBinaryMatlabOutputVecDA(viewer,"da1",global,da)

For 1, it seems I can change it with:
PetscViewerBinaryOpen(PETSC_COMM_WORLD,params->filename,FILE_MODE_WRITE,&viewer)
PetscViewerSetFormat(viewer,PETSC_VIEWER_BINARY_MATLAB)

Now, for the 2 and 3 I thought I need to use:

PetscViewerBinaryWrite(PetscViewer viewer,void *data,PetscInt
count,PetscDataType dtype,PetscBool istemp)

but I'm not sure what exactly to provide as argument for *count* and
*dtype*to have the same functionality as intended in ex7.c
I tried (for 2) using:
ierr = PetscViewerBinaryWrite(viewer,&bag,1,PETSC_OBJECT,PETSC_FALSE);
but it results in an error when running the executable.
How should I count the no. of items for *count* variable in this case for
the* bag* object ?
And what should be the dtype ?

Thanks,
Bishesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130626/1b81c971/attachment.html>


More information about the petsc-users mailing list