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

Method RequestData

Filters/General/vtkSampleImplicitFunctionFilter.cxx:137–218  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Produce the output data

Source from the content-addressed store, hash-verified

135//------------------------------------------------------------------------------
136// Produce the output data
137int vtkSampleImplicitFunctionFilter::RequestData(vtkInformation* vtkNotUsed(request),
138 vtkInformationVector** inputVector, vtkInformationVector* outputVector)
139{
140 vtkDebugMacro(<< "Generating implicit data");
141
142 // get the info objects
143 vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
144 vtkInformation* outInfo = outputVector->GetInformationObject(0);
145
146 // get the input and output
147 vtkDataSet* input = vtkDataSet::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
148 vtkDataSet* output = vtkDataSet::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
149
150 // Check the input
151 if (!input || !output)
152 {
153 return 1;
154 }
155 vtkIdType numPts = input->GetNumberOfPoints();
156 if (numPts < 1)
157 {
158 return 1;
159 }
160
161 // Ensure implicit function is specified
162 //
163 if (!this->ImplicitFunction)
164 {
165 vtkErrorMacro(<< "No implicit function specified");
166 return 1;
167 }
168
169 // The output geometic structure is the same as the input
170 output->CopyStructure(input);
171
172 // Pass the output attribute data
173 output->GetPointData()->PassData(input->GetPointData());
174 output->GetCellData()->PassData(input->GetCellData());
175
176 // Set up for execution
177 vtkFloatArray* newScalars = vtkFloatArray::New();
178 newScalars->SetNumberOfTuples(numPts);
179 float* scalars = newScalars->WritePointer(0, numPts);
180
181 vtkFloatArray* newGradients = nullptr;
182 float* gradients = nullptr;
183 if (this->ComputeGradients)
184 {
185 newGradients = vtkFloatArray::New();
186 newGradients->SetNumberOfComponents(3);
187 newGradients->SetNumberOfTuples(numPts);
188 gradients = newGradients->WritePointer(0, numPts);
189 }
190
191 // Threaded execute
192 if (this->ComputeGradients)
193 {
194 SampleDataSetWithGradients sample(input, this->ImplicitFunction, scalars, gradients, this);

Callers

nothing calls this directly

Calls 15

GetInformationObjectMethod · 0.80
SetActiveScalarsMethod · 0.80
SetActiveVectorsMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
ForFunction · 0.50
GetMethod · 0.45
GetNumberOfPointsMethod · 0.45
CopyStructureMethod · 0.45
PassDataMethod · 0.45
GetPointDataMethod · 0.45
GetCellDataMethod · 0.45

Tested by

no test coverage detected