> On 2 Nov 2018, at 14:58, 陳宗興 via petsc-users <[email protected]> wrote: > > Hi, > > I have created a DMPlex using DMPlexCreateFromFile, > and I use PetscObjectSetName to create the name of DM. > I have occurred some problem when I try to use PetscViewerVTKGetDM. > This is what I write: > > DM dm; > ... > PetscObjectSetName((PetscObject) dm, "Mesh"); > ... > PetscViewerVTKGetDM(viewer, (PetscObject) dm); > > And here is the output of waring: > warning: passing argument 2 of ‘PetscViewerVTKGetDM’ from incompatible > pointer type [-Wincompatible-pointer-types] > ierr = PetscViewerVTKGetDM(viewer, (PetscObject) dm);CHKERRQ(ierr); > ^ > note: expected ‘struct _p_PetscObject **’ but argument is of type > ‘struct _p_PetscObject *' > PETSC_EXTERN PetscErrorCode > PetscViewerVTKGetDM(PetscViewer,PetscObject*); > > ^~~~~~~~~~~~~~~~~~~ You need to pass a pointer to the PetscObject: PetscViewerVTKGetDM(viewer, (PetscObject *)&dm); Cheers, Lawrence
Re: [petsc-users] How to use PetscViewerVTKGetDM
Lawrence Mitchell via petsc-users Fri, 02 Nov 2018 09:52:10 -0700
