<div dir="ltr">YESSSSSSSSS! Alright fixed the problem. This might help other folks having the same problem:<div><br></div><div><a href="http://public.kitware.com/pipermail/paraview/2007-October/006066.html">http://public.kitware.com/pipermail/paraview/2007-October/006066.html</a></div>

<div><br></div><div>Since I know what big pain this is, email me if you needed assistance getting your code working :D<div><br></div><div><br></div><div><div class="gmail_quote">On Thu, May 17, 2012 at 4:13 PM, Mohammad Mirzadeh <span dir="ltr">&lt;<a href="mailto:mirzadeh@gmail.com" target="_blank">mirzadeh@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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&#39;m hopeless when it comes to the binary version.<div>


<br></div><div>It seems that (for xml binary) pv is confused (well, actually I&#39;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!</div>


<div><br></div><div>I can send my code again if someone is willing to take a look.</div><div><br></div><div>Thanks<div><div class="h5"><br><br><div class="gmail_quote">On Thu, May 17, 2012 at 8:20 AM, David E DeMarle <span dir="ltr">&lt;<a href="mailto:dave.demarle@kitware.com" target="_blank">dave.demarle@kitware.com</a>&gt;</span> wrote:<br>


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