[Paraview] SafeDownCast to vtkDoubleArray fails

Natalie Happenhofer nataliehapp at hotmail.com
Mon Sep 22 07:51:48 EDT 2008


Hi!
Thx a lot, I get now a DataArray using 
getArr = scaldat ->GetArray(0); //I just have one array in my point data

But still the downcast to vtkDoubleArray fails, here is the code I used:

scaldat = input -> GetPointData();
vtkDataArray *getArr = vtkDataArray::CreateDataArray(VTK_DOUBLE);
getArr = scaldat -> GetArray(0);

 vtkDoubleArray *scalars = vtkDoubleArray::New();
scalars = vtkDoubleArray::SafeDownCast(getArr); //this downcast fails, i.e at runtime I get that warning below
 if(!scalars) vtkErrorMacro("SafeDownCast to vtkDoubleArray failed");


With the member function "IsTypeOf(char *classname)" I tried to find out if getArr is an array of a subclass of vtkDataArray, but this does not seem to be the case. getArr is just a vtkDataArray. But I need to access the values in it!!!

thx, 
NH



> Date: Sun, 21 Sep 2008 11:49:00 -0400
> From: burlen.loring at kitware.com
> To: nataliehapp at hotmail.com
> CC: paraview at paraview.org
> Subject: Re: [Paraview] SafeDownCast to vtkDoubleArray fails
> 
> Natalie Happenhofer wrote:
> > Hi!
> > I need to cast my Point Data to a vtkDoubleArray, but it fails:
> >
> > vtkPointData *scaldat = input -> GetPointData();
> > vtkDoubleArray *scalars = vtkDoubleArray::New();
> > scalars = vtkDoubleArray::SafeDownCast(scaldat);
> > if(!scalars) vtkErrorMacro("SafeDownCast to vtkDoubleArray failed");
> PointData is not an array, it's a container of arrays. To get one of its 
> arrays see the GetArray methods.
> http://www.vtk.org/doc/nightly/html/classvtkFieldData.html#888a6492210426d4ba4d358b87ab198f
> 
> To find this in the documentation you would have to use the inheritance 
> diagrams. PointData "is a" DataSetAttibutes "is a" FieldData and so on.
> 
> >
> > and everytime I run the program I get that vtkErrorMacro.
> > as far as I know from the input files, the PointData should be float, 
> > but casting to vtkFloatArray fails as well. Why? and what can I do 
> > about it?
> >
> > thx a lot,
> > NH
> >
> > ------------------------------------------------------------------------
> > Express yourself instantly with MSN Messenger! MSN Messenger 
> > <http://clk.atdmt.com/AVE/go/onm00200471ave/direct/01/>
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > ParaView mailing list
> > ParaView at paraview.org
> > http://www.paraview.org/mailman/listinfo/paraview
> >   
> 
> 
> -- 
> Burlen Loring
> Kitware, Inc.
> R&D Engineer
> 28 Corporate Drive
> Clifton Park, NY 12065-8662
> Phone: 518-371-3971 x137
> 

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20080922/9c8c18fe/attachment.htm>


More information about the ParaView mailing list