[vtkusers] Re: writing several scalars in one file (py and C)...
Dominik Szczerba
domi at vision.ee.ethz.ch
Thu Apr 5 05:25:36 EDT 2007
On Wednesday 04 April 2007 21:15, fred wrote:
> fred a écrit :
> > Hi all,
> >
> > I wonder how can I write several scalars in one file, in C and python.
> >
> > In C, I tried something like this:
> >
> > car2[1] = 'v';
> > vtkXMLWriterC_SetPointData(writer, car2, VTK_DATA_TYPE,
> > vtk_tab_scal_v, nbpoints, 1, "SCALARS");
> > car2[1] = 'x';
> > vtkXMLWriterC_SetPointData(writer, car2, VTK_DATA_TYPE,
> > vtk_tab_scal_x, nbpoints, 1, "SCALARS");
> > car2[1] = 'y';
> > vtkXMLWriterC_SetPointData(writer, car2, VTK_DATA_TYPE,
> > vtk_tab_scal_y, nbpoints, 1, "SCALARS");
> > car2[1] = 'z';
> > vtkXMLWriterC_SetPointData(writer, car2, VTK_DATA_TYPE,
> > vtk_tab_scal_z, nbpoints, 1, "SCALARS");
> >
> > vtkXMLWriterC_SetFileName(writer, filename);
> > vtkXMLWriterC_Write(writer);
> > vtkXMLWriterC_Delete(writer);
> >
> > In python, I tried something like this:
>
> Ok, fixed for python using AddArray().
> But not yet for C version :-(
>
> By the way, filling array with InsertNextValue() in for loops
> is very time consuming for large arrays.
> For 571x876x288 cells, it is endless :-(
>
> Any suggestion ?
preallocate the array and write to its buffer.
--ds
>
> Cheers,
--
Dominik Szczerba, PhD
Computer Vision Lab CH-8092 Zurich
http://www.vision.ee.ethz.ch/~domi
More information about the vtkusers
mailing list