| 332 | } |
| 333 | |
| 334 | const detail::FieldInfo* GetLegacyFieldForIndex(int i) const |
| 335 | { |
| 336 | if (i >= 0 && i < vtkDataSetAttributes::NUM_ATTRIBUTES) |
| 337 | { |
| 338 | auto attrs = detail::GetAttributes(this->Fields); |
| 339 | auto finfo = attrs[i]; |
| 340 | return finfo; |
| 341 | } |
| 342 | else if (i >= vtkDataSetAttributes::NUM_ATTRIBUTES && |
| 343 | i < vtkDataSetAttributes::NUM_ATTRIBUTES + static_cast<int>(this->Fields.size())) |
| 344 | { |
| 345 | const auto attrs_ptrs = detail::GetAttributes(this->Fields); |
| 346 | |
| 347 | auto iter = this->Fields.begin(); |
| 348 | std::advance(iter, i - vtkDataSetAttributes::NUM_ATTRIBUTES); |
| 349 | if (std::find(attrs_ptrs.begin(), attrs_ptrs.end(), &iter->second) != attrs_ptrs.end()) |
| 350 | { |
| 351 | // i is beyond available attribute types and this field was already |
| 352 | // reported as an attribute, don't report it again. |
| 353 | return nullptr; |
| 354 | } |
| 355 | return &iter->second; |
| 356 | } |
| 357 | |
| 358 | return nullptr; |
| 359 | } |
| 360 | |
| 361 | /** |
| 362 | * This method can be used to determine if an array with the specified name |