Hello,

I have a particle code that is integrated with Catalyst. It exports
particles using a vtkUnstructuredGrid containing only points and VTK_VERTEX
cells that index them. Initially, the cells were created the following way:





grid->Allocate(num_cells);

vtkIdType cell_id[1];

for(vtkIdType i = 0; i < num_cells; i++) {

cell_id[0] = i;

grid->InsertNextCell(VTK_VERTEX, 1, cell_id);

}







Then I wanted to speed up the process by replacing the Insert method:







vtkSmartPointer<vtkIdTypeArray> cell_ids = vtkSmartPointer<vtkIdTypeArray>::
New();

cell_ids->SetNumberOfComponents(2);

cell_ids->SetNumberOfTuples(num_cells);

for(vtkIdType i = 0; i < num_cells; i++) {

cell_ids->SetTuple2(i, 1, i);

}

vtkSmartPointer<vtkCellArray> cells = vtkSmartPointer<vtkCellArray>::New();

cells->SetCells(num_cells, cell_ids);

grid->SetCells(VTK_VERTEX, cells);






Both approaches work, but when I want to dump the grid by putting the
following lines in co-processing script,




particles_writer = servermanager.writers.XMLPUnstructuredGridWriter(Input=
particles)

coprocessor.RegisterWriter(particles_writer, filename='particles_%t.pvtu',
freq=output_freq)




the first approach works and the latter causes error: 

Program received signal SIGSEGV: Segmentation fault - invalid memory
reference.






What is wrong with the second approach? Thank you.




Best regards,

Petr Valenta




_______________________________________________
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

Reply via email to