[vtkusers] About variable length vtkCellArray

Andy Bauer andy.bauer at kitware.com
Sat Nov 22 11:42:38 EST 2014


Your code looks to be incomplete or wrong. Your p variable isn't assigned
any dynamic memory.

On Fri, Nov 21, 2014 at 11:34 AM, Feng Chao <fengc at student.ethz.ch> wrote:

>   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
>
> _______________________________________________
> 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 VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20141122/99dd2510/attachment.html>


More information about the vtkusers mailing list