<div dir="ltr"><div><div><div><div><div><div><div><div>Dear all,<br>I'm just starting to learn using Petsc. I was trying the example (../src/dm/examples/tutorials/ex7.c)<br></div>for petsc-3.4.1 . However it seems this file has not been updated for the 3.4.1 version since it uses<br>
</div>PetscViewerBinaryMatlabOpen() and friends which have been removed from this newer version.<br>Now I tried to change them but I have some questions:<br><br></div>The lines I wanted to change are the ones that use following funcitons:<br>
1. PetscViewerBinaryMatlabOpen(PETSC_COMM_WORLD,params->filename,&viewer)<br>2. PetscViewerBinaryMatlabOutputBag(viewer,"params",bag)<br>3. PetscViewerBinaryMatlabOutputVecDA(viewer,"da1",global,da)<br>
<br></div>For 1, it seems I can change it with:<br>PetscViewerBinaryOpen(PETSC_COMM_WORLD,params->filename,FILE_MODE_WRITE,&viewer)<br>PetscViewerSetFormat(viewer,PETSC_VIEWER_BINARY_MATLAB)<br><br></div>Now, for the 2 and 3 I thought I need to use: <br>
<pre>PetscViewerBinaryWrite(PetscViewer viewer,void *data,PetscInt count,PetscDataType dtype,PetscBool istemp)</pre>but I'm not sure what exactly to provide as argument for <i>count</i> and <i>dtype</i> to have the same functionality as intended in ex7.c <br>
I tried (for 2) using:<br>ierr = PetscViewerBinaryWrite(viewer,&bag,1,PETSC_OBJECT,PETSC_FALSE);<br>but it results in an error when running the executable.<br></div>How should I count the no. of items for <i>count</i> variable in this case for the<i> bag</i> object ?<br>
</div>And what should be the dtype ?<br><br></div>Thanks,<br>Bishesh <br></div>