MCPcopy Create free account
hub / github.com/Kitware/VTK / BuildTreeSpheres

Method BuildTreeSpheres

Common/ExecutionModel/vtkSphereTree.cxx:1057–1099  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Compute the sphere tree leafs (i.e., spheres around each cell)

Source from the content-addressed store, hash-verified

1055//------------------------------------------------------------------------------
1056// Compute the sphere tree leafs (i.e., spheres around each cell)
1057void vtkSphereTree::BuildTreeSpheres(vtkDataSet* input)
1058{
1059 // See if anything has to be done
1060 if (this->Tree != nullptr && this->BuildTime > this->MTime)
1061 {
1062 return;
1063 }
1064 else if (this->Tree != nullptr)
1065 {
1066 this->Tree->Delete();
1067 delete[] this->Selected;
1068 }
1069
1070 // Allocate
1071 //
1072 vtkIdType numCells = input->GetNumberOfCells();
1073 vtkDoubleArray* newScalars = vtkDoubleArray::New();
1074 newScalars->SetNumberOfComponents(4);
1075 newScalars->SetNumberOfTuples(input->GetNumberOfCells());
1076 this->Tree = newScalars;
1077 this->TreePtr = newScalars->GetPointer(0);
1078
1079 this->Selected = new unsigned char[numCells];
1080
1081 if (input->GetDataObjectType() == VTK_STRUCTURED_GRID)
1082 {
1083 StructuredSpheres::Execute(vtkStructuredGrid::SafeDownCast(input), this->TreePtr);
1084 }
1085
1086 else if (input->GetDataObjectType() == VTK_UNSTRUCTURED_GRID)
1087 {
1088 UnstructuredSpheres::Execute(numCells, vtkUnstructuredGrid::SafeDownCast(input), this->TreePtr,
1089 this->BuildHierarchy, this->AverageRadius, this->SphereBounds);
1090 }
1091
1092 else // default algorithm
1093 {
1094 DataSetSpheres::Execute(numCells, input, this->TreePtr, this->BuildHierarchy,
1095 this->AverageRadius, this->SphereBounds);
1096 }
1097
1098 this->BuildTime.Modified();
1099}
1100
1101//------------------------------------------------------------------------------
1102void vtkSphereTree::BuildTreeHierarchy(vtkDataSet* input)

Callers 1

BuildMethod · 0.95

Calls 9

GetDataObjectTypeMethod · 0.80
ExecuteFunction · 0.70
DeleteMethod · 0.65
NewFunction · 0.50
GetNumberOfCellsMethod · 0.45
SetNumberOfComponentsMethod · 0.45
SetNumberOfTuplesMethod · 0.45
GetPointerMethod · 0.45
ModifiedMethod · 0.45

Tested by

no test coverage detected