The only way is to cache it in the reader itself. Create a new vtkUnstructuredGrid and ShallowCopy the contents of your "output" to it at the end of your RequestData().
Utkarsh On Mon, Feb 2, 2015 at 2:00 PM, Gonzalo Brito Gadeschi <[email protected]> wrote: > In a reader plugin for unstructured grids, after the plugin opens a file, > and paraview calls RequestData for the first time, I initialize the grid > like: > > vtkInformation* outInfo = outputVector->GetInformationObject(0); > vtkDataSet* output = vtkDataSet::GetData(outInfo); > vtk_grid = vtkUnstructuredGrid::SafeDownCast(output); > > vtk_grid->Initialize(); > vtk_grid->Allocate(0); > vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New(); > vtk_grid->SetPoints(points); > // create grid points, cells.. > // load cell data fields (the user can control this via the plugin > interface) > > If the user then decides to load/unload some fields, I would like to reuse > the loaded points and cells, and just update/add/remove fields. > > The problem comes when in subsequent calls to RequestData: > > vtkInformation* outInfo = outputVector->GetInformationObject(0); > vtkDataSet* output = vtkDataSet::GetData(outInfo); > > // this asserts works: > assert(old_vtk_grid == vtkUnstructuredGrid::SafeDownCast(output)); > // this assert fails: the number of points is 0.. > assert(old_number_of_points == vtk_grid->GetNumberOfPoints()); > // this produces a segmentation fault > assert(old_number_of_cells == vtk_grid->GetCells()->GetNumberOfCells()); > > That is, even tho the grid pointer that gets passed to RequestData points to > the same memory as before, it seems that the grid is "empty" (number of > points is 0). > > Is there a way to preserve the grid state between calls to RequestData? > > Bests, > Gonzalo > > -- > Dipl.-Ing. Gonzalo Brito Gadeschi > Institute of Aerodynamics and Chair of Fluid Mechanics > RWTH Aachen University > Wuellnerstraße 5a > D-52062 Aachen > Germany > Phone: ++49-(0)241-80-94821 > Fax: ++49-(0)241-80-92257 > E-mail: [email protected] > Internet: www.aia.rwth-aachen.de > > _______________________________________________ > 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 > > Search the list archives at: http://markmail.org/search/?q=ParaView > > Follow this link to subscribe/unsubscribe: > http://public.kitware.com/mailman/listinfo/paraview > _______________________________________________ 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 Search the list archives at: http://markmail.org/search/?q=ParaView Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/paraview
