[vtkusers] GetEdgeData->Reset() breaks EdgeData

Aashish Chaudhary aashish.chaudhary at kitware.com
Wed Mar 31 10:34:54 EDT 2010


Quickly looking I am not sure whats wrong. In my code I cannot duplicate
this kind of behavior. The lines you posted is exactly what you doing? If
thats the case I don't know.

May be you can post a small program which reproduces this problem?

~Regards,
Aashish



On Tue, Mar 30, 2010 at 6:10 PM, David Doria
<daviddoria+vtk at gmail.com<daviddoria%2Bvtk at gmail.com>
> wrote:

> On Tue, Mar 30, 2010 at 5:33 PM, Aashish Chaudhary
> <aashish.chaudhary at kitware.com> wrote:
> > Hi David,
> >
> > As I recall
> >
> > Your AddArray() wont do anything.. because its the same array as before
> and
> > Reset does do much other than setting the MaxId to -1 (which means that
> you
> > will get NumberOfTuples to 0 when you query later)
> >
> > vtkIdType GetNumberOfTuples()
> >     {return (this->MaxId + 1)/this->NumberOfComponents;}
> >
> > HTH,
> > Aashish
>
> Hmmm. The reason I ask is that I have this code:
>
> cout << "There are " << g->GetNumberOfEdges() << " edges." << endl; //
> outputs 494
> cout << "There are " << weights->GetNumberOfTuples() << " weights." <<
> endl; //outputs 494
>
> g->GetEdgeData()->AddArray(weights);
>
>  if(!vtkDoubleArray::SafeDownCast(g->GetEdgeData()->GetArray("Weights")))
>    {
>    cout << "No weights!" << endl;
>    }
>  else
>    {
>    cout << "g has " <<
>
> vtkDoubleArray::SafeDownCast(g->GetEdgeData()->GetArray("Weights"))->GetNumberOfTuples()
> << " weights." << endl; //outputs 289 ??!!
>    }
>
> It seems to me like the last output should be the same (494), no?
>
> Anyone know what could be going wrong?
>
> Thanks,
>
> David
>



-- 
| Aashish Chaudhary
| R&D Engineer
| Kitware Inc.
| www.kitware.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100331/5c344d42/attachment.htm>


More information about the vtkusers mailing list