------------------------------------------------------------------------------
| 1011 | |
| 1012 | //------------------------------------------------------------------------------ |
| 1013 | vtkHyperTree* vtkHyperTreeGrid::GetTree(vtkIdType index, bool create) |
| 1014 | { |
| 1015 | assert("pre: not_tree" && index < this->GetMaxNumberOfTrees()); |
| 1016 | |
| 1017 | // Wrap convenience macro for outside use |
| 1018 | vtkHyperTree* tree = GetHyperTreeFromThisMacro(index); |
| 1019 | |
| 1020 | // Create a new cursor if only required to do so |
| 1021 | if (create && !tree) |
| 1022 | { |
| 1023 | tree = vtkHyperTree::New(); |
| 1024 | if (!tree->Initialize(this->BranchFactor, this->Dimension)) |
| 1025 | { |
| 1026 | vtkGenericWarningMacro("Failed to create hyper tree."); |
| 1027 | return nullptr; |
| 1028 | } |
| 1029 | tree->SetTreeIndex(index); |
| 1030 | this->HyperTrees[index] = tree; |
| 1031 | tree->Delete(); |
| 1032 | |
| 1033 | if (!tree->HasScales()) |
| 1034 | { |
| 1035 | double origin[3]; |
| 1036 | double scale[3]; |
| 1037 | this->GetLevelZeroOriginAndSizeFromIndex(tree->GetTreeIndex(), origin, scale); |
| 1038 | tree->SetScales(std::make_shared<vtkHyperTreeGridScales>(this->BranchFactor, scale)); |
| 1039 | } |
| 1040 | } |
| 1041 | |
| 1042 | return tree; |
| 1043 | } |
| 1044 | |
| 1045 | //------------------------------------------------------------------------------ |
| 1046 | void vtkHyperTreeGrid::SetTree(vtkIdType index, vtkHyperTree* tree) |
no test coverage detected