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

Method ExecuteSimpleAlgorithm

Common/ExecutionModel/vtkCompositeDataPipeline.cxx:314–454  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Execute a simple (non-composite-aware) filter multiple times, once per block. Collect the result in a composite dataset that is of the same structure as the input.

Source from the content-addressed store, hash-verified

312// block. Collect the result in a composite dataset that is of the same
313// structure as the input.
314void vtkCompositeDataPipeline::ExecuteSimpleAlgorithm(vtkInformation* request,
315 vtkInformationVector** inInfoVec, vtkInformationVector* outInfoVec, int compositePort)
316{
317 vtkDebugMacro(<< "ExecuteSimpleAlgorithm");
318
319 this->ExecuteDataStart(request, inInfoVec, outInfoVec);
320
321 vtkInformation* outInfo = nullptr;
322
323 if (this->GetNumberOfOutputPorts() > 0)
324 {
325 outInfo = outInfoVec->GetInformationObject(0);
326 }
327 if (!outInfo)
328 {
329 return;
330 }
331
332 // Make sure a valid composite data object exists for all output ports.
333 this->CheckCompositeData(request, inInfoVec, outInfoVec);
334
335 // if we have no composite inputs
336 if (compositePort == -1)
337 {
338 return;
339 }
340
341 // Loop using the first input on the first port.
342 // This might not be valid for all cases but it is a decent
343 // assumption to start with.
344 // TODO: Loop over all inputs
345 vtkInformation* inInfo = this->GetInputInformation(compositePort, 0);
346 vtkCompositeDataSet* input =
347 vtkCompositeDataSet::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
348
349 bool compositeOutputFound = false;
350 std::vector<vtkSmartPointer<vtkCompositeDataSet>> compositeOutputs;
351 for (int port = 0; port < outInfoVec->GetNumberOfInformationObjects(); ++port)
352 {
353 compositeOutputs.emplace_back(vtkCompositeDataSet::GetData(outInfoVec, port));
354 if (compositeOutputs.back())
355 {
356 compositeOutputFound = true;
357 }
358 }
359
360 if (input && compositeOutputFound)
361 {
362 for (int port = 0; port < outInfoVec->GetNumberOfInformationObjects(); ++port)
363 {
364 if (compositeOutputs[port])
365 {
366 compositeOutputs[port]->PrepareForNewData();
367 compositeOutputs[port]->CopyStructure(input);
368 if (input && input->GetFieldData())
369 {
370 compositeOutputs[port]->GetFieldData()->PassData(input->GetFieldData());
371 }

Callers 1

ExecuteDataMethod · 0.95

Calls 15

ExecuteDataStartMethod · 0.95
CheckCompositeDataMethod · 0.95
PushInformationMethod · 0.95
ExecuteEachMethod · 0.95
PopInformationMethod · 0.95
GetInformationObjectMethod · 0.80
backMethod · 0.80
GetDataFunction · 0.50
NewFunction · 0.50
GetInputInformationMethod · 0.45

Tested by

no test coverage detected