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

Method CheckAttributes

Common/DataModel/vtkDataSet.cxx:684–754  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

682
683//------------------------------------------------------------------------------
684int 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");

Callers 14

BuildOutputGridMethod · 0.80
WriteAPieceMethod · 0.80
WriteInlineModeMethod · 0.80
RequestDataMethod · 0.80
TestStructuredFunction · 0.80
RequestDataMethod · 0.80
RequestDataMethod · 0.80
RequestDataMethod · 0.80
TestVortexCoreFunction · 0.80
RequestDataMethod · 0.80

Calls 9

GetAbstractArrayMethod · 0.80
GetNumberOfArraysMethod · 0.45
GetPointDataMethod · 0.45
GetNumberOfPointsMethod · 0.45
GetNumberOfTuplesMethod · 0.45
GetNameMethod · 0.45
GetNumberOfComponentsMethod · 0.45
GetCellDataMethod · 0.45
GetNumberOfCellsMethod · 0.45

Tested by 3

TestStructuredFunction · 0.64
TestVortexCoreFunction · 0.64
TestStructuredFunction · 0.64