Hi Tomislav, Are you aware of vtk polyhedron support (http://www.vtk.org/Wiki/VTK/Polyhedron_Support)? Instead of manipulating the polydata structure yourself, you can insert the polyhedrons into an vtkUnstructuredGrid and then save the unstructured grid using vtkXMLUnstructuredGridWriter. There are some examples in Graphics/TestPolyhedron0(1).cxx.
Thanks. Hua > ---------- Forwarded message ---------- > From: Tomislav Maric <tomislav.ma...@gmx.com> > Date: Wed, Jun 29, 2011 at 5:09 AM > Subject: [Paraview] writing a bunch of polyhedrons > To: paraview@paraview.org > > > Hi everyone, > > I have a list of polyhedrons which have arbitrary shape, and I would > like to write them all down > into a single .vtk file. I am using the POLYDATA data set. Right now, > my option is: > > init global points > init global faces > > for all polyhedra: > get local points > get local faces > add local points to global points > map+add local faces to global faces > > open the file for writing > write the .vtk header for POLYDATA > > for all points: > write the points > > for all faces: > write the polygons > > Is it possible to make this more effective? Right now I am duplicating > my information when copying/mapping > to global lists. If I want to write into this file without copying the > polyhedron data, I will still need > a memory buffer to store the file from the insertion point on, and it > would be needed twice for each > polyhedron: > > file::seek up > > write the points > > file::seek down > > write the faces > > and at the end, I would need to insert the > > POINTS nPoints dataType > > and > > POLYGONS n size > > at apropriate places. > > Any advice would be appreciated! :) > > Thanks! > _______________________________________________ > 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 > > Follow this link to subscribe/unsubscribe: > http://www.paraview.org/mailman/listinfo/paraview > -- Hua Yang, Ph. D. R&D Engineer, Kitware, Inc. 1-919-969-6990 x 309 _______________________________________________ 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 Follow this link to subscribe/unsubscribe: http://www.paraview.org/mailman/listinfo/paraview