------------------------------------------------------------------------------ Create upward links from points to cells that use each point. Enables topologically complex queries.
| 860 | // Create upward links from points to cells that use each point. Enables |
| 861 | // topologically complex queries. |
| 862 | void vtkPolyData::BuildLinks(int initialSize) |
| 863 | { |
| 864 | if (this->Cells == nullptr) |
| 865 | { |
| 866 | this->BuildCells(); |
| 867 | } |
| 868 | if (!this->Points) |
| 869 | { |
| 870 | return; |
| 871 | } |
| 872 | if (!this->Links) |
| 873 | { |
| 874 | if (!this->Editable) |
| 875 | { |
| 876 | this->Links = vtkSmartPointer<vtkStaticCellLinks>::New(); |
| 877 | } |
| 878 | else |
| 879 | { |
| 880 | this->Links = vtkSmartPointer<vtkCellLinks>::New(); |
| 881 | if (initialSize > 0) |
| 882 | { |
| 883 | static_cast<vtkCellLinks*>(this->Links.Get())->Allocate(initialSize); |
| 884 | } |
| 885 | } |
| 886 | this->Links->SetDataSet(this); |
| 887 | } |
| 888 | else if (initialSize > 0 && this->Links->IsA("vtkCellLinks")) |
| 889 | { |
| 890 | static_cast<vtkCellLinks*>(this->Links.Get())->Allocate(initialSize); |
| 891 | this->Links->SetDataSet(this); |
| 892 | } |
| 893 | else if (this->Points->GetMTime() > this->Links->GetMTime()) |
| 894 | { |
| 895 | this->Links->SetDataSet(this); |
| 896 | } |
| 897 | this->Links->BuildLinks(); |
| 898 | } |
| 899 | |
| 900 | //------------------------------------------------------------------------------ |
| 901 | // Copy a cells point ids into list provided. (Less efficient.) |