Well, I'll see if I can find a dataset to replicate the problem and drop it to you guys.<br><br>In the meantime, just some more info:<br>1) The stack trace contained solely the vtkDataArray::Get line, no further information... Guess Debug flags are disabled somewhere...
<br>2) The code with a vtkPolyData:<br><br><div style="margin-left: 40px; font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; vtkCellArray *cells = vtkCellArray::New();<br>&nbsp;&nbsp;&nbsp; cells-&gt;Allocate(nCells, 10);<br>&nbsp;&nbsp;&nbsp; vtkIdList *ids = vtkIdList::New();
<br>&nbsp;&nbsp;&nbsp; ids-&gt;Allocate(3);<br><br>&nbsp;&nbsp;&nbsp; for(i=0; i&lt;nCells; i++) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fscanf(fptr, &quot;%li %li %li %li %li&quot;, &amp;junk, &amp;count, &amp;id1, &amp;id2, &amp;id3);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (count != 3) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; points-&gt;Delete();
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BAIL(&quot;ADCIRC Elements can only contain 3 points!&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (id1 &gt; nPoints) { BAIL(&quot;Cell contains a point that wasn't loaded!&quot;); }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (id2 &gt; nPoints) { BAIL(&quot;Cell contains a point that wasn't loaded!&quot;); }
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (id3 &gt; nPoints) { BAIL(&quot;Cell contains a point that wasn't loaded!&quot;); }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (id1 &lt;= 0) { BAIL(&quot;Cell contains a point &lt;= 0!&quot;); }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (id2 &lt;= 0) { BAIL(&quot;Cell contains a point &lt;= 0!&quot;); }
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (id3 &lt;= 0) { BAIL(&quot;Cell contains a point &lt;= 0!&quot;); }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ids-&gt;Reset();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ids-&gt;InsertNextId(id1-1);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ids-&gt;InsertNextId(id2-1);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ids-&gt;InsertNextId(id3-1);
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cells-&gt;InsertNextCell(ids);<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; fclose(fptr);<br><br>&nbsp;&nbsp;&nbsp;&nbsp; vtkPolyData *output = vtkPolyData::New();<br>&nbsp;&nbsp;&nbsp;&nbsp; output-&gt;Initialize();<br>&nbsp;&nbsp;&nbsp;&nbsp; output-&gt;Allocate();<br>&nbsp;&nbsp;&nbsp;&nbsp; output-&gt;SetPoints(points);
<br>&nbsp;&nbsp;&nbsp;&nbsp; output-&gt;SetPolys(cells);<br></div><br>3) the modified code, with a vtkUnstructuredGrid<br><div style="margin-left: 40px; font-family: courier new,monospace;">&nbsp;&nbsp;&nbsp; vtkUnstructuredGrid *output = vtkUnstructuredGrid::New();
<br>&nbsp;&nbsp;&nbsp; output-&gt;Initialize();<br>&nbsp;&nbsp;&nbsp; output-&gt;Allocate(nCells, 10);<br>&nbsp;&nbsp;&nbsp; output-&gt;SetPoints(points);<br>&nbsp;&nbsp;&nbsp; vtkIdList *ids = vtkIdList::New();<br>&nbsp;&nbsp;&nbsp; ids-&gt;Allocate(3);<br><br>&nbsp;&nbsp;&nbsp; for(i=0; i&lt;nCells; i++) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fscanf(fptr, &quot;%li %li %li %li %li&quot;, &amp;junk, &amp;count, &amp;id1, &amp;id2, &amp;id3);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (count != 3) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; points-&gt;Delete();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BAIL(&quot;ADCIRC Elements can only contain 3 points!&quot;);
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (id1 &gt; nPoints) { BAIL(&quot;Cell contains a point that wasn't loaded!&quot;); }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (id2 &gt; nPoints) { BAIL(&quot;Cell contains a point that wasn't loaded!&quot;); }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (id3 &gt; nPoints) { BAIL(&quot;Cell contains a point that wasn't loaded!&quot;); }
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (id1 &lt;= 0) { BAIL(&quot;Cell contains a point &lt;= 0!&quot;); }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (id2 &lt;= 0) { BAIL(&quot;Cell contains a point &lt;= 0!&quot;); }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (id3 &lt;= 0) { BAIL(&quot;Cell contains a point &lt;= 0!&quot;); }
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ids-&gt;Reset();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ids-&gt;InsertNextId(id1-1);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ids-&gt;InsertNextId(id2-1);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ids-&gt;InsertNextId(id3-1);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; output-&gt;InsertNextCell(VTK_TRIANGLE, ids);<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; fclose(fptr);
<br></div><br>So for reference, 2 things changed between the two pieces of code:<br>1) went from vtkPolyData to vtkUnstructuredGrid<br>2) Went from assigned all the cells in 1 shot with a vtkCellArray * SetPolys, to individually adding each cell to the output Dataset.
<br><br><br><br><div><span class="gmail_quote">On 6/14/06, <b class="gmail_sendername">Amy Squillacote</b> &lt;<a href="mailto:amy.squillacote@kitware.com">amy.squillacote@kitware.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Randall,<br><br>vtkThreshold should be able to handle vtkPolyData; it accepts any type<br>of vtkDataSet as input, and there's no apparent limitation on the type<br>of cells that can be contained in the dataset to be thresholded. Would
<br>you please post the stack trace? If you have a small dataset that can be<br>used to reproduce the problem (and that you would be able to post), that<br>would be very helpful as well.<br><br>- Amy<br><br>Randall Hand wrote:
<br>&gt; I have some code to load ADCIRC data into memory as vtkPolyData.&nbsp;&nbsp;It's<br>&gt; been working great until yesterday when I tried to pass it to a<br>&gt; vtkThreshold to eliminate some of the &quot;masked&quot; values, and it
<br>&gt; segfaulted.&nbsp;&nbsp;a backtrace showed it somewhere in a<br>&gt; vtkDataArray::GetValue call.<br>&gt;<br>&gt; I fought with it for a good while, before I just (on a whim) switched<br>&gt; from vtkPolyData to vtkUnstructuredGrid, with all VTK_TRIANGLE cells.
<br>&gt; And low and behold, it works.<br>&gt;<br>&gt; Is there some reason why a vtkPolyData can't be thresholded ( VTK5.0<br>&gt; stable)?<br>&gt;<br>&gt; ----------------------------------------<br>&gt; Randall Hand<br>
&gt; Visualization Scientist<br>&gt; ERDC MSRC-ITL<br>&gt; ------------------------------------------------------------------------<br>&gt;<br>&gt; _______________________________________________<br>&gt; This is the private VTK discussion list.
<br>&gt; Please keep messages on-topic. Check the FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ">http://www.vtk.org/Wiki/VTK_FAQ</a><br>&gt; Follow this link to subscribe/unsubscribe:<br>&gt; <a href="http://www.vtk.org/mailman/listinfo/vtkusers">
http://www.vtk.org/mailman/listinfo/vtkusers</a><br>&gt;<br><br></blockquote></div><br><br clear="all"><br>-- <br>----------------------------------------<br>Randall Hand<br>Visualization Scientist<br>ERDC MSRC-ITL