[petsc-users] How to use PetscViewerVTKGetDM

Matthew Knepley knepley at gmail.com
Fri Nov 2 11:14:05 CDT 2018


On Fri, Nov 2, 2018 at 12:11 PM 陳宗興 via petsc-users <petsc-users at mcs.anl.gov>
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);
>

1) GetDM() returns a DM, so you would need PetscViewerVTKGetDM(viewer,
(PetscObject *) &dm)

2) However, why are you trying to pull out a DM? It does not look like you
want to do this.

  Thanks,

    Matt


> 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*);
>
>  ^~~~~~~~~~~~~~~~~~~
>
> How can I fix it?
>
> Thank you,
>
> Barry
>
>
>

-- 
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/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20181102/0617231d/attachment.html>


More information about the petsc-users mailing list