[petsc-users] Correct approach for updating deprecated code

Richard Beare richard.beare at monash.edu
Sun Feb 23 17:24:02 CST 2020


Hi,
The following code gives a deprecation warning. What is the correct way of
updating the use of ViewerSetFormat to ViewerPushFormat (which I presume is
the preferred replacement). My first attempt gave errors concerning
ordering.

Thanks

PetscViewer viewer1;
ierr = PetscViewerBinaryOpen(PETSC_COMM_WORLD,fileName.c_str
(),FILE_MODE_WRITE,&viewer1);CHKERRQ(ierr);
ierr = PetscViewerSetFormat(viewer1,PETSC_VIEWER_BINARY_MATLAB);CHKERRQ
(ierr);

ierr = PetscObjectSetName((PetscObject)mX,"x");CHKERRQ(ierr);
ierr = PetscObjectSetName((PetscObject)mB,"b");CHKERRQ(ierr);

ierr = VecView(mX,viewer1);CHKERRQ(ierr);
ierr = VecView(mB,viewer1);CHKERRQ(ierr);


-- 
--
A/Prof Richard Beare
Imaging and Bioinformatics, Peninsula Clinical School
orcid.org/0000-0002-7530-5664
Richard.Beare at monash.edu
+61 3 9788 1724



Geospatial Research:
https://www.monash.edu/medicine/scs/medicine/research/geospatial-analysis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200224/19f828fa/attachment.html>


More information about the petsc-users mailing list