improve(CompositeArray): switch ordering of allocation

dev
Julien Fausty 3 months ago
parent 2bb46a9b06
commit c0233ec6dd

@ -33,9 +33,9 @@ vtkSmartPointer<vtkCompositeArray<T>> Concatenate(const std::vector<vtkDataArray
vtkNew<vtkCompositeArray<T>> composite;
composite->SetBackend(
std::make_shared<vtkCompositeImplicitBackend<T>>(lifetimeBuffer[i], lifetimeBuffer[i + 1]));
composite->SetNumberOfComponents(lifetimeBuffer[i]->GetNumberOfComponents());
composite->SetNumberOfTuples(
lifetimeBuffer[i]->GetNumberOfTuples() + lifetimeBuffer[i + 1]->GetNumberOfTuples());
composite->SetNumberOfComponents(lifetimeBuffer[i]->GetNumberOfComponents());
newComps.emplace_back(composite);
}
if (lifetimeBuffer.size() % 2 != 0)
@ -43,9 +43,9 @@ vtkSmartPointer<vtkCompositeArray<T>> Concatenate(const std::vector<vtkDataArray
vtkNew<vtkCompositeArray<T>> composite;
composite->SetBackend(
std::make_shared<vtkCompositeImplicitBackend<T>>(newComps.back(), lifetimeBuffer.back()));
composite->SetNumberOfComponents(lifetimeBuffer.back()->GetNumberOfComponents());
composite->SetNumberOfTuples(
newComps.back()->GetNumberOfTuples() + lifetimeBuffer.back()->GetNumberOfTuples());
composite->SetNumberOfComponents(lifetimeBuffer.back()->GetNumberOfComponents());
newComps.back() = composite;
}
lifetimeBuffer.assign(newComps.begin(), newComps.end());

@ -36,7 +36,7 @@ struct vtkCompositeImplicitBackend<ValueType>::Internals
}
this->LeftRange = vtk::DataArrayValueRange(this->Left);
this->RightRange = vtk::DataArrayValueRange(this->Right);
this->Offset = LeftRange.size();
this->Offset = this->LeftRange.size();
}
vtkSmartPointer<vtkDataArray> Left;

Loading…
Cancel
Save