I went ahead and made a minimal test.<br><br>#include <iostream><br>#include "vtkHyperOctree.h"<br>using namespace std;<br>int main() {<br> vtkHyperOctree* Octree1 = vtkHyperOctree::New();<br> vtkHyperOctree* Octree2 = vtkHyperOctree::New();<br>
Octree2->DeepCopy(Octree1);<br> cout << *Octree1 << std::endl;<br> cout << *Octree2 << std::endl;<br>}<br><br>This will require adding the line (or something similar) to vtkHyperOctree.cxx near line 112 in the PrintSelf method.<br>
<br> os << indent << "CellTree Ptr " << this->CellTree << endl;<br><br>When I ran this I got (for example)<br><br>// From Octree1<br>... normal stuff... <br>CellTree Ptr 0x219f350<br>
<br>// From Octree2<br>... stuff ...<br>CellTree Ptr 0x219f350<br><br><br>Again, I was not expecting this, because now if I modify Octree1 it also modified Octree2. Which is not desired. <br><br clear="all"><div>-- Trevor<br>
</div>
<br><br><div class="gmail_quote">On 15 January 2013 15:44, Trevor Irons <span dir="ltr"><<a href="mailto:trevorirons@gmail.com" target="_blank">trevorirons@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello. I am having a problem with the vtkHyperOctree->DeepCopy method. The underlying CellTree is being shallow copied. <br><br>I made the following modification to vtkHyperOctree.cxx:112<br><br>//-----------------------------------------------------------------------------<br>
// because the PrintSelf test is not smart, PrintSelf has to be here.<br>void vtkHyperOctree::PrintSelf(ostream& os, vtkIndent indent)<br>{<br> this->Superclass::PrintSelf(os,indent);<br><br> os << indent << "Dimension: "<<this->Dimension<<endl;<br>
os << indent << "Size: "<<this->Size[0]<<","<<this->Size[1]<<",";<br> os <<this->Size[2]<<endl;<br> os << indent << "origin: "<<this->Origin[0]<<","<<this->Origin[1]<<",";<br>
os <<this->Origin[2]<<endl;<br><br> os << indent << "DualGridFlag: " << this->DualGridFlag << endl;<br> os << indent << "CellTree Ptr " << this->CellTree << endl; // stream pointer address<br>
//this->CellTree->PrintSelf(os,indent);<br>}<br><br>Just to check the address of the underlying tree. Then in a piece of (c++) code <br><br>vtkHyperOctreeSampleFunction* OctSamp2 = vtkHyperOctreeSampleFunction::New();<br>
vtkHyperOctree* Octree = vtkHyperOctree::New();<br>// Do the sampling<br>this->Octree->DeepCopy(OctSamp2->GetOutput())<br>std::cout << *OctSamp2->GetOutput() << std::endl;<br>std::cout << *Octree << std::endl;<br>
<br>And the two pointer addresses were the same.<br><br>OctSamp2-> GetOutput() ->>>>> CellTree Ptr 0x237fcf0<br>Octree - ->>>>> CellTree Ptr 0x237fcf0<br><br>
Which I did not expect, and is causing errors in my application. Is there a way to get a true deep copy? <br><br>If this is indeed an error I can generate a test file exhibiting the problem. But my method of checking involved mucking with the vtk source file. <br>
<br>Thanks for any help or input. <br><span class="HOEnZb"><font color="#888888"><br clear="all"><div>-- Trevor<br></div>
</font></span></blockquote></div><br>