[petsc-users] How to use PetscViewerVTKGetDM

陳宗興 barrydog505 at gmail.com
Fri Nov 2 12:14:54 CDT 2018


I will try it.
Thanks a lot.

barry

Matthew Knepley <knepley at gmail.com> 於 2018年11月3日 週六 上午1:10寫道:

> On Fri, Nov 2, 2018 at 1:06 PM 陳宗興 <barrydog505 at gmail.com> wrote:
>
>> I want to create a VTK file with DMPlex and Vec, and I found these
>> function:
>> PetscViewerVTKOpen,
>>
>
> Call VTKOpen() to get a PetscViewer object
>
>
>> PetscViewerVTKGetDM, and PetscViewerVTKWriteFunction
>>
>
> Forget these.
>
> Call VecView(v, viewer) with your Vec and VTK Viewer.
>
>   Thanks,
>
>       Matt
>
>
>> Are these what I needed, or maybe something else?
>>
>> thank you,
>>
>> Barry
>>
>> Matthew Knepley <knepley at gmail.com> 於 2018年11月3日 週六 上午12:14寫道:
>>
>>> 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/>
>>>
>>
>
> --
> 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/20181103/fabd37c4/attachment-0001.html>


More information about the petsc-users mailing list