[vtkusers] About variable length vtkCellArray

Feng Chao fengc at student.ethz.ch
Fri Nov 21 11:34:19 EST 2014


Dear All,

I am new to VTK. I want to visualize polyhedrons. However in my polyhedrons the number of faces and number of nodes in each face is not known at compile time. Thus if I use vtkCellArray it gave me error message "variable length array "XX" is used". I figured out a solution like this,

vtkIdType* p;
for(int i=0;i<num;i++)
{
    *p=sth;
    p++
}
for(int i=0;i<num;i++)
{
    p--;
}

and it works very well on my test code. Unfortunately I am working with a software using PETSc library and assign dynamic memory this way gives me some PETSc errors. I wonder on VTK side do you have better solution for variable length array like this? For example some class like vtkCellStandardVector to support std::vector of c++?

Thank you!

Best,
Chao

________________________________
Chao Feng (冯超)

Master student in Computational Biology & Bioinformatics
ETH Zürich, Zuerich
Switzerland

Iber Group, Department of Biosystems Science and Engineering,
ETH Zürich, Basel
Switzerland
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20141121/33fe4ba0/attachment.html>


More information about the vtkusers mailing list