[Paraview] Paraview file format documentations

Markus Werle numerical.simulation at web.de
Wed Feb 27 16:09:22 EST 2008


Hi!

I am rather new to paraview (just worked through the tutorial from 
http://paraview.org/Wiki/SC07_ParaView_Tutorial - cool!) and I am 
planning to use paraview as visualization tool for my own solver.

I find it hard to figure out which file format to use, so I am looking 
for some advice.

Q: My solver generates 2D unstructered mesh data together with 
field data (stress, strain, pressure, velocity, etc.) over this grid. 
Which file format is most appropriate to use for this? 
Any library you would recommend? 

Q: Is http://www.vtk.org/pdf/file-formats.pdf the only information
publicly available about vtk file formats or is there other information
available?

Q: I guesss the ex2 - file format used in the above-mentioned tutorial 
the same which is described in 
http://endo.sandia.gov/SEACAS/Documentation/exodusII.pdf.
Am I right?

Q: Searching the source code with the command
find . -type f -exec grep -l vtkExodusIIWriter {} \;
yields
./Servers/ServerManager/Resources/writers.xml
./VTK/Parallel/vtkExodusIIWriter.h
./VTK/Parallel/CMakeLists.txt
./VTK/Parallel/vtkExodusIIWriter.cxx
./VTK/Hybrid/vtkExodusModel.h
./VTK/Hybrid/vtkExodusReader.h
./VTK/Hybrid/vtkExodusIIReader.h
./VTK/Hybrid/vtkExodusReader.cxx

At first glance I did not find code which _uses_ class vtkExodusIIWriter.
Can you provide a usage example for writing a small 
unstructured 2D grid  with simulation data using vtk classes.

If you like start from this code here 

#include <boost/array.hpp>
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>


typedef boost::array<double, 2> point_2d;

// this is only dummy demo code (pseudo-unstructured)
std::vector<point_2d> create_grid(std::size_t i_max, 
                                  std::size_t j_max)
{
  std::vector<point_2d> grid;

  for (std::size_t i = 0; i < i_max; ++i)
    {
      for (std::size_t j = 0; j < j_max; ++j)
        {
          point_2d p = { double(i), double(j) };
          grid.push_back(p);
        }
    }

  return grid;
}

std::vector<std::list<std::size_t> > 
create_connectivity_list_for_grid(std::size_t i_max, 
                                  std::size_t j_max)
{
  std::vector<std::list<std::size_t> > connl;

  // [ ommitted for brevity in this post ]
  
  return connl;
}

std::vector<double> generate_field_data(std::size_t n)
{
  std::vector<double> field(n);

  std::fill(field.begin(), field.end(), 1.0);
}
 
int main()
{
  std::vector<point_2d> const & grid = create_grid(3, 4);
  std::vector<std::list<std::size_t> > const & connl =
    create_connectivity_list_for_grid(3, 4);
  
  std::vector<double> data = generate_field_data(12);

  // output to a paraview file format

  // YOUR CODE GOES HERE
}




best regards,


Markus



More information about the ParaView mailing list