<div dir="ltr">Your code looks to be incomplete or wrong. Your p variable isn't assigned any dynamic memory.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 21, 2014 at 11:34 AM, Feng Chao <span dir="ltr"><<a href="mailto:fengc@student.ethz.ch" target="_blank">fengc@student.ethz.ch</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">Dear All,<br>
<br>
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,<br>
<br>
vtkIdType* p;<br>
for(int i=0;i<num;i++)<br>
{<br>
*p=sth;<br>
p++<br>
}<br>
for(int i=0;i<num;i++)<br>
{<br>
p--;<br>
}<br>
<br>
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++?<br>
<br>
Thank you!<br>
<div><br>
<div style="font-family:Tahoma;font-size:13px">
<div style="font-family:Tahoma;font-size:13px">
<div style="font-family:Tahoma;font-size:13px">
<div style="font-family:Tahoma;font-size:13px">
<div style="font-family:Tahoma;font-size:13px">
<div style="font-family:Tahoma;font-size:13px">Best,
<div>Chao</div>
<div><br>
</div>
<div>
<hr>
</div>
<div>Chao Feng (冯超)<br>
<br>
</div>
<div>Master student in Computational Biology & Bioinformatics</div>
<div>ETH Zürich, Zuerich</div>
<div>Switzerland</div>
<div><br>
</div>
<div>Iber Group, Department of Biosystems Science and Engineering,</div>
<div>ETH Zürich, Basel</div>
<div>Switzerland</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br></div>