------------------------------------------------------------------------------
| 134 | |
| 135 | //------------------------------------------------------------------------------ |
| 136 | void vtkDataObjectTree::CopyStructure(vtkCompositeDataSet* compositeSource) |
| 137 | { |
| 138 | if (!compositeSource) |
| 139 | { |
| 140 | return; |
| 141 | } |
| 142 | auto dObjTree = vtkDataObjectTree::SafeDownCast(compositeSource); |
| 143 | if (dObjTree == this) |
| 144 | { |
| 145 | return; |
| 146 | } |
| 147 | |
| 148 | this->Superclass::CopyStructure(compositeSource); |
| 149 | this->Internals->Children.clear(); |
| 150 | |
| 151 | if (dObjTree) |
| 152 | { |
| 153 | this->Internals->Children.resize(dObjTree->Internals->Children.size()); |
| 154 | |
| 155 | for (auto dObjTreeIter = dObjTree->Internals->Children.begin(), |
| 156 | thisIter = this->Internals->Children.begin(); |
| 157 | dObjTreeIter != dObjTree->Internals->Children.end(); ++dObjTreeIter, ++thisIter) |
| 158 | { |
| 159 | vtkDataObjectTree* subDObjTree = vtkDataObjectTree::SafeDownCast(dObjTreeIter->DataObject); |
| 160 | if (subDObjTree) |
| 161 | { |
| 162 | if (vtkDataObjectTree* copy = this->CreateForCopyStructure(subDObjTree)) |
| 163 | { |
| 164 | thisIter->DataObject.TakeReference(copy); |
| 165 | copy->CopyStructure(subDObjTree); |
| 166 | } |
| 167 | else |
| 168 | { |
| 169 | vtkErrorMacro("CopyStructure has encountered an error and will fail!"); |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | // shallow copy meta data. |
| 174 | if (dObjTreeIter->MetaData) |
| 175 | { |
| 176 | vtkNew<vtkInformation> info; |
| 177 | info->Copy(dObjTreeIter->MetaData, /*deep=*/0); |
| 178 | thisIter->MetaData = info; |
| 179 | } |
| 180 | } |
| 181 | } |
| 182 | else |
| 183 | { |
| 184 | // WARNING: |
| 185 | // If we copy the structure from a non-tree composite data set |
| 186 | // we create a special structure of two levels, the first level |
| 187 | // is just a single partitioned dataSet and the second level are all the data sets. |
| 188 | // This is likely to change in the future! |
| 189 | vtkNew<vtkPartitionedDataSet> tempPds; |
| 190 | auto pds = vtk::TakeSmartPointer(this->CreateForCopyStructure(tempPds)); |
| 191 | this->SetChild(0, pds); |
| 192 | |
| 193 | vtkNew<vtkInformation> info; |
nothing calls this directly
no test coverage detected