[petsc-users] Binary VTK viewer
Jed Brown
jedbrown at mcs.anl.gov
Thu Mar 8 16:25:26 CST 2012
On Thu, Mar 8, 2012 at 16:19, Max Rudolph <maxwellr at gmail.com> wrote:
> Is it expected behavior for field names not to be included in the .vts
> file produced using this viewer?
Did you use DMDASetFieldNames()?
$ mpiexec -n 2 ./ex50 -da_refine 4 -snes_monitor -snes_view_solution_vtk
foo.vts
now foo.vts contains
<?xml version="1.0"?>
<VTKFile type="StructuredGrid" version="0.1" byte_order="LittleEndian">
<StructuredGrid WholeExtent="0 48 0 48 0 0">
<Piece Extent="0 48 0 24 0 0">
<Points>
<DataArray type="Float64" Name="Position" NumberOfComponents="3"
format="appended" offset="0" />
</Points>
<PointData Scalars="ScalarPointData">
<DataArray type="Float64" Name="x-velocity" NumberOfComponents="1"
format="appended" offset="29404" />
<DataArray type="Float64" Name="y-velocity" NumberOfComponents="1"
format="appended" offset="39208" />
<DataArray type="Float64" Name="Omega" NumberOfComponents="1"
format="appended" offset="49012" />
<DataArray type="Float64" Name="temperature" NumberOfComponents="1"
format="appended" offset="58816" />
</PointData>
</Piece>
<Piece Extent="0 48 25 48 0 0">
<Points>
<DataArray type="Float64" Name="Position" NumberOfComponents="3"
format="appended" offset="68620" />
</Points>
<PointData Scalars="ScalarPointData">
<DataArray type="Float64" Name="x-velocity" NumberOfComponents="1"
format="appended" offset="96848" />
<DataArray type="Float64" Name="y-velocity" NumberOfComponents="1"
format="appended" offset="106260" />
<DataArray type="Float64" Name="Omega" NumberOfComponents="1"
format="appended" offset="115672" />
<DataArray type="Float64" Name="temperature" NumberOfComponents="1"
format="appended" offset="125084" />
</PointData>
</Piece>
</StructuredGrid>
<AppendedData encoding="raw">
>
> Max
>
> On Thu, Mar 8, 2012 at 11:21 AM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
>
>> On Thu, Mar 8, 2012 at 13:10, Max Rudolph <maxwellr at gmail.com> wrote:
>>
>>> I get an implicit declaration warning when compiling with a call to
>>> DMDAVTKWriteAll:
>>>
>>> io.c:209: warning: implicit declaration of function 'DMDAVTKWriteAll'
>>>
>>> Should the prototype be in petscdmda.h ? I do not see it there. Code
>>> still compiles successfully.
>>>
>>
>> That is a developer-level function that you should not be calling, it's
>> declared in private/daimpl.h. I didn't hack together some funky new API
>> when I added the VTK viewer. You use it like any other viewer, by calling
>> VecView(). Here's some sample code.
>>
>> ierr =
>> PetscOptionsGetString(((PetscObject)snes)->prefix,"-snes_view_solution_vtk",filename,PETSC_MAX_PATH_LEN,&flg);CHKERRQ(ierr);
>> if (flg) {
>> PetscViewer viewer;
>> ierr =
>> PetscViewerCreate(((PetscObject)snes)->comm,&viewer);CHKERRQ(ierr);
>> ierr = PetscViewerSetType(viewer,PETSCVIEWERVTK);CHKERRQ(ierr);
>> ierr = PetscViewerFileSetName(viewer,filename);CHKERRQ(ierr);
>> ierr = VecView(snes->vec_sol,viewer);CHKERRQ(ierr);
>> ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr);
>> }
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120308/288d7f51/attachment.htm>
More information about the petsc-users
mailing list