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;"> vtkCellArray *cells = vtkCellArray::New();<br> cells->Allocate(nCells, 10);<br> vtkIdList *ids = vtkIdList::New();
<br> ids->Allocate(3);<br><br> for(i=0; i<nCells; i++) {<br> fscanf(fptr, "%li %li %li %li %li", &junk, &count, &id1, &id2, &id3);<br> if (count != 3) {<br> points->Delete();
<br> BAIL("ADCIRC Elements can only contain 3 points!");<br> }<br> if (id1 > nPoints) { BAIL("Cell contains a point that wasn't loaded!"); }<br> if (id2 > nPoints) { BAIL("Cell contains a point that wasn't loaded!"); }
<br> if (id3 > nPoints) { BAIL("Cell contains a point that wasn't loaded!"); }<br> if (id1 <= 0) { BAIL("Cell contains a point <= 0!"); }<br> if (id2 <= 0) { BAIL("Cell contains a point <= 0!"); }
<br> if (id3 <= 0) { BAIL("Cell contains a point <= 0!"); }<br> ids->Reset();<br> ids->InsertNextId(id1-1);<br> ids->InsertNextId(id2-1);<br> ids->InsertNextId(id3-1);
<br> cells->InsertNextCell(ids);<br> }<br> fclose(fptr);<br><br> vtkPolyData *output = vtkPolyData::New();<br> output->Initialize();<br> output->Allocate();<br> output->SetPoints(points);
<br> output->SetPolys(cells);<br></div><br>3) the modified code, with a vtkUnstructuredGrid<br><div style="margin-left: 40px; font-family: courier new,monospace;"> vtkUnstructuredGrid *output = vtkUnstructuredGrid::New();
<br> output->Initialize();<br> output->Allocate(nCells, 10);<br> output->SetPoints(points);<br> vtkIdList *ids = vtkIdList::New();<br> ids->Allocate(3);<br><br> for(i=0; i<nCells; i++) {<br>
fscanf(fptr, "%li %li %li %li %li", &junk, &count, &id1, &id2, &id3);<br> if (count != 3) {<br> points->Delete();<br> BAIL("ADCIRC Elements can only contain 3 points!");
<br> }<br> if (id1 > nPoints) { BAIL("Cell contains a point that wasn't loaded!"); }<br> if (id2 > nPoints) { BAIL("Cell contains a point that wasn't loaded!"); }<br> if (id3 > nPoints) { BAIL("Cell contains a point that wasn't loaded!"); }
<br> if (id1 <= 0) { BAIL("Cell contains a point <= 0!"); }<br> if (id2 <= 0) { BAIL("Cell contains a point <= 0!"); }<br> if (id3 <= 0) { BAIL("Cell contains a point <= 0!"); }
<br> ids->Reset();<br> ids->InsertNextId(id1-1);<br> ids->InsertNextId(id2-1);<br> ids->InsertNextId(id3-1);<br> output->InsertNextCell(VTK_TRIANGLE, ids);<br> }<br> 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> <<a href="mailto:amy.squillacote@kitware.com">amy.squillacote@kitware.com</a>> 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>> I have some code to load ADCIRC data into memory as vtkPolyData. It's<br>> been working great until yesterday when I tried to pass it to a<br>> vtkThreshold to eliminate some of the "masked" values, and it
<br>> segfaulted. a backtrace showed it somewhere in a<br>> vtkDataArray::GetValue call.<br>><br>> I fought with it for a good while, before I just (on a whim) switched<br>> from vtkPolyData to vtkUnstructuredGrid, with all VTK_TRIANGLE cells.
<br>> And low and behold, it works.<br>><br>> Is there some reason why a vtkPolyData can't be thresholded ( VTK5.0<br>> stable)?<br>><br>> ----------------------------------------<br>> Randall Hand<br>
> Visualization Scientist<br>> ERDC MSRC-ITL<br>> ------------------------------------------------------------------------<br>><br>> _______________________________________________<br>> This is the private VTK discussion list.
<br>> 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>> Follow this link to subscribe/unsubscribe:<br>> <a href="http://www.vtk.org/mailman/listinfo/vtkusers">
http://www.vtk.org/mailman/listinfo/vtkusers</a><br>><br><br></blockquote></div><br><br clear="all"><br>-- <br>----------------------------------------<br>Randall Hand<br>Visualization Scientist<br>ERDC MSRC-ITL