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

analisifunzionale analisifunzionale at gmail.com
Tue Dec 7 13:07:40 EST 2010


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)
    note:                 bool vtkArrayWriter::Write(std::ostream&, bool)
    note:                 static bool vtkArrayWriter::Write(vtkArray*,
std::ostream&, bool)
    ---

To solve I tried with SafeDownCast in this way:

   ---
  vtkArrayWriter::Write(vtkArray::SafeDownCast( myArray ),array_file_name);
  ---

And now I compile but the saved file is empty.

Any hint? Is there a better way to an array on disk?

Thank you,

,af

-- 
Happy hacking!



More information about the vtkusers mailing list