------------------------------------------------------------------------------
| 561 | |
| 562 | //------------------------------------------------------------------------------ |
| 563 | void vtkDataSetAttributesFieldList::CopyAllocate( |
| 564 | vtkDataSetAttributes* output, int ctype, vtkIdType sz, vtkIdType ext) const |
| 565 | { |
| 566 | auto& internals = *this->Internals; |
| 567 | // lets remove empty items to make iteration easier. |
| 568 | internals.Prune(); |
| 569 | |
| 570 | sz = sz > 0 ? sz : internals.NumberOfTuples; |
| 571 | |
| 572 | // these are pointers to fields to be tagged as attributes. |
| 573 | const auto attribute_ptrs = detail::GetAttributes(internals.Fields); |
| 574 | |
| 575 | for (auto& pair : internals.Fields) |
| 576 | { |
| 577 | const auto& name = pair.first; |
| 578 | const auto& fieldInfo = pair.second; |
| 579 | fieldInfo.OutputLocation = -1; |
| 580 | |
| 581 | assert(!fieldInfo.IsEmpty()); |
| 582 | |
| 583 | bool skip_field = false; |
| 584 | bool is_attribute = false; |
| 585 | |
| 586 | // lets determine if the field is to be copied over (rather skipped) using attribute flags |
| 587 | // if the field is marked as any of the attribute types |
| 588 | for (int attrType = 0; attrType < vtkDataSetAttributes::NUM_ATTRIBUTES; ++attrType) |
| 589 | { |
| 590 | if (attribute_ptrs[attrType] == &fieldInfo && |
| 591 | output->CopyAttributeFlags[ctype][attrType] == 0) |
| 592 | { |
| 593 | skip_field = true; |
| 594 | } |
| 595 | |
| 596 | is_attribute = is_attribute | (attribute_ptrs[attrType] == &fieldInfo); |
| 597 | } |
| 598 | |
| 599 | if (skip_field) |
| 600 | { |
| 601 | continue; |
| 602 | } |
| 603 | |
| 604 | if (!is_attribute) |
| 605 | { |
| 606 | // if the field it not an attribute, check if it's to copied using array rules. |
| 607 | // (this is directly copied over from vtkDataSetAttributes::FieldList, |
| 608 | // the intent is a little unclear to me). |
| 609 | const int flag = output->GetFlag(name.c_str()); |
| 610 | const bool copy = ((flag != 0) && !(output->DoCopyAllOff && (flag != 1))); |
| 611 | if (!copy) |
| 612 | { |
| 613 | continue; |
| 614 | } |
| 615 | } |
| 616 | |
| 617 | auto array = this->CreateArray(fieldInfo.Type); |
| 618 | if (array) |
| 619 | { |
| 620 | fieldInfo.InitializeArray(array, sz, ext); |
nothing calls this directly
no test coverage detected