[Paraview] pv 3.8 segfaults on opening raw binary files

David E DeMarle dave.demarle at kitware.com
Thu May 17 11:20:28 EDT 2012


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
>


More information about the ParaView mailing list