<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
Just for testing I wrote a filter which should draw an unstructured grid with one cell, here is the code (i.e. the RequestData(...) routine:<br><br>int vtkTestUnstructuredGrid::RequestData(vtkInformation* vtkNotUsed(request),<br> vtkInformationVector **inputVector,<br> vtkInformationVector *outputVector)<br>{ //get the input and the output<br> vtkDataSet* input = vtkDataSet::GetData(inputVector[0]);<br> vtkUnstructuredGrid* output = vtkUnstructuredGrid::GetData(outputVector);<br><br> vtkPoints* pts = vtkPoints::New();<br> pts -> InsertNextPoint(0,0,0); //0<br> pts -> InsertNextPoint(1,-1,0);<br> pts -> InsertNextPoint(1,1,0);<br> pts -> InsertNextPoint(0.5,0,1);<br><br> output -> SetPoints(pts);<br> int numOfPoints = output -> GetNumberOfPoints();<br><br> vtkTetra* tetra = vtkTetra::New();<br> tetra -> GetPointIds() -> SetId(0,0);<br> tetra -> GetPointIds() -> SetId(1,1);<br> tetra -> GetPointIds() -> SetId(2,2);<br> tetra -> GetPointIds() -> SetId(3,3);<br><br>output -> InsertNextCell(tetra -> GetCellType(), tetra -> GetPointIds());<br>int numOfCells = output -> GetNumberOfCells();<br><br>tetra -> Delete();<br> return 1;<br>}<br><br><br>Debugging, I find that the points have been inserted correctly to the output, but I still have a problem with the cell. Executing the filter, I get a segmentation fault, originated by <br><br>output -> InsertNextCell(tetra -> GetCellType(), tetra -> GetPointIds());<br><br>Do I need to allocate memory separately for the cells, or..? <br><br>thx a lot,<br>Natalie<br><br><br><br><br>> Date: Wed, 25 Feb 2009 09:11:23 -0500<br>> Subject: Re: [Paraview] specifying cell data<br>> From: dave.demarle@kitware.com<br>> To: nataliehapp@hotmail.com<br>> CC: paraview@paraview.org<br>> <br>> vtkIdType ptids[4];<br>> ptids[0] = firstpointid;<br>> ptids[1] = secondpointid;<br>> ptids[2] = thirdpointid;<br>> ptids[3] = fourthpointid;<br>> <br>> vtkUnstructuredGrid *myUG = vtkUnstructuredGrid::SafeDownCast(<br>> this->GetOutputDataObject(0));<br>> myUG->InsertNextCell(VTK_QUAD, 4, ptids);<br>> <br>> On Wed, Feb 25, 2009 at 5:58 AM, Natalie Happenhofer<br>> <nataliehapp@hotmail.com> wrote:<br>> > Hi!<br>> > I´m writing a filter that has as output an Unstructured Grid. As far as I<br>> > know, to specify that grid, I need to specify the points and the cells. I´m<br>> > wondering how to specify the cells - I need quadrilaterals. How can I<br>> > specify them? I need a routine which lets me specify the points (4 in that<br>> > case) and then insert it into a vtkCellList, which I can assign to the<br>> > output.<br>> ><br>> > thx,<br>> > Natalie<br>> ><br>> > ________________________________<br>> > Adminístralas todas usando Windows Live Mail. ¡Descárgalo gratis! ¿Tienes<br>> > más de una cuenta de correo?<br>> > _______________________________________________<br>> > Powered by www.kitware.com<br>> ><br>> > Visit other Kitware open-source projects at<br>> > http://www.kitware.com/opensource/opensource.html<br>> ><br>> > Please keep messages on-topic and check the ParaView Wiki at:<br>> > http://paraview.org/Wiki/ParaView<br>> ><br>> > Follow this link to subscribe/unsubscribe:<br>> > http://www.paraview.org/mailman/listinfo/paraview<br>> ><br>> ><br>> <br>> <br>> <br>> -- <br>> David E DeMarle<br>> Kitware, Inc.<br>> R&D Engineer<br>> 28 Corporate Drive<br>> Clifton Park, NY 12065-8662<br>> Phone: 518-371-3971 x109<br><br /><hr />con Windows Live Messenger comparte fotos mientras charlas. <a href='http://www.microsoft.com/windows/windowslive/products/messenger.aspx' target='_new'>El doble de diversión:</a></body>
</html>