[vtkusers] [newbie] How to save an array on file

David Doria daviddoria at gmail.com
Tue Dec 7 13:31:10 EST 2010


On Tue, Dec 7, 2010 at 1:07 PM, analisifunzionale
<analisifunzionale at gmail.com> wrote:
> Hi everybody,
>
> I'm trying to save an array on disk.
>
> I'm using vtkArrayWrite to save a vtkLongArray in this way:
>    ---
>    vtkArrayWriter::Write(myArray ,"array_file_name.xml");
>    ---
>
> The compiler give me this error:
>
>    ---
>    error: no matching function for call to
> ‘vtkArrayWriter::Write(vtkSmartPointer<vtkLongArray>&, vtkStdString&)’
>    note: candidates are: bool vtkArrayWriter::Write(const vtkStdString&, bool)
>    note:                 static bool vtkArrayWriter::Write(vtkArray*,
> const vtkStdString&, bool)

You can only write a vtkDenseArray (or vtkSparseArray) with that writer:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Utilities/ArrayWriter

As for the best way to write a "normal" array (vtkLongArray, for
example), I'll defer to someone else.

David



More information about the vtkusers mailing list