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

Berk Geveci berk.geveci at gmail.com
Thu Mar 30 09:39:09 EST 2006


This sounds more like a bug in the ensight reader than a problem with
your code. Can you send me a very small example (including the sos
file)?

-Berk

On 3/29/06, Renato N. Elias <rnelias at nacad.ufrj.br> wrote:
>
> I'm afraid of trying any other file format since the problem is mainly due
> the Fortran. I really like the Ensight format, it seems me to be the easiest
> and more powerful format among the formats supported by PV, but these
> weirdness regarding the Fortran binary are really annoying...
>
> I know that the "unformatted" data written by Fortran is something weird for
> any other programming language, but what about the "binary" format provided
> by some compilers?! What's wrong with this BINARY? My files are all open as
> "BINARY" and not as "UNFORMATTED". I use the Compaq and Intel compilers and
> both have support to "BINARY". PV (2.2.1) is able to open the files but only
> in serial mode. When I try to use a SOS file to open several pieces of model
> in parallel they don't work. Can anyone point me the differences between
> this kind of "BINARY" (not UNFORMATTED) and the binary provided by other
> languages, such as C/C++? I think this "BINARY" should work as in any other
> language.
>
>
> Renato.
>
> ________________________________
>
> De: Randall Hand [mailto:randall.hand at gmail.com]
> Enviada em: quarta-feira, 29 de março de 2006 17:22
> Para: Renato N. Elias
> Cc: paraview at paraview.org
> Assunto: Re: [vtkusers] Extracting an unstructured grid from Ensight case
> files...
>
>
> Well, i'm about as far away from an Ensight guru as you can get, so someone
> else will have to chime in on the specifics of the File Format & Ensight.
>
> But there's a few issues with Binary & Fortran files.
>    1) Binary isn't really "cross platform compatible" .  If you do an
> unformatted write on a big endian machine, you have to be careful to byte
> swap it on a little-endian machine.  This can't be easily autodetected, so
> alot of the readers have the ability to specify it.   Maybe this option is
> missing?
>    2) Fortran insists on writing Record Markers at the beginning & end of
> each write.  Handy for integrity checking, royal PITA when you start trying
> to use it in anything other than fortran.  Again, hard to autodetect, so
> some of the readers give you the ability to specify C or Fortran (like the
> Plot3d Reader).
>
> So you're kinda left to using other formats.  Personally, I would like to
> see the new VTK Parallel XML formats extended to allow for putting the data
> & the grid in separate files, but I doubt that will happen anytime soon.
> Xmdf & Xdmf are an option, but not very ensight friendly (I think).
>
> Personally i've started writing things to VTK XML formats with the
> compression enabled.  It's ascii, and the grid gets carried around, but it's
> a minor annoyance for the stuff I'm doing. The ones where it is a huge
> annoyance, we're using PLOT3D files so it's not an issue.
>
>
>
>
>
> On 3/29/06, Renato N. Elias <rnelias at nacad.ufrj.br> wrote:
>
>
>         Hi Randall, thanks for your advice...
>
>         This subject has been drive me crazy!!!
>
>         - I can't read SOS files since they are written by Fortran routines;
>
>         - I can't save transient data in VTK since VTK does not have support
> to
>         transient data... ok, it can be overcame through PVD files;
>
>         - I can't save grid and results separetely... Ok, I can save them
> together
>         but it would give unnecessary data being replicated;
>
>         - I tried the Stephane approach (opening the file as unstructured
> and saving
>         with only one write) but the number of parameters passed to the
> "write"
>         function is greater than the limit that the function supports to
> write;
>
>         - I open the file (ENSIGHT6) as binary (my Fortran has support to
> it) but PV
>         only read my files in serial modes (SOS does not work)
>
>         - Ensight Gold binary written by Fortran does not work as well
>
>         - Ok, Ensight format in ASCII works fine but it would give me huge
> and very
>         slow files...
>
>         - Ok, there's a Fortran/VTK library distributed with PV, but I'd
> have to
>         install VTK or port the library to any machine I use (and I'm not a
> system
>         administrator to do it).
>
>         - I only get success when reading Ensight6 Fortran/Binary data in
> serial
>         mode.
>
>         I'm feeling that I (and other Fortran programmers) have no choice...
> I know
>         that PV and VTK have different Ensight readers, but why do the VTK
> readers
>         work with my files and in PV it is not always possible? Furthermore,
> how can
>         Ensight read Fortran unstructured/binary and C/C++ files without any
>         problem? Within the files have a "C binary" and a "Fortran binary"
>         indication, can't it be used to guide the right way of reading the
> file?
>
>         I don't know what I should do... I was writing this script to
> convert a
>         bunch of results that I have stored but I'm almost giving up and
> going
>         through write a C writer for my Fortran programs (unfortunately, it
> won't
>         solve the problem of my results stored - only if I do another file
>         converter)
>
>         Regards
>
>         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
>
>
>         ________________________________
>
>         De: Randall Hand [mailto: randall.hand at gmail.com]
>         Enviada em: quarta-feira, 29 de março de 2006 16:23
>         Para: Renato N. Elias
>         Cc: vtkusers at vtk.org; paraview at paraview.org
>         Assunto: Re: [vtkusers] Extracting an unstructured grid from Ensight
> case
>         files...
>
>
>         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
> <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 <http://www.yeraze.com>
>
>
>
>
>
>
> --
> Randall Hand
> Visualization Scientist,
> ERDC-MSRC Vicksburg, MS
> Homepage: http://www.yeraze.com
>
> _______________________________________________
> ParaView mailing list
> ParaView at paraview.org
> http://www.paraview.org/mailman/listinfo/paraview
>


More information about the ParaView mailing list