Dear all,<BR>I want to merge some scalar values (point attributes in an UnstructuredGrid) into a vector and save the result. Later I want to read this file and use the vector for subsequent processing. I use vtkUnstructuredGridReader to read the grid from a file, vtkMergeFields to merge the scalar data into a vector and vtkUnstructuredGridWriter to generate the new file that should include the vector.<BR>&nbsp;<BR>When I read the newly generated file, using vtkUnstructuredGridReader, I get the information that it only contains 1 scalar and no vector. However, loading the file into Paraview 2.4 shows that everything is&nbsp;there. Below I included&nbsp;the code snipped&nbsp;that I use.<BR>&nbsp;<BR>Does somebody have any idea? Do I miss something or do I do something wrong. Help would be appreciated!<BR>&nbsp;<BR>Kind regards,<BR>Bjoern Zehner<BR>&nbsp;<BR><FONT size=2>
<P></FONT><FONT color=#008000 size=2>// Generation the file with a vector</P></FONT><FONT size=2>
<P>myUGridReader-&gt;SetFileName(</FONT><FONT color=#a31515 size=2>"file_with_scalars.vtk"</FONT><FONT size=2>);</P>
<P>numScalars = myUGridReader-&gt;GetNumberOfScalarsInFile();</P>
<P>std::cout &lt;&lt; </FONT><FONT color=#a31515 size=2>"num scalars: "</FONT><FONT size=2> &lt;&lt; numScalars &lt;&lt; std::endl;&nbsp; //----&gt; this works (5 scalars)</P>
<P>myUGridReader-&gt;ReadAllScalarsOn();</P>
<P>myUGridReader-&gt;Update();</P>
<P>vtkMergeFields *merger = vtkMergeFields::New();</P>
<P>merger-&gt;SetInput(myUGridReader-&gt;GetOutput());</P>
<P>merger-&gt;SetOutputField(</FONT><FONT color=#a31515 size=2>"myVector"</FONT><FONT size=2>, vtkMergeFields::POINT_DATA);</P>
<P>merger-&gt;SetNumberOfComponents(3);</P>
<P>merger-&gt;Merge(0, </FONT><FONT color=#a31515 size=2>"VELOCITY_X1"</FONT><FONT size=2>, 0);</P>
<P>merger-&gt;Merge(1, </FONT><FONT color=#a31515 size=2>"VELOCITY_Y1"</FONT><FONT size=2>, 0);</P>
<P>merger-&gt;Merge(2, </FONT><FONT color=#a31515 size=2>"VELOCITY_Z1"</FONT><FONT size=2>, 0);</P>
<P>vtkPointData *p = merger-&gt;GetOutput()-&gt;GetPointData();</P>
<P>p-&gt;SetActiveAttribute(</FONT><FONT color=#a31515 size=2>"myVector"</FONT><FONT size=2>, vtkDataSetAttributes::VECTORS);</P>
<P>myUGridWriter-&gt;SetInput(merger-&gt;GetOutput());</P>
<P>myUGridWriter-&gt;SetFileName(</FONT><FONT color=#a31515 size=2>"file_with_vectors.vtk"</FONT><FONT size=2>);</P>
<P>myUGridWriter-&gt;Write();</P>
<P>//This works. I can read the created file in Paraview 2.4, but now I try to read the file using my own code ...</FONT></P>
<P><FONT color=#008000 size=2>// Reading the generated file</P></FONT><FONT size=2>
<P>someOtherUGridReader-&gt;SetFileName(</FONT><FONT color=#a31515 size=2>"file_with_vectors.vtk"</FONT><FONT size=2>);</P>
<P>numScalars = someOtherUGridReader-&gt;GetNumberOfScalarsInFile();</P>
<P>numVectors = someOtherUGridReader-&gt;GetNumberOfVectorsInFile();</P>
<P>std::cout &lt;&lt; </FONT><FONT color=#a31515 size=2>"read legacy vtk file!"</FONT><FONT size=2> &lt;&lt; std::endl;</P>
<P>std::cout &lt;&lt; </FONT><FONT color=#a31515 size=2>"num scalars: "</FONT><FONT size=2> &lt;&lt; numScalars &lt;&lt; std::endl;</P>
<P>std::cout &lt;&lt; </FONT><FONT color=#a31515 size=2>"num vectors: "</FONT><FONT size=2> &lt;&lt; numVectors &lt;&lt; std::endl;</P></FONT>The result is that there is only one scalar and now vector in the file ....???<BR><BR>------------------------------------------------------------------------- <BR>Dr. Bjoern Zehner <BR>UFZ Centre for Environmental Research Leipzig-Halle <BR>Permoserstrasse 15 <BR>04318 Leipzig <BR>Germany <BR>http://www.ufz.de/index.php?en=5673 <BR>Tel: ++49 (341) 235 3979 <BR>Fax: ++49 (341) 235 3939<BR><BR>