------------------------------------------------------------------------------
| 682 | |
| 683 | //------------------------------------------------------------------------------ |
| 684 | int vtkDataSet::CheckAttributes() |
| 685 | { |
| 686 | vtkIdType numPts, numCells; |
| 687 | int numArrays, idx; |
| 688 | vtkAbstractArray* array; |
| 689 | vtkIdType numTuples; |
| 690 | const char* name; |
| 691 | |
| 692 | numArrays = this->GetPointData()->GetNumberOfArrays(); |
| 693 | if (numArrays > 0) |
| 694 | { |
| 695 | // This call can be expensive. |
| 696 | numPts = this->GetNumberOfPoints(); |
| 697 | for (idx = 0; idx < numArrays; ++idx) |
| 698 | { |
| 699 | array = this->GetPointData()->GetAbstractArray(idx); |
| 700 | numTuples = array->GetNumberOfTuples(); |
| 701 | name = array->GetName(); |
| 702 | if (name == nullptr) |
| 703 | { |
| 704 | name = ""; |
| 705 | } |
| 706 | if (numTuples < numPts) |
| 707 | { |
| 708 | vtkErrorMacro("Point array " << name << " with " << array->GetNumberOfComponents() |
| 709 | << " components, only has " << numTuples |
| 710 | << " tuples but there are " << numPts << " points"); |
| 711 | return 1; |
| 712 | } |
| 713 | if (numTuples > numPts) |
| 714 | { |
| 715 | vtkWarningMacro("Point array " << name << " with " << array->GetNumberOfComponents() |
| 716 | << " components, has " << numTuples |
| 717 | << " tuples but there are only " << numPts << " points"); |
| 718 | } |
| 719 | } |
| 720 | } |
| 721 | |
| 722 | numArrays = this->GetCellData()->GetNumberOfArrays(); |
| 723 | if (numArrays > 0) |
| 724 | { |
| 725 | // This call can be expensive. |
| 726 | numCells = this->GetNumberOfCells(); |
| 727 | |
| 728 | for (idx = 0; idx < numArrays; ++idx) |
| 729 | { |
| 730 | array = this->GetCellData()->GetAbstractArray(idx); |
| 731 | numTuples = array->GetNumberOfTuples(); |
| 732 | name = array->GetName(); |
| 733 | if (name == nullptr) |
| 734 | { |
| 735 | name = ""; |
| 736 | } |
| 737 | if (numTuples < numCells) |
| 738 | { |
| 739 | vtkErrorMacro("Cell array " << name << " with " << array->GetNumberOfComponents() |
| 740 | << " components, has only " << numTuples |
| 741 | << " tuples but there are " << numCells << " cells"); |