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

Method RequestData

Filters/Extraction/vtkExtractTensorComponents.cxx:81–306  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Extract data from tensors.

Source from the content-addressed store, hash-verified

79// Extract data from tensors.
80//
81int vtkExtractTensorComponents::RequestData(vtkInformation* vtkNotUsed(request),
82 vtkInformationVector** inputVector, vtkInformationVector* outputVector)
83{
84 // get the info objects
85 vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
86 vtkInformation* outInfo = outputVector->GetInformationObject(0);
87
88 // get the input and output
89 vtkDataSet* input = vtkDataSet::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
90 vtkDataSet* output = vtkDataSet::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
91
92 vtkDataArray* inTensors;
93 vtkPointData* pd = input->GetPointData();
94 vtkPointData* outPD = output->GetPointData();
95 vtkDataArray* newScalars = nullptr;
96 vtkDataArray* newVectors = nullptr;
97 vtkDataArray* newNormals = nullptr;
98 vtkDataArray* newTCoords = nullptr;
99 vtkIdType numPts;
100
101 // Initialize
102 //
103 vtkDebugMacro(<< "Extracting tensor components!");
104
105 // First, copy the input to the output as a starting point
106 output->CopyStructure(input);
107
108 inTensors = pd->GetTensors();
109 numPts = input->GetNumberOfPoints();
110
111 if (!inTensors || numPts < 1)
112 {
113 vtkErrorMacro(<< "No data to extract!");
114 return 1;
115 }
116
117 if (!this->ExtractScalars && !this->ExtractVectors && !this->ExtractNormals &&
118 !this->ExtractTCoords)
119 {
120 vtkWarningMacro(<< "No data is being extracted");
121 }
122
123 int precisionType;
124 switch (this->OutputPrecision)
125 {
126 case vtkAlgorithm::SINGLE_PRECISION:
127 precisionType = VTK_FLOAT;
128 break;
129 case vtkAlgorithm::DOUBLE_PRECISION:
130 precisionType = VTK_DOUBLE;
131 break;
132 case vtkAlgorithm::DEFAULT_PRECISION:
133 default:
134 precisionType = inTensors->GetDataType();
135 break;
136 }
137
138 outPD->CopyAllOn();

Callers

nothing calls this directly

Calls 15

GetInformationObjectMethod · 0.80
CheckAbortMethod · 0.80
SetVectorsMethod · 0.80
CreateDataArrayFunction · 0.70
DeleteMethod · 0.65
ForFunction · 0.50
minFunction · 0.50
sqrtFunction · 0.50
GetMethod · 0.45
GetPointDataMethod · 0.45
CopyStructureMethod · 0.45
GetTensorsMethod · 0.45

Tested by

no test coverage detected