| 28 | } |
| 29 | |
| 30 | inline void vtkShallowCopy(vtkDataObject* output, vtkDataObject* input) |
| 31 | { |
| 32 | vtkCompositeDataSet* cdout = vtkCompositeDataSet::SafeDownCast(output); |
| 33 | if (cdout == nullptr) |
| 34 | { |
| 35 | output->ShallowCopy(input); |
| 36 | return; |
| 37 | } |
| 38 | |
| 39 | // We can't use vtkCompositeDataSet::ShallowCopy() since that simply passes |
| 40 | // the leaf datasets without actually shallowcopying them. That doesn't work |
| 41 | // in our case since we will be modifying the datasets in the output. |
| 42 | vtkCompositeDataSet* cdin = vtkCompositeDataSet::SafeDownCast(input); |
| 43 | cdout->CopyStructure(cdin); |
| 44 | vtkSmartPointer<vtkCompositeDataIterator> initer; |
| 45 | initer.TakeReference(cdin->NewIterator()); |
| 46 | for (initer->InitTraversal(); !initer->IsDoneWithTraversal(); initer->GoToNextItem()) |
| 47 | { |
| 48 | vtkDataObject* in = initer->GetCurrentDataObject(); |
| 49 | vtkDataObject* clone = in->NewInstance(); |
| 50 | clone->ShallowCopy(in); |
| 51 | cdout->SetDataSet(initer, clone); |
| 52 | clone->FastDelete(); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | vtkStandardNewMacro(vtkCleanArrays); |
| 57 | vtkCxxSetObjectMacro(vtkCleanArrays, Controller, vtkMultiProcessController); |
no test coverage detected