[Paraview] specifying cell data

Natalie Happenhofer nataliehapp at hotmail.com
Thu Feb 26 08:05:47 EST 2009


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:

int vtkTestUnstructuredGrid::RequestData(vtkInformation* vtkNotUsed(request),
                                      vtkInformationVector **inputVector,
                                      vtkInformationVector *outputVector)
{ //get the input and the output
 vtkDataSet* input = vtkDataSet::GetData(inputVector[0]);
 vtkUnstructuredGrid* output = vtkUnstructuredGrid::GetData(outputVector);

 vtkPoints* pts = vtkPoints::New();
 pts -> InsertNextPoint(0,0,0); //0
 pts -> InsertNextPoint(1,-1,0);
 pts -> InsertNextPoint(1,1,0);
 pts -> InsertNextPoint(0.5,0,1);

 output -> SetPoints(pts);
 int numOfPoints = output -> GetNumberOfPoints();

 vtkTetra* tetra = vtkTetra::New();
 tetra -> GetPointIds() -> SetId(0,0);
 tetra -> GetPointIds() -> SetId(1,1);
 tetra -> GetPointIds() -> SetId(2,2);
 tetra -> GetPointIds() -> SetId(3,3);

output -> InsertNextCell(tetra -> GetCellType(), tetra -> GetPointIds());
int numOfCells = output -> GetNumberOfCells();

tetra -> Delete();
 return 1;
}


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  

output -> InsertNextCell(tetra -> GetCellType(), tetra -> GetPointIds());

Do I need to allocate memory separately for the cells, or..? 

thx a lot,
Natalie




> Date: Wed, 25 Feb 2009 09:11:23 -0500
> Subject: Re: [Paraview] specifying cell data
> From: dave.demarle at kitware.com
> To: nataliehapp at hotmail.com
> CC: paraview at paraview.org
> 
> vtkIdType ptids[4];
> ptids[0] = firstpointid;
> ptids[1] = secondpointid;
> ptids[2] = thirdpointid;
> ptids[3] = fourthpointid;
> 
> vtkUnstructuredGrid *myUG = vtkUnstructuredGrid::SafeDownCast(
>   this->GetOutputDataObject(0));
> myUG->InsertNextCell(VTK_QUAD, 4, ptids);
> 
> On Wed, Feb 25, 2009 at 5:58 AM, Natalie Happenhofer
> <nataliehapp at hotmail.com> wrote:
> > Hi!
> > I´m writing a filter that has as output an Unstructured Grid. As far as I
> > know, to specify that grid, I need to specify the points and the cells. I´m
> > wondering how to specify the cells - I need quadrilaterals. How can I
> > specify them? I need a routine which lets me specify the points (4 in that
> > case) and then insert it into a vtkCellList, which I can assign to the
> > output.
> >
> > thx,
> > Natalie
> >
> > ________________________________
> > Adminístralas todas usando Windows Live Mail. ¡Descárgalo gratis! ¿Tienes
> > más de una cuenta de correo?
> > _______________________________________________
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the ParaView Wiki at:
> > http://paraview.org/Wiki/ParaView
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.paraview.org/mailman/listinfo/paraview
> >
> >
> 
> 
> 
> -- 
> David E DeMarle
> Kitware, Inc.
> R&D Engineer
> 28 Corporate Drive
> Clifton Park, NY 12065-8662
> Phone: 518-371-3971 x109

_________________________________________________________________
Permanece actualizado con MSN Noticias. Clic aquí
http://noticias.latam.msn.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20090226/03019a3b/attachment-0001.htm>


More information about the ParaView mailing list