<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
<font size="-1"><font face="Helvetica, Arial, sans-serif">I think
setting setting up the vector data is the problem.<br>
I have done it like this:<br>
<b><br>
<font face="Courier New, Courier, monospace">vtkDoubleArray *v =
vtkDoubleArray::New();<br>
v->SetNumberOfComponents(3);<br>
v->SetNumberOfTuples(noCells); // noCells = 16000<br>
for (unsigned i = 0; i < noCells; i++){<br>
v->InsertNextTuple3(i,i,i);<br>
}</font></b><br>
<br>
and set it to the structuredGrid like this:<br>
<br>
<b><font face="Courier New, Courier, monospace">sGrid->GetCellData()->SetVectors(v);</font></b><br>
<br>
When running the code I get the following error:<br>
<br>
<b><font face="Courier New, Courier, monospace">Cell array with 3
components has 32000 tuples but there are only 16000 cells.</font><br>
</b><br>
Whats wrong?<br>
I think there is a basic misunderstand between cellData, Array,
DoubleArray and Vector here?!<br>
</font></font><br>
Am 19.02.2010 14:49, schrieb David Doria:
<blockquote
cite="mid:c19fcadc1002190549k3a8aeb51o36853e7daf87f062@mail.gmail.com"
type="cite">
<div>
<div class="gmail_quote">On Fri, Feb 19, 2010 at 8:41 AM, Sebastian
Gatzka <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:sebastian.gatzka@stud.tu-darmstadt.de">sebastian.gatzka@stud.tu-darmstadt.de</a>></span>
wrote:<br>
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="purple" lang="DE">
<div>
<p class="MsoNormal"><span
style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">As far
as I am concerned accessing is not the problem.</span></p>
<p class="MsoNormal"><span
style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">But how
to set a specific value (may is be scalar or vector) to the
cell is what I want to do!</span></p>
<p class="MsoNormal"><span
style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US"></span></p>
</div>
</div>
</blockquote>
</div>
You have to add an array containing the data for all the cells to the
CellData of the grid. Here is an example (uses PolyData instead of
StructuredGrid, but it should work the same):</div>
<div><br>
</div>
<div><a moz-do-not-send="true"
href="http://www.vtk.org/Wiki/VTK/Examples/MiscCellData">http://www.vtk.org/Wiki/VTK/Examples/MiscCellData</a>
<div><br>
</div>
<div>The key line is</div>
<div><br>
</div>
<div> polydata->GetCellData()->AddArray(triangleData);</div>
<div><br>
</div>
<div>Hope that helps,</div>
<div><br>
David</div>
</div>
</blockquote>
</body>
</html>