[vtk-developers] Fwd: Bug in vtkTreeReader - doesn't get Points correctly

Jeff Baumes jeff.baumes at kitware.com
Wed May 26 14:08:14 EDT 2010


Ok, this fix is published, along with adding more code to
TestDataObjectIO so it checks that points on a tree are
serialized/deserialized correctly.

commit b1c0a28cbc1fca2f754fdec6e4d318d52fcaba45
Author: Jeffrey Baumes <jeff.baumes at kitware.com>
Date:   Wed May 26 14:00:33 2010 -0400

    BUG: Fixing vtkTreeReader to get points correctly.

    Submitted by David Doria.

 IO/vtkTreeReader.cxx |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

commit 2347d15c3b937cf17d83b0bb24eeda048a091036
Author: Jeffrey Baumes <jeff.baumes at kitware.com>
Date:   Wed May 26 14:00:58 2010 -0400

    ENH: Adding testing for vtkPoints on vtkTree IO.

 IO/Testing/Cxx/TestDataObjectIO.cxx |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

Thanks for the fix!

Jeff

On Mon, May 24, 2010 at 6:30 PM, David Doria <daviddoria+vtk at gmail.com> wrote:
> Great, that did it (though I'm still not sure why what I was doing
> didn't work?)
>
> I have attached the new file.
>
> The only change besides
>
> output->SetFieldData(field_data);
> to
> builder->SetFieldData(field_data);
>
> and
>
> this->ReadPoints(output, point_count);
> to
> this->ReadPoints(builder, point_count);
>
> was that I had to move the definition of builder to before the main loop:
>
>
>  vtkSmartPointer<vtkMutableDirectedGraph> builder =
>    vtkSmartPointer<vtkMutableDirectedGraph>::New();
>
>  int done = 0;
>  while(!done)
>
> Either of you care to verify and commit? Also, this should probably be
> checked for by a test at some point.
>
> Thanks for your help,
>
> David
>
>
>
> On Mon, May 24, 2010 at 6:16 PM, Timothy Shead <tshead at sandia.gov> wrote:
>> On 5/24/10 3:25 PM, David Doria wrote:
>>>
>>> Thanks for the quick response. I guess I am doing something wrong with
>>> setting/copying the points.
>>>
>>> Here is a snippet:
>>>
>>>        //this output is correct
>>>       {
>>>       std::cout<<  "Before copy, output:"<<  std::endl;
>>>       double p[3];
>>>       output->GetPoints()->GetPoint(0,p);
>>>       std::cout<<  "p: "<<  p[0]<<  " "<<  p[1]<<  " "<<  p[2]<<  endl;
>>>       }
>>>
>>>       //but with either of these two lines...
>>>       //builder->GetPoints()->DeepCopy(output->GetPoints());
>>>       builder->SetPoints(output->GetPoints());
>>>
>>>       // this output is incorrect (all zeros)
>>>       {
>>>       std::cout<<  "Before copy, builder"<<  std::endl;
>>>       double p[3];
>>>       builder->GetPoints()->GetPoint(0,p);
>>>       std::cout<<  "p: "<<  p[0]<<  " "<<  p[1]<<  " "<<  p[2]<<  endl;
>>>       }
>>>
>>> Is that not how I would "load the points into the builder object
>>> before doing the CheckedShallowCopy"?
>>
>> You're making things much harder than they should be ... try changing
>>
>> this->ReadPoints(output, point_count);
>>
>> to
>>
>> this->ReadPoints(builder, point_count);
>>
>> (same for the field data).
>>
>> Cheers,
>> Tim
>>
>> --
>> Timothy M. Shead
>> Sandia National Laboratories
>> 1424, Data Analysis and Visualization
>>
>>
>



More information about the vtk-developers mailing list