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

Method UpdateBuildTime

Common/DataModel/vtkKdTree.cxx:2751–2830  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

2749
2750//------------------------------------------------------------------------------
2751void vtkKdTree::UpdateBuildTime()
2752{
2753 this->BuildTime.Modified();
2754
2755 // Save enough information so that next time we execute,
2756 // we can determine whether input geometry has changed.
2757
2758 this->InvalidateGeometry();
2759
2760 int numDataSets = this->GetNumberOfDataSets();
2761 if (numDataSets > this->LastDataCacheSize)
2762 {
2763 this->ClearLastBuildCache();
2764
2765 this->LastInputDataSets = new vtkDataSet*[numDataSets];
2766 this->LastDataSetObserverTags = new unsigned long[numDataSets];
2767 this->LastDataSetType = new int[numDataSets];
2768 this->LastInputDataInfo = new double[9 * numDataSets];
2769 this->LastBounds = new double[6 * numDataSets];
2770 this->LastNumPoints = new vtkIdType[numDataSets];
2771 this->LastNumCells = new vtkIdType[numDataSets];
2772 this->LastDataCacheSize = numDataSets;
2773 }
2774
2775 this->LastNumDataSets = numDataSets;
2776
2777 int nextds = 0;
2778
2779 vtkCollectionSimpleIterator cookie;
2780 this->DataSets->InitTraversal(cookie);
2781 for (vtkDataSet* in = this->DataSets->GetNextDataSet(cookie); in != nullptr;
2782 in = this->DataSets->GetNextDataSet(cookie))
2783 {
2784 if (nextds >= numDataSets)
2785 {
2786 vtkErrorMacro(<< "vtkKdTree::UpdateBuildTime corrupt counts");
2787 return;
2788 }
2789
2790 vtkCallbackCommand* cbc = vtkCallbackCommand::New();
2791 cbc->SetCallback(LastInputDeletedCallback);
2792 cbc->SetClientData(this);
2793 this->LastDataSetObserverTags[nextds] = in->AddObserver(vtkCommand::DeleteEvent, cbc);
2794 cbc->Delete();
2795
2796 this->LastInputDataSets[nextds] = in;
2797
2798 this->LastNumPoints[nextds] = in->GetNumberOfPoints();
2799 this->LastNumCells[nextds] = in->GetNumberOfCells();
2800
2801 in->GetBounds(this->LastBounds + 6 * nextds);
2802
2803 int type = this->LastDataSetType[nextds] = in->GetDataObjectType();
2804
2805 if ((type == VTK_IMAGE_DATA) || (type == VTK_UNIFORM_GRID))
2806 {
2807 double origin[3], spacing[3];
2808 int dims[3];

Callers 2

BuildLocatorInternalMethod · 0.95
BuildLocatorMethod · 0.80

Calls 15

InvalidateGeometryMethod · 0.95
GetNumberOfDataSetsMethod · 0.95
ClearLastBuildCacheMethod · 0.95
SetInputDataInfoMethod · 0.95
SetClientDataMethod · 0.80
GetDataObjectTypeMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
ModifiedMethod · 0.45
InitTraversalMethod · 0.45
AddObserverMethod · 0.45
GetNumberOfPointsMethod · 0.45

Tested by

no test coverage detected