[Paraview] pv 3.8 segfaults on opening raw binary files

Mohammad Mirzadeh mirzadeh at gmail.com
Thu May 17 19:13:36 EDT 2012


Thanks David. I have thoroughly looked through that file format document
but with no luck. It the mean time, I have tried the xml format and while
my ascii writer (both in legacy and xml versions) work, I'm hopeless when
it comes to the binary version.

It seems that (for xml binary) pv is confused (well, actually I'm also!).
What exactly should the offset values be? Initially I thought they are
simply the size of the DataArray you are writing, but then I loaded my
ascii version and saved it as a binary file. Comparing the two, it seems pv
adds another variable of sizeof(int). What exactly is this? I cannot find
any hint in the file-format document or anywhere online!

I can send my code again if someone is willing to take a look.

Thanks

On Thu, May 17, 2012 at 8:20 AM, David E DeMarle
<dave.demarle at kitware.com>wrote:

> Something is wrong with this binary file. Paraview opens up other
> binary files just fine, but 3.8 and newer versions of paraview don't
> open up this one.
>
> ParaView appears to failing near vtkDataSetSurfaceFilter.cxx:1097
> where it is trying to process the cells.
>
> Try these to diagnose the specific problem:
> * take a closer look at http://www.vtk.org/VTK/img/file-formats.pdf
> * load this in a simple vtk program that loads and then renders the
> data under a debugger
> * change your writer to convert this binary file to the corresponding
> ascii version.
>
> David E DeMarle
> Kitware, Inc.
> R&D Engineer
> 21 Corporate Drive
> Clifton Park, NY 12065-8662
> Phone: 518-881-4909
>
>
> On Wed, May 16, 2012 at 2:49 PM, Mohammad Mirzadeh <mirzadeh at gmail.com>
> wrote:
> > If it helps, here's the source code and attached is a sample binary file:
> >
> > void QuadTree::writeBinaryVTK(string file_name, vtk_data_format format){
> >
> >
> >     CaslInt num_of_nodes, num_of_cells, num_of_leaf_cells;
> >
> >     CaslInt   node_of_cell[4];
> >
> >     const QuadCell *cell = this -> get_cells();
> >
> >     const QuadNode *node = this -> get_nodes();
> >
> >     double x, y, z;
> >
> >
> >     CaslInt i_max, j_max;
> >
> >     CaslInt i_min, j_min;
> >
> >
> >
> >
> >     num_of_cells = this -> number_of_cells();
> >
> >     num_of_nodes = this -> number_of_nodes();
> >
> >
> >     ofstream binWriter(file_name.c_str(), ios::binary);
> >
> >
> >     binWriter << "# vtk DataFile Version 2.0 \n";
> >
> >     binWriter << "Quadtree Mesh \n";
> >
> >     binWriter << "BINARY \n";
> >
> >     binWriter << "DATASET UNSTRUCTURED_GRID \n";
> >
> >     binWriter << "POINTS " << number_of_nodes() << " double \n";
> >
> >
> >     for (CaslInt n=0; n<num_of_nodes; n++){
> >
> >         x = this -> x_fr_i(node[n].i);
> >
> >         y = this -> y_fr_j(node[n].j);
> >
> >         z = 0.0;
> >
> >
> >         binWriter.write((char*)&x, sizeof(double));
> >
> >         binWriter.write((char*)&y, sizeof(double));
> >
> >         binWriter.write((char*)&z, sizeof(double));
> >
> >     }
> >
> >
> >     num_of_leaf_cells = 0;
> >
> >     for (CaslInt n=0; n<num_of_cells; n++){
> >
> >         if ( cell[n].is_leaf() ) num_of_leaf_cells++;
> >
> >     }
> >
> >     binWriter << "\n";
> >
> >     binWriter << "CELLS " << num_of_leaf_cells << " " <<
> 5*num_of_leaf_cells
> > << "\n";
> >
> >
> >     for (CaslInt n=0; n<num_of_cells; n++){
> >
> >         if ( cell[n].is_leaf() ){
> >
> >             i_min = cell[n].imin;
> >
> >             j_min = cell[n].jmin;
> >
> >             i_max = cell[n].imax();
> >
> >             j_max = cell[n].jmax();
> >
> >
> >
> >             node_of_cell[0] = this ->
> get_node_by_coordinates(i_min,j_min);
> >
> >             node_of_cell[1] = this ->
> get_node_by_coordinates(i_max,j_min);
> >
> >             node_of_cell[2] = this ->
> get_node_by_coordinates(i_max,j_max);
> >
> >             node_of_cell[3] = this ->
> get_node_by_coordinates(i_min,j_max);
> >
> >
> >             int num_of_childs = 4;
> >
> >             binWriter.write((char*)&num_of_childs, sizeof(int));
> >
> >             binWriter.write((char*)&node_of_cell[0], sizeof(int)*4);
> >
> >         }
> >
> >     }
> >
> >     binWriter << "\n";
> >
> >     binWriter << "CELL_TYPES " << num_of_leaf_cells << "\n";
> >
> >
> >     int cell_type = 9;
> >
> >     for (CaslInt n=0; n<num_of_leaf_cells; n++)
> > binWriter.write((char*)&cell_type, sizeof(int));
> >
> >
> >     binWriter << "\n";
> >
> >
> >     switch (format){
> >
> >     case POINT_DATA:{
> >
> >         binWriter << "POINT_DATA " << num_of_nodes << "\n";
> >
> >         break;
> >
> >     }
> >
> >
> >     case CELL_DATA:{
> >
> >         binWriter << "CELL_DATA " << num_of_cells << "\n";
> >
> >         break;
> >
> >     }
> >
> >
> >     }
> >
> >     binWriter.close();
> >
> > }
> >
> > void QuadTree::writeBinaryVTK(ArrayV<double> &F, string data_name, string
> > file_name){
> >
> >
> >     ofstream binWriter(file_name.c_str(), ios::app | ios::binary);
> >
> >
> >     binWriter << "SCALARS " << data_name << " double \n";
> >
> >     binWriter << "LOOKUP_TABLE default \n";
> >
> >
> >     double *pF = (double*)F;
> >
> >     binWriter.write((char*)pF, sizeof(double)*F.size());
> >
> >
> >     binWriter.close();
> >
> > }
> >
> >
> >
> >
> > On Tue, May 15, 2012 at 2:25 PM, Mohammad Mirzadeh <mirzadeh at gmail.com>
> > wrote:
> >>
> >> Hi guys,
> >>
> >> I have a problem getting pv open my binary file. It basically segfaults
> >> and terminates without any information. When I run in gdb I get:
> >>
> >> ERROR: In /build/buildd/paraview-3.8.1/VTK/IO/vtkDataReader.cxx, line
> 1910
> >> vtkUnstructuredGridReader (0x19f6890): Unsupported data type: 1
> >>
> >> Program received signal SIGBUS, Bus error.
> >> 0x00007fffeaeb6597 in
> >> vtkDataSetSurfaceFilter::UnstructuredGridExecute(vtkDataSet*,
> vtkPolyData*)
> >> ()
> >>    from /usr/lib/paraview/libvtkGraphics.so.pv3.8
> >>
> >> Program terminated with signal SIGBUS, Bus error.
> >>
> >> Is there something wrong with my data file? I could send a sample file
> if
> >> needed. I basically followed
> http://www.vtk.org/VTK/img/file-formats.pdf to
> >> write the binary format.
> >>
> >
> >
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the ParaView Wiki at:
> > http://paraview.org/Wiki/ParaView
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.paraview.org/mailman/listinfo/paraview
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20120517/a0b7f469/attachment.htm>


More information about the ParaView mailing list