[Paraview] Animating simple legacy formats files

John Fettig jfettig at sandia.gov
Mon Jun 25 10:12:52 EDT 2007


On Mon, 2007-06-25 at 13:12 +0545, Hom Nath Gharti wrote:
> I have different sets of *.vtk files for each time steps (Finite
> Element Data with unstructured grids). Is it possible to animate
> these data with Paraview?  I would greatly appreciate any
> help/suggestions.

What I do is have a perl script generate a pvd file, which can then be
opened in paraview.  The pvd file is a very simple xml file which
basically lists the vtk files.  Here is some perl:

#!/usr/bin/perl -w

$DATA = "/path/to/datadir";
$ls = `ls -tr $DATA`;

@files = split(/\n/,$ls);

$i = 0;

open(VELOOUT, ">$DATA/velo.pvd");

print VELOOUT "<?xml version=\"1.0\"?>\n";
print VELOOUT "<VTKFile type=\"Collection\" version=\"0.1\">\n";
print VELOOUT "  <Collection>\n";

foreach $file (@files) {
    if ($file=~/velo.*.vtk/) {
        print VELOOUT "    <DataSet timestep=\"$i\" group=\"\" part=\"0
\"\n";
        print VELOOUT "             file=\"$DATA/$file\" />\n";
        $i = $i+1;
    }
}

print VELOOUT "  </Collection>\n";
print VELOOUT "</VTKFile>\n";

##################################################


So basically, in the data directory I have a bunch of files representing
the timesteps as velo000000000.vtu, velo000000001.vtu, etc.  This file
creates a pvd file from them.

John





More information about the ParaView mailing list