[petsc-users] How to use PetscViewerVTKGetDM
Lawrence Mitchell
wence at gmx.li
Fri Nov 2 11:20:11 CDT 2018
> On 2 Nov 2018, at 14:58, 陳宗興 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);
>
> 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
More information about the petsc-users
mailing list