------------------------------------------------------------------------------
| 368 | |
| 369 | //------------------------------------------------------------------------------ |
| 370 | void vtkHyperTreeGrid::CopyStructure(vtkDataObject* ds) |
| 371 | { |
| 372 | vtkHyperTreeGrid* htg = vtkHyperTreeGrid::SafeDownCast(ds); |
| 373 | if (!htg) |
| 374 | { |
| 375 | vtkErrorMacro("Unable to copy structure of a non-HTG or empty data object in an HTG"); |
| 376 | return; |
| 377 | } |
| 378 | |
| 379 | // RectilinearGrid |
| 380 | memcpy(this->Dimensions, htg->GetDimensions(), 3 * sizeof(unsigned int)); |
| 381 | this->SetExtent(htg->GetExtent()); |
| 382 | memcpy(this->CellDims, htg->GetCellDims(), 3 * sizeof(unsigned int)); |
| 383 | this->DataDescription = htg->DataDescription; |
| 384 | |
| 385 | this->WithCoordinates = htg->WithCoordinates; |
| 386 | if (this->WithCoordinates) |
| 387 | { |
| 388 | this->GetXCoordinates()->DeepCopy(htg->XCoordinates); |
| 389 | this->GetYCoordinates()->DeepCopy(htg->YCoordinates); |
| 390 | this->GetZCoordinates()->DeepCopy(htg->ZCoordinates); |
| 391 | } |
| 392 | |
| 393 | // Copy grid parameters |
| 394 | this->BranchFactor = htg->BranchFactor; |
| 395 | this->Dimension = htg->Dimension; |
| 396 | this->Orientation = htg->Orientation; |
| 397 | |
| 398 | memcpy(this->Extent, htg->GetExtent(), 6 * sizeof(int)); |
| 399 | memcpy(this->Axis, htg->GetAxes(), 2 * sizeof(unsigned int)); |
| 400 | this->NumberOfChildren = htg->NumberOfChildren; |
| 401 | this->DepthLimiter = htg->DepthLimiter; |
| 402 | this->TransposedRootIndexing = htg->TransposedRootIndexing; |
| 403 | this->HasInterface = htg->HasInterface; |
| 404 | this->SetInterfaceNormalsName(htg->InterfaceNormalsName); |
| 405 | this->SetInterfaceInterceptsName(htg->InterfaceInterceptsName); |
| 406 | |
| 407 | // Shallow copy masked if needed |
| 408 | this->SetMask(htg->GetMask()); |
| 409 | vtkSetObjectBodyMacro(PureMask, vtkBitArray, htg->GetPureMask()); |
| 410 | |
| 411 | // Search for hyper tree with given index |
| 412 | this->HyperTrees.clear(); |
| 413 | |
| 414 | for (std::map<vtkIdType, vtkSmartPointer<vtkHyperTree>>::const_iterator it = |
| 415 | htg->HyperTrees.begin(); |
| 416 | it != htg->HyperTrees.end(); ++it) |
| 417 | { |
| 418 | vtkNew<vtkHyperTree> tree; |
| 419 | if (!tree->Initialize(this->BranchFactor, this->Dimension)) |
| 420 | { |
| 421 | vtkGenericWarningMacro("Failed to copy structure."); |
| 422 | break; |
| 423 | } |
| 424 | tree->CopyStructure(it->second); |
| 425 | this->HyperTrees[it->first] = tree; |
| 426 | } |
| 427 |
no test coverage detected