[vtkusers] Get Tuple of vtkDataArray

Hal Canary hal at cs.unc.edu
Fri May 18 17:41:37 EDT 2012


On 05/17/2012 03:51 PM, Bayliss, Chris (Chicago) wrote:
> for (vtkIdType c=0 ; c < 5 ; c++)
> {
>   std::cout << "list: " << distvals->GetTuple1(c) << " , "
>      << distvals->GetTuple2(c) << std::endl;
> }
>

Try:

for (vtkIdType c=0 ; c < 5 ; c++)
{
   double * d = distvals->GetTuple2(c);
   std::cout << "list: " << d[0] << " , " << d[1] << std::endl;
}


I don't think that's thread-safe.  Try this instead:

for (vtkIdType c=0 ; c < 5 ; c++)
{
   double d[2];
   distvals->GetTuple(c, &d);
   std::cout << "list: " << d[0] << " , " << d[1] << std::endl;
}




-- 
Hal Canary



More information about the vtkusers mailing list