[Paraview] specifying cell data

Michael Jackson mike.jackson at bluequartz.net
Thu Feb 26 09:19:43 EST 2009


Been a while but you may need output->BuildLinks();

You can also do output->Printself(std::cout, vtkIndent);// Or  
something like that

to see if you are really getting what you _think_ you are producing.

_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio



On Feb 26, 2009, at 8:05 AM, Natalie Happenhofer wrote:

> 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
>
> con Windows Live Messenger comparte fotos mientras charlas. El doble  
> de diversión:_______________________________________________
> 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



More information about the ParaView mailing list