[vtkusers] Cast vtkTypedDataArrayIterator to vtkArrayIterator?

Lars Bilke lars.bilke at ufz.de
Tue Oct 28 04:20:06 EDT 2014

I have a similar implementation of a vtkMappedDataArray as in 

vtkCPExodusIIResultsArrayTemplate (https://github.com/Kitware/VTK/blob/master/IO/Exodus/vtkCPExodusIIResultsArrayTemplate.txx).

The mapped data array is part of a vtkMappedUnstructuredGrid as in


and so on. It works fine. Now I try to write the unstructured grid to a file which also works fine in binary mode. But when I switch the vtkXMLUnstructuredGridWriter to ascii mode the member vtkArrayIterator* NewIterator() of my vtkMappedDataArray needs to be implemented. I did not found an example of such an implementation. For now I came up with this:

template <class Scalar> vtkArrayIterator*
	vtkTypedDataArrayIterator<Scalar> tdaBegin = vtkTypedDataArray<Scalar>::FastDownCast(this)->Begin();
	return tdaBegin;

But compilation fails with

error: no viable conversion from 'vtkTypedDataArrayIterator<unsigned int>' to 'vtkArrayIterator *‘

If you want to have a look at my code:



More information about the vtkusers mailing list