<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>
Hi!<br>Thx a lot, I get now a DataArray using <br>getArr = scaldat ->GetArray(0); //I just have one array in my point data<br><br>But still the downcast to vtkDoubleArray fails, here is the code I used:<br><br>scaldat = input -> GetPointData();<br>vtkDataArray *getArr = vtkDataArray::CreateDataArray(VTK_DOUBLE);<br>getArr = scaldat -> GetArray(0);<br><br> vtkDoubleArray *scalars = vtkDoubleArray::New();<br>scalars = vtkDoubleArray::SafeDownCast(getArr); //this downcast fails, i.e at runtime I get that warning below<br> if(!scalars) vtkErrorMacro("SafeDownCast to vtkDoubleArray failed");<br><br><br>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!!!<br><br>thx, <br>NH<br><br><br><br>> Date: Sun, 21 Sep 2008 11:49:00 -0400<br>> From: burlen.loring@kitware.com<br>> To: nataliehapp@hotmail.com<br>> CC: paraview@paraview.org<br>> Subject: Re: [Paraview] SafeDownCast to vtkDoubleArray fails<br>> <br>> Natalie Happenhofer wrote:<br>> > Hi!<br>> > I need to cast my Point Data to a vtkDoubleArray, but it fails:<br>> ><br>> > vtkPointData *scaldat = input -> GetPointData();<br>> > vtkDoubleArray *scalars = vtkDoubleArray::New();<br>> > scalars = vtkDoubleArray::SafeDownCast(scaldat);<br>> > if(!scalars) vtkErrorMacro("SafeDownCast to vtkDoubleArray failed");<br>> PointData is not an array, it's a container of arrays. To get one of its <br>> arrays see the GetArray methods.<br>> http://www.vtk.org/doc/nightly/html/classvtkFieldData.html#888a6492210426d4ba4d358b87ab198f<br>> <br>> To find this in the documentation you would have to use the inheritance <br>> diagrams. PointData "is a" DataSetAttibutes "is a" FieldData and so on.<br>> <br>> ><br>> > and everytime I run the program I get that vtkErrorMacro.<br>> > as far as I know from the input files, the PointData should be float, <br>> > but casting to vtkFloatArray fails as well. Why? and what can I do <br>> > about it?<br>> ><br>> > thx a lot,<br>> > NH<br>> ><br>> > ------------------------------------------------------------------------<br>> > Express yourself instantly with MSN Messenger! MSN Messenger <br>> > <http://clk.atdmt.com/AVE/go/onm00200471ave/direct/01/><br>> > ------------------------------------------------------------------------<br>> ><br>> > _______________________________________________<br>> > ParaView mailing list<br>> > ParaView@paraview.org<br>> > http://www.paraview.org/mailman/listinfo/paraview<br>> > <br>> <br>> <br>> -- <br>> Burlen Loring<br>> Kitware, Inc.<br>> R&D Engineer<br>> 28 Corporate Drive<br>> Clifton Park, NY 12065-8662<br>> Phone: 518-371-3971 x137<br>> <br><br /><hr />Express yourself instantly with MSN Messenger! <a href='http://clk.atdmt.com/AVE/go/onm00200471ave/direct/01/' target='_new'>MSN Messenger</a></body>
</html>