------------------------------------------------------------------------------
| 1006 | |
| 1007 | //------------------------------------------------------------------------------ |
| 1008 | vtkUnsignedCharArray* vtkUnstructuredGrid::GetDistinctCellTypesArray() |
| 1009 | { |
| 1010 | if (this->Types == nullptr) |
| 1011 | { |
| 1012 | if (this->DistinctCellTypes == nullptr) |
| 1013 | { |
| 1014 | this->DistinctCellTypes = vtkSmartPointer<vtkCellTypes>::New(); |
| 1015 | } |
| 1016 | return this->DistinctCellTypes->GetCellTypesArray(); |
| 1017 | } |
| 1018 | |
| 1019 | if (this->DistinctCellTypes == nullptr || |
| 1020 | this->Types->GetMTime() > this->DistinctCellTypesUpdateMTime) |
| 1021 | { |
| 1022 | if (this->DistinctCellTypes) |
| 1023 | { |
| 1024 | this->DistinctCellTypes->Reset(); |
| 1025 | } |
| 1026 | else |
| 1027 | { |
| 1028 | this->DistinctCellTypes = vtkSmartPointer<vtkCellTypes>::New(); |
| 1029 | this->DistinctCellTypes->Register(this); |
| 1030 | this->DistinctCellTypes->Delete(); |
| 1031 | } |
| 1032 | if (auto constantTypes = vtkConstantArray<unsigned char>::FastDownCast(this->GetCellTypes())) |
| 1033 | { |
| 1034 | this->DistinctCellTypes->Reset(); |
| 1035 | this->DistinctCellTypes->InsertNextType(constantTypes->GetValue(0)); |
| 1036 | } |
| 1037 | else |
| 1038 | { |
| 1039 | vtkDataSet::GetDistinctCellTypes(this->DistinctCellTypes); |
| 1040 | } |
| 1041 | |
| 1042 | this->DistinctCellTypesUpdateMTime = this->Types->GetMTime(); |
| 1043 | } |
| 1044 | |
| 1045 | return this->DistinctCellTypes->GetCellTypesArray(); |
| 1046 | } |
| 1047 | |
| 1048 | //------------------------------------------------------------------------------ |
| 1049 | vtkUnsignedCharArray* vtkUnstructuredGrid::GetCellTypesArray() |