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

Method PassAttributeData

Filters/Parallel/vtkHyperTreeGridPProbeFilter.cxx:422–481  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Straight up copy from vtkProbeFilter

Source from the content-addressed store, hash-verified

420//------------------------------------------------------------------------------
421// Straight up copy from vtkProbeFilter
422bool vtkHyperTreeGridPProbeFilter::PassAttributeData(vtkDataSet* input, vtkDataSet* output)
423{
424 // copy point data arrays
425 if (this->PassPointArrays)
426 {
427 int numPtArrays = input->GetPointData()->GetNumberOfArrays();
428 for (int i = 0; i < numPtArrays; ++i)
429 {
430 vtkDataArray* da = input->GetPointData()->GetArray(i);
431 if (!output->GetPointData()->HasArray(da->GetName()))
432 {
433 output->GetPointData()->AddArray(da);
434 }
435 }
436
437 // Set active attributes in the output to the active attributes in the input
438 for (int i = 0; i < vtkDataSetAttributes::NUM_ATTRIBUTES; ++i)
439 {
440 vtkAbstractArray* da = input->GetPointData()->GetAttribute(i);
441 if (da && da->GetName() && !output->GetPointData()->GetAttribute(i))
442 {
443 output->GetPointData()->SetAttribute(da, i);
444 }
445 }
446 }
447
448 // copy cell data arrays
449 if (this->PassCellArrays)
450 {
451 int numCellArrays = input->GetCellData()->GetNumberOfArrays();
452 for (int i = 0; i < numCellArrays; ++i)
453 {
454 vtkDataArray* da = input->GetCellData()->GetArray(i);
455 if (!output->GetCellData()->HasArray(da->GetName()))
456 {
457 output->GetCellData()->AddArray(da);
458 }
459 }
460
461 // Set active attributes in the output to the active attributes in the input
462 for (int i = 0; i < vtkDataSetAttributes::NUM_ATTRIBUTES; ++i)
463 {
464 vtkAbstractArray* da = input->GetCellData()->GetAttribute(i);
465 if (da && da->GetName() && !output->GetCellData()->GetAttribute(i))
466 {
467 output->GetCellData()->SetAttribute(da, i);
468 }
469 }
470 }
471
472 if (this->PassFieldArrays)
473 {
474 // nothing to do, vtkDemandDrivenPipeline takes care of that.
475 }
476 else
477 {
478 output->GetFieldData()->Initialize();
479 }

Callers 1

InitializeMethod · 0.95

Calls 11

GetNumberOfArraysMethod · 0.45
GetPointDataMethod · 0.45
GetArrayMethod · 0.45
HasArrayMethod · 0.45
GetNameMethod · 0.45
AddArrayMethod · 0.45
GetAttributeMethod · 0.45
SetAttributeMethod · 0.45
GetCellDataMethod · 0.45
InitializeMethod · 0.45
GetFieldDataMethod · 0.45

Tested by

no test coverage detected