------------------------------------------------------------------------------
| 726 | |
| 727 | //------------------------------------------------------------------------------ |
| 728 | void vtkCellArray::DeepCopy(vtkAbstractCellArray* ca) |
| 729 | { |
| 730 | auto other = vtkCellArray::SafeDownCast(ca); |
| 731 | if (!other) |
| 732 | { |
| 733 | vtkErrorMacro("Cannot copy from non-vtkCellArray."); |
| 734 | return; |
| 735 | } |
| 736 | if (other == this) |
| 737 | { |
| 738 | return; |
| 739 | } |
| 740 | |
| 741 | switch (other->GetStorageType()) |
| 742 | { |
| 743 | case StorageTypes::FixedSizeInt32: |
| 744 | { |
| 745 | this->UseFixedSize32BitStorage(1 /*dummy, ImplicitDeepCopy will fix it*/); |
| 746 | this->GetOffsetsAffineArray32()->ImplicitDeepCopy( |
| 747 | AffineArray32::FastDownCast(other->Offsets)); |
| 748 | this->Connectivity->DeepCopy(other->Connectivity); |
| 749 | this->Modified(); |
| 750 | break; |
| 751 | } |
| 752 | case StorageTypes::FixedSizeInt64: |
| 753 | { |
| 754 | this->UseFixedSize64BitStorage(1 /*dummy, ImplicitDeepCopy will fix it*/); |
| 755 | this->GetOffsetsAffineArray64()->ImplicitDeepCopy( |
| 756 | AffineArray64::FastDownCast(other->Offsets)); |
| 757 | this->Connectivity->DeepCopy(other->Connectivity); |
| 758 | this->Modified(); |
| 759 | break; |
| 760 | } |
| 761 | case StorageTypes::Int32: |
| 762 | case StorageTypes::Int64: |
| 763 | case StorageTypes::Generic: |
| 764 | default: |
| 765 | { |
| 766 | this->Offsets = vtk::TakeSmartPointer(other->Offsets->NewInstance()); |
| 767 | this->Offsets->DeepCopy(other->Offsets); |
| 768 | this->Connectivity = vtk::TakeSmartPointer(other->Connectivity->NewInstance()); |
| 769 | this->Connectivity->DeepCopy(other->Connectivity); |
| 770 | this->StorageType = other->StorageType; |
| 771 | this->Modified(); |
| 772 | break; |
| 773 | } |
| 774 | } |
| 775 | } |
| 776 | |
| 777 | //------------------------------------------------------------------------------ |
| 778 | void vtkCellArray::ShallowCopy(vtkAbstractCellArray* ca) |
no test coverage detected