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

Renato N. Elias rnelias at nacad.ufrj.br
Wed Mar 29 14:18:18 EST 2006


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 




More information about the vtkusers mailing list