[petsc-users] Correct approach for updating deprecated code

Satish Balay balay at mcs.anl.gov
Mon Feb 24 09:35:36 CST 2020


Perhaps this is helpful.

https://gitlab.com/petsc/petsc/commits/6a9046bcf1dc7e213a87d3843bfa02f323786ad4

Satish

On Sun, 23 Feb 2020, Matthew Knepley wrote:

> I think you are going to have to send the error logs.
> 
>   Thanks,
> 
>      MAtt
> 
> On Sun, Feb 23, 2020 at 6:45 PM Richard Beare <richard.beare at monash.edu>
> wrote:
> 
> > That's what I did (see below), but I got ordering errors (unfortunately
> > deleted those logs too soon). I'll rerun if no one recognises what I've
> > done wrong.
> >
> > 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 = PetscViewerPushFormat(viewer1,PETSC_VIEWER_BINARY_MATLAB);CHKERRQ
> > (ierr);
> >
> > ierr = PetscObjectSetName((PetscObject)mX,"x");CHKERRQ(ierr);
> > ierr = PetscObjectSetName((PetscObject)mB,"b");CHKERRQ(ierr);
> >
> > On Mon, 24 Feb 2020 at 10:43, Matthew Knepley <knepley at gmail.com> wrote:
> >
> >> On Sun, Feb 23, 2020 at 6:25 PM Richard Beare via petsc-users <
> >> petsc-users at mcs.anl.gov> wrote:
> >>
> >>>
> >>> 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.
> >>>
> >>
> >> You can't just change SetFormat to PushFormat here?
> >>
> >>   Matt
> >>
> >>
> >>> 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
> >>>
> >>
> >>
> >> --
> >> What most experimenters take for granted before they begin their
> >> experiments is infinitely more interesting than any results to which their
> >> experiments lead.
> >> -- Norbert Wiener
> >>
> >> https://www.cse.buffalo.edu/~knepley/
> >> <http://www.cse.buffalo.edu/~knepley/>
> >>
> >
> >
> > --
> > --
> > 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
> >
> 
> 
> 



More information about the petsc-users mailing list