[vtkusers] Extracting an unstructured grid from Ensight case files...

Randall Hand randall.hand at gmail.com
Wed Mar 29 14:23:29 EST 2006


Nice to see someone else using Tcl/Tk for file conversion :)  I do it all
the time here.

Sadly, you've run into the #1 problem with VTK formats, the Grid & Data must
remain together (AFAIK, someone please correct me if I'm wrong)..  If you
want to separate the two, then you have little choice than to switch to
another format.

On 3/29/06, Renato N. Elias <rnelias at nacad.ufrj.br> wrote:
>
>
> Hi there,
>
> Since I'm a poor Fortran programmer that can't make the Ensight's binary
> format working in Paraview properly, I've been writing a TCL/VTK script to
> convert from Ensight case files to Paraview/VTK format (and I hope it will
> work out my problems...).
>
> A have the following situation to cover:
>
> 1- Model partitioned in several case files (sometimes I run problems in
> parallel/MPI)
> 2- Each case file has its geometry and results files associated
> 3- The geometry does not change in time
>
> Then, I was thinking about do the following:
>
> 1- Read each case file
> 2- Export the Unstructured grid through the vtkXMLUnstructuredGridWriter
> 3- Export the results for each time step through the vtkXMLDataSetWriter
> 4- Assembly the files through a PVD file (Paraview format) as is done with
> the case file
>
> My problem is:
>
> * * * How do I export unstructured grids and results separetely? * * *
>
> I'm using the following script, but it's only able to save grid+results in
> the same file. Note that it's not good since I'll be replicating grid that
> does not change in time.
>
> --------------------------------------------------------------
> package require vtk
>
> # loading command line arguments
> set arch [lindex $argv 0]
> set nprocs  [lindex $argv 1]
>
> # building the case file names
> append arch "_"
> append arch $nprocs
> append arch "_"
>
> # loop over the case files that will be read and saved in vtk format
> for {set i 0} {$i < $nprocs} {incr i} {
>
>     set filename $arch
>     if {$i < 10} { append filename "0" }
>     append filename $i
>     set casefile $filename
>     append casefile ".case"
>     puts " Reading Ensight casefile $casefile"
>
>     vtkGenericEnSightReader reader
>        reader SetCaseFileName $casefile
>        reader Update
>
>     vtkXMLUnstructuredGridWriter vtkfile
>       vtkfile SetInput [ reader GetOutput ]
>       vtkfile SetFileName "$filename.vtk"
>       puts " Exporting VTK unified file..."
>       vtkfile Write
>
>     reader  Delete
>     vtkfile Delete
> }
> wm withdraw .
> Exit
> --------------------------------------------------------------
>
> Thanks for any help
>
> Renato N. Elias
> ===============================================
> PhD student - http://www.nacad.ufrj.br/~rnelias
> High Performance Computing Center
> Federal University of Rio de Janeiro
> Rio de Janeiro, Brazil
> +55(21) 2562-8080
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



--
Randall Hand
Visualization Scientist,
ERDC-MSRC Vicksburg, MS
Homepage: http://www.yeraze.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060329/de8f370e/attachment.htm>


More information about the vtkusers mailing list