------------------------------------------------------------------------------
| 359 | |
| 360 | //------------------------------------------------------------------------------ |
| 361 | int vtkIntegrateAttributes::RequestData( |
| 362 | vtkInformation*, vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 363 | { |
| 364 | vtkInformation* inInfo = inputVector[0]->GetInformationObject(0); |
| 365 | vtkInformation* outInfo = outputVector->GetInformationObject(0); |
| 366 | |
| 367 | auto inputDO = vtkDataObject::GetData(inInfo); |
| 368 | auto output = vtkUnstructuredGrid::GetData(outInfo); |
| 369 | |
| 370 | if (!inputDO || !output) |
| 371 | { |
| 372 | return 0; |
| 373 | } |
| 374 | |
| 375 | // Integration of imaginary attribute with constant value 1. |
| 376 | double totalSum = 0.0; |
| 377 | // For computation of point/vertex location. |
| 378 | double totalSumCenter[3] = { 0.0, 0.0, 0.0 }; |
| 379 | // For integration dimension |
| 380 | int totalIntegrationDimension = 0; |
| 381 | |
| 382 | auto cdInput = vtkCompositeDataSet::SafeDownCast(inputDO); |
| 383 | auto dsInput = vtkDataSet::SafeDownCast(inputDO); |
| 384 | if (cdInput) |
| 385 | { |
| 386 | auto iter = vtk::TakeSmartPointer(cdInput->NewIterator()); |
| 387 | |
| 388 | // Create the intersection field list. This is list of arrays common |
| 389 | // to all blocks in the input. |
| 390 | vtkIntegrateAttributesFieldList pdList; |
| 391 | vtkIntegrateAttributesFieldList cdList; |
| 392 | for (iter->InitTraversal(); !iter->IsDoneWithTraversal(); iter->GoToNextItem()) |
| 393 | { |
| 394 | vtkDataSet* ds = vtkDataSet::SafeDownCast(iter->GetCurrentDataObject()); |
| 395 | if (ds) |
| 396 | { |
| 397 | if (ds->GetNumberOfPoints() > 0) |
| 398 | { |
| 399 | totalIntegrationDimension = |
| 400 | std::max(ds->GetMaxSpatialDimension(), totalIntegrationDimension); |
| 401 | pdList.IntersectFieldList(ds->GetPointData()); |
| 402 | cdList.IntersectFieldList(ds->GetCellData()); |
| 403 | } |
| 404 | } |
| 405 | else if (auto dobj = iter->GetCurrentDataObject()) |
| 406 | { |
| 407 | vtkWarningMacro("This filter cannot handle sub-datasets of type : " << dobj->GetClassName() |
| 408 | << ". Skipping block"); |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | // Now initialize the output for the intersected set of arrays. |
| 413 | vtkIntegrateAttributes::AllocateAttributes(pdList, output->GetPointData()); |
| 414 | vtkIntegrateAttributes::AllocateAttributes(cdList, output->GetCellData()); |
| 415 | |
| 416 | int index = 0; |
| 417 | // Now execute for each block. |
| 418 | for (iter->InitTraversal(); !iter->IsDoneWithTraversal(); iter->GoToNextItem()) |
nothing calls this directly
no test coverage detected