Is there any reason , you do not want to const_cast it?<div><br></div><div>REgards<br><br><div class="gmail_quote">On Mon, Oct 8, 2012 at 12:37 PM, Nico Schlömer <span dir="ltr">&lt;<a href="mailto:nico.schloemer@gmail.com" target="_blank">nico.schloemer@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">Hi,<br>
<br>
I have a const double array<br>
<br>
  const double * myPointCoordinates;<br>
<br>
and would like to feed it into a VTK unstructured grid as points. I&#39;d<br>
like to pass around the points so what I&#39;m doing is<br>
<br>
  // Build VTK unstructured grid object.<br>
  vtkSmartPointer&lt;vtkUnstructuredGrid&gt; unstructuredGrid =<br>
    vtkSmartPointer&lt;vtkUnstructuredGrid&gt;::New();<br>
  // Set the points.<br>
  const int numPoints = mesh.num_vertices();<br>
  vtkSmartPointer&lt;vtkDoubleArray&gt; pointData =<br>
    vtkSmartPointer&lt;vtkDoubleArray&gt;::New();<br>
  pointData-&gt;SetNumberOfComponents(3);<br>
  pointData-&gt;SetArray(myPointCoordinates, 3*numPoints, 1);<br>
  vtkSmartPointer&lt;vtkPoints&gt; points =<br>
    vtkSmartPointer&lt;vtkPoints&gt;::New();<br>
  points-&gt;SetData(pointData);<br>
  unstructuredGrid-&gt;SetPoints(points);<br>
<br>
This is almost working except for the fact that myPointCoordinates is<br>
const, and the first argument of SetArray() isn&#39;t.<br>
Is there a way around this?<br>
<br>
--Nico<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br></div>