specify aspect ratio filter input requirements

This commit is contained in:
ccolin 2022-02-19 00:39:00 +01:00
parent 6178f294cd
commit 5ad9c70825

View File

@ -1,18 +1,30 @@
#include "aspect_ratio_filter.h"
#include "vtkDataObject.h"
#include <vtkUnstructuredGrid.h>
#include <vtkPointData.h>
#include <vtkCellData.h>
#include <vtkDoubleArray.h>
#include <vtkCellIterator.h>
#include <vtkInformation.h>
#include <vtkInformationVector.h>
vtkStandardNewMacro(AspectRatioFilter);
// Ensure there is an "angles", 12 floats tuple array in the DataCell.
int AspectRatioFilter::FillInputPortInformation(int port, vtkInformation *info) {
vtkUnstructuredGridAlgorithm::FillInputPortInformation(port, info);
// Ensure there is an "angles" array in the DataCell.
vtkNew<vtkInformation> anglesField;
anglesField->Set(vtkDataObject::FIELD_ASSOCIATION(), vtkDataObject::FIELD_ASSOCIATION_CELLS);
anglesField->Set(vtkDataObject::FIELD_NAME(), "angles");
anglesField->Set(vtkDataObject::FIELD_NUMBER_OF_COMPONENTS(), 12);
anglesField->Set(vtkDataObject::FIELD_ARRAY_TYPE(), VTK_DOUBLE);
vtkNew<vtkInformationVector> fields;
fields->Append(anglesField);
info->Set(vtkAlgorithm::INPUT_REQUIRED_FIELDS(), fields);
return 1;
}