<div dir="ltr">Unfortunately, the VTK format does not support multiple <StructuredGrid> entries in the same file. I have no idea why they chose to make the format that way. You can ask them to remove this ridiculous restriction, but until then, you have to write separate files or use a different format.<div class="gmail_extra">
<br><br><div class="gmail_quote">On Wed, Jan 9, 2013 at 10:10 AM, Blaise A Bourdin <span dir="ltr"><<a href="mailto:bourdin@lsu.edu" target="_blank">bourdin@lsu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">
That's a good start indeed. Is there any way to save files defined on different DMDA (same grid but different number of dof). When I try to do that, I get the following error message:
<div>
<div>MacBook-Pro:VTK blaise$ ./TestVTK </div>
<div>[0]PETSC ERROR: --------------------- Error Message ------------------------------------</div>
<div>[0]PETSC ERROR: Arguments are incompatible!</div>
<div>[0]PETSC ERROR: Cannot write a field from more than one grid to the same VTK file!</div>
<div>[0]PETSC ERROR: ------------------------------------------------------------------------</div>
<div>[0]PETSC ERROR: Petsc Release Version 3.3.0, Patch 5, unknown </div>
<div>[0]PETSC ERROR: See docs/changes/index.html for recent updates.</div>
<div>[0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.</div>
<div>[0]PETSC ERROR: See docs/index.html for manual pages.</div>
<div>[0]PETSC ERROR: ------------------------------------------------------------------------</div>
<div>[0]PETSC ERROR: ./TestVTK on a Darwin-gc named MacBook-Pro.local by blaise Wed Jan 9 10:09:37 2013</div>
<div>[0]PETSC ERROR: Libraries linked from /opt/HPC/petsc-3.3/Darwin-gcc4.2-mef90-g/lib</div>
<div>[0]PETSC ERROR: Configure run at Thu Jan 3 15:42:04 2013</div>
<div>[0]PETSC ERROR: Configure options --download-boost=1 --download-chaco=1 --download-exodusii=/opt/HPC/src/tarball/exodusii-5.22b.tgz --download-hdf5=1 --download-metis=1 --download-netcdf=1 --download-parmetis=1 --download-sowing=1 --download-triangle=1
--download-yaml=1 --with-clanguage=C++ --with-cmake=cmake --with-debugging=1 --with-fortran-datatypes --with-gnu-compilers=1 --with-mpi-dir=/opt/HPC/mpich2-1.4.1p1-gcc4.2 --with-pic --with-shared-libraries=1 --with-sieve --with-sieve-memory-logging --with-x11=1
PETSC_ARCH=Darwin-gcc4.2-mef90-g</div>
<div>[0]PETSC ERROR: ------------------------------------------------------------------------</div>
<div>[0]PETSC ERROR: PetscViewerVTKAddField_VTK() line 126 in /opt/HPC/petsc-3.3/src/sys/viewer/impls/vtk/vtkv.c</div>
<div>[0]PETSC ERROR: PetscViewerVTKAddField() line 32 in /opt/HPC/petsc-3.3/src/sys/viewer/impls/vtk/vtkv.c</div>
<div>[0]PETSC ERROR: VecView_MPI_DA() line 531 in /opt/HPC/petsc-3.3/src/dm/impls/da/gr2.c</div>
<div>[0]PETSC ERROR: VecView() line 776 in /opt/HPC/petsc-3.3/src/vec/vec/interface/vector.c</div>
<div>[0]PETSC ERROR: main() line 46 in TestVTK.c</div>
<div>application called MPI_Abort(MPI_COMM_WORLD, 75) - process 0</div>
<div>[unset]: aborting job:</div>
<div>application called MPI_Abort(MPI_COMM_WORLD, 75) - process 0</div>
<div><br>
</div>
<div>Blaise</div>
<div><br>
</div>
<div>
<div>On Jan 9, 2013, at 9:51 AM, Jed Brown <<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">jedbrown@mcs.anl.gov</a>></div>
<div> wrote:</div><div><div class="h5">
<br>
<blockquote type="cite">
<div dir="ltr">None of that crazy "developer" nonsense is need for users. Just do this:
<div><br>
</div>
<div>
<div> PetscViewer viewer;</div>
<div> /* file name extension sets format by default, see also PetscViewerSetFormat(viewer,PETSC_VIEWER_VTK_VTS) */</div>
<div> ierr = PetscViewerVTKOpen(comm,"yourfile.vts",FILE_MODE_WRITE,&viewer);CHKERRQ(ierr);</div>
<div> ierr = VecView(X,viewer);CHKERRQ(ierr);</div>
<div> ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr);</div>
</div>
<div><br>
</div>
<div>When using TS, you can do -ts_monitor_draw_solution_vtk 'filename-%03D.vts' to save each time step to a numbered binary file (ready to animate in paraview or visit).</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Wed, Jan 9, 2013 at 9:37 AM, Blaise A Bourdin <span dir="ltr">
<<a href="mailto:bourdin@lsu.edu" target="_blank">bourdin@lsu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
I am looking at the documentation and the examples looking for a simple illustration of how to use the new vtk binary viewers for structured data defined by a DMDA, but can't find any straightforward example. Is there a simple example that I am missing?<br>
<br>
When I try<br>
PetscViewerVTKAddField(VTKviewer,(PetscObject) dmda1,DMDAVTKWriteAll,PETSC_VTK_POINT_FIELD,(PetscObject) p);CHKERRQ(ierr);<br>
I get a compilation time error:<br>
TestVTK.c:53: error: ‘DMDAVTKWriteAll’ was not declared in this scope<br>
indeed, DMDAVTKWriteAll is defined in a private header. Is this the way it is supposed to be?<br>
<br>
Is the xml file describing the content of the binary files generated automatically or do I need to take care of it by myself?<br>
<br>
I am using petsc-3.3, latest changeset.<br>
<br>
Regards,<br>
Blaise<br>
<span><font color="#888888">--<br>
Department of Mathematics and Center for Computation & Technology<br>
Louisiana State University, Baton Rouge, LA 70803, USA<br>
Tel. <a href="tel:%2B1%20%28225%29%20578%201612" value="+12255781612" target="_blank">+1 (225) 578 1612</a>, Fax <a href="tel:%2B1%20%28225%29%20578%204276" value="+12255784276" target="_blank">+1 (225) 578 4276</a>
<a href="http://www.math.lsu.edu/~bourdin" target="_blank">http://www.math.lsu.edu/~bourdin</a><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</font></span></blockquote>
</div>
<br>
</div>
</div>
</blockquote>
</div></div></div><div><div class="h5">
<br>
<div><span style="border-collapse:separate;font-size:12px;border-spacing:0px"><span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:12px;white-space:normal;font-family:Helvetica;word-spacing:0px">
<div style="word-wrap:break-word">
<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:12px;white-space:normal;font-family:Helvetica;word-spacing:0px">
<div style="word-wrap:break-word">
<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:12px;white-space:normal;font-family:Helvetica;word-spacing:0px">
<div style="word-wrap:break-word">
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">
-- </div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">
Department of Mathematics and Center for Computation & Technology</div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">
Louisiana State University, Baton Rouge, LA 70803, USA</div>
<div style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">
Tel. <a href="tel:%2B1%20%28225%29%20578%201612" value="+12255781612" target="_blank">+1 (225) 578 1612</a>, Fax <a href="tel:%2B1%20%28225%29%20578%204276" value="+12255784276" target="_blank">+1 (225) 578 4276</a> <a href="http://www.math.lsu.edu/~bourdin" target="_blank">
http://www.math.lsu.edu/~bourdin</a></div>
<div><br>
</div>
<div><br>
</div>
<br>
</div>
</span></div>
</span><br>
</div>
</span><br>
</span><br>
</div>
<br>
</div></div></div>
</div>
</blockquote></div><br></div></div>