Commit 431051cb authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Update VTK to fix performance issues with FieldList.

Also update vtkAttributeDataReductionFilter to use new FieldList API
that doesn't suffer from performance issues and isn't deprecated.
parent 417bd2e1
......@@ -167,31 +167,28 @@ static void vtkAttributeDataReductionFilterReduce(vtkDataSetAttributes* output,
if (dsa->GetNumberOfArrays() > 0 && dsa->GetNumberOfTuples() == numTuples)
{
// Now combine this inPD with the outPD using the reduction indicated.
for (int i = 0; i < fieldList.GetNumberOfFields(); ++i)
{
if (fieldList.GetFieldIndex(i) >= 0)
auto f = [list_index, progress_offset, progress_factor, self](
vtkAbstractArray* fromA, vtkAbstractArray* toA) {
vtkDataArray* toDA = vtkDataArray::SafeDownCast(toA);
vtkDataArray* fromDA = vtkDataArray::SafeDownCast(fromA);
if (!toDA || !fromDA)
{
vtkDataArray* toDA = output->GetArray(fieldList.GetFieldIndex(i));
vtkDataArray* fromDA = dsa->GetArray(fieldList.GetDSAIndex(list_index, i));
if (!toDA || !fromDA)
{
continue;
}
vtkSmartPointer<vtkArrayIterator> toIter;
toIter.TakeReference(toDA->NewIterator());
vtkSmartPointer<vtkArrayIterator> fromIter;
fromIter.TakeReference(fromDA->NewIterator());
switch (toDA->GetDataType())
{
vtkArrayIteratorTemplateMacro(
vtkAttributeDataReductionFilterReduce(self, static_cast<VTK_TT*>(toIter.GetPointer()),
static_cast<VTK_TT*>(fromIter.GetPointer()), progress_offset, progress_factor));
default:
vtkGenericWarningMacro(
"Cannot reduce arrays of type: " << toDA->GetDataTypeAsString());
}
return;
}
}
vtkSmartPointer<vtkArrayIterator> toIter;
toIter.TakeReference(toDA->NewIterator());
vtkSmartPointer<vtkArrayIterator> fromIter;
fromIter.TakeReference(fromDA->NewIterator());
switch (toDA->GetDataType())
{
vtkArrayIteratorTemplateMacro(
vtkAttributeDataReductionFilterReduce(self, static_cast<VTK_TT*>(toIter.GetPointer()),
static_cast<VTK_TT*>(fromIter.GetPointer()), progress_offset, progress_factor));
default:
vtkGenericWarningMacro("Cannot reduce arrays of type: " << toDA->GetDataTypeAsString());
}
};
fieldList.TransformData(list_index, dsa, output, f);
list_index++;
}
......
Subproject commit fbb540eea21f3b23232a5f402cd41066d11c6dc7
Subproject commit 1d2e1bfeb7cf1840768a91f305dfea95c4775244
Subproject commit 26eb4274a3b0af8d37e36d62bf5183a621f371ca
Subproject commit daa7a94fba63183655b038896090865d92b5e900
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment