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

Method GetAttributeArrayName

Filters/ParallelStatistics/vtkGenerateStatistics.cxx:530–568  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

528}
529
530const char* vtkGenerateStatistics::GetAttributeArrayName(int nn)
531{
532 vtkDataObject* dobj = this->GetInputDataObject(0, 0); // First input is always the leader
533 if (!dobj)
534 {
535 return nullptr;
536 }
537
538 if (auto* cellGrid = vtkCellGrid::SafeDownCast(dobj))
539 {
540 auto ids = cellGrid->GetUnorderedCellAttributeIds();
541 if (nn < 0 || nn >= static_cast<int>(ids.size()))
542 {
543 return nullptr;
544 }
545 auto* cellAtt = cellGrid->GetCellAttributeById(ids[nn]);
546 return cellAtt ? cellAtt->GetName().Data().c_str() : nullptr;
547 }
548
549 vtkFieldData* fdata = dobj->GetAttributesAsFieldData(this->AttributeMode);
550 if (!fdata)
551 {
552 return nullptr;
553 }
554
555 int numArrays = fdata->GetNumberOfArrays();
556 if (nn < 0 || nn > numArrays)
557 {
558 return nullptr;
559 }
560
561 vtkAbstractArray* arr = fdata->GetAbstractArray(nn);
562 if (!arr)
563 {
564 return nullptr;
565 }
566
567 return arr->GetName();
568}
569
570int vtkGenerateStatistics::GetAttributeArrayStatus(const char* arrName)
571{

Callers

nothing calls this directly

Calls 10

GetInputDataObjectMethod · 0.80
GetCellAttributeByIdMethod · 0.80
GetAbstractArrayMethod · 0.80
sizeMethod · 0.45
c_strMethod · 0.45
DataMethod · 0.45
GetNameMethod · 0.45
GetNumberOfArraysMethod · 0.45

Tested by

no test coverage detected