MCPcopy Create free account
hub / github.com/Kitware/VTK / RequestData

Method RequestData

Filters/Verdict/vtkMatrixMathFilter.cxx:41–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41int vtkMatrixMathFilter::RequestData(vtkInformation* vtkNotUsed(request),
42 vtkInformationVector** inputVector, vtkInformationVector* outputVector)
43{
44 // get the info objects
45 vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
46 vtkInformation* outInfo = outputVector->GetInformationObject(0);
47
48 // get the input and output
49 vtkDataSet* in = vtkDataSet::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
50 vtkDataSet* out = vtkDataSet::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
51
52 // Copy input to get a start point
53 out->CopyStructure(in);
54
55 int association = vtkDataObject::FIELD_ASSOCIATION_NONE;
56 vtkDataArray* inTensors = this->GetInputArrayToProcess(0, inputVector, association);
57
58 bool const pointQuality = vtkDataObject::FIELD_ASSOCIATION_POINTS == association;
59 bool const cellQuality = vtkDataObject::FIELD_ASSOCIATION_CELLS == association;
60 if (!pointQuality && !cellQuality)
61 {
62 vtkWarningMacro("Unknown association " << association);
63 return 1;
64 }
65
66 vtkIdType const nCells = in->GetNumberOfCells();
67 vtkIdType const nPoints = in->GetNumberOfPoints();
68 if ((pointQuality && 0 == nPoints) || (cellQuality && 0 == nCells))
69 {
70 vtkWarningMacro("No data to work.");
71 return 1;
72 }
73
74 // Allocate storage for the computation
75 vtkSmartPointer<vtkDoubleArray> quality = vtkSmartPointer<vtkDoubleArray>::New();
76 // Set different number of component and name depending on the quality
77 switch (this->GetOperation())
78 {
79 case DETERMINANT:
80 quality->SetName("Determinant");
81 quality->SetNumberOfComponents(1);
82 break;
83 case EIGENVALUE:
84 quality->SetName("Eigenvalue");
85 quality->SetNumberOfComponents(3);
86 break;
87 case EIGENVECTOR:
88 quality->SetName("Eigenvector");
89 quality->SetNumberOfComponents(9);
90 break;
91 case INVERSE:
92 quality->SetName("Inverse");
93 quality->SetNumberOfComponents(9);
94 break;
95 default:
96 vtkWarningMacro("Bad Operation (" << this->GetOperation() << ")");
97 return 1;
98 }

Callers

nothing calls this directly

Calls 15

JacobiFunction · 0.85
Determinant2x2Function · 0.85
GetInformationObjectMethod · 0.80
NewFunction · 0.50
GetMethod · 0.45
CopyStructureMethod · 0.45
GetNumberOfCellsMethod · 0.45
GetNumberOfPointsMethod · 0.45
SetNameMethod · 0.45
SetNumberOfComponentsMethod · 0.45
SetNumberOfTuplesMethod · 0.45

Tested by

no test coverage detected