[Paraview] Is there a way to reuse the preivous DataSet from RequestData
Gonzalo Brito Gadeschi
g.brito at aia.rwth-aachen.de
Mon Feb 2 14:00:42 EST 2015
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: g.brito at aia.rwth-aachen.de
Internet: www.aia.rwth-aachen.de
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20150202/5d19c7d8/attachment-0001.html>
More information about the ParaView
mailing list