------------------------------------------------------------------------------
| 416 | |
| 417 | //------------------------------------------------------------------------------ |
| 418 | int vtkHyperTreeGridGradient::ProcessTrees(vtkHyperTreeGrid* input, vtkDataObject* outputDO) |
| 419 | { |
| 420 | // Downcast output data object to hyper tree grid |
| 421 | vtkHyperTreeGrid* output = vtkHyperTreeGrid::SafeDownCast(outputDO); |
| 422 | if (!output) |
| 423 | { |
| 424 | vtkErrorMacro("Incorrect type of output: " << outputDO->GetClassName()); |
| 425 | return 0; |
| 426 | } |
| 427 | |
| 428 | // Retrieve scalar quantity of interest |
| 429 | this->InArray = this->GetInputArrayToProcess(0, input); |
| 430 | if (!this->InArray) |
| 431 | { |
| 432 | vtkErrorMacro(<< "No input array to use for the gradient computation"); |
| 433 | return 1; |
| 434 | } |
| 435 | const int nbComp = this->InArray->GetNumberOfComponents(); |
| 436 | if (nbComp != 1 && nbComp != 3) |
| 437 | { |
| 438 | vtkErrorMacro(<< "Input array should contains scalars or 3d-vectors"); |
| 439 | return 1; |
| 440 | } |
| 441 | if ((this->ComputeQCriterion || this->ComputeVorticity || this->ComputeDivergence) && nbComp != 3) |
| 442 | { |
| 443 | vtkErrorMacro("Input array must have exactly three components with " |
| 444 | << "ComputeDivergence, ComputeVorticity or ComputeQCriterion flag enabled."); |
| 445 | return 1; |
| 446 | } |
| 447 | |
| 448 | if (!this->ComputeGradient && !this->ComputeQCriterion && !this->ComputeVorticity && |
| 449 | !this->ComputeDivergence) |
| 450 | { |
| 451 | // nothing to do, early exit |
| 452 | output->ShallowCopy(input); |
| 453 | return 1; |
| 454 | } |
| 455 | |
| 456 | this->InMask = nullptr; // Masks aren't supported in this filter for now. |
| 457 | this->InGhostArray = input->GetGhostCells(); |
| 458 | |
| 459 | // Gradient is always computed |
| 460 | |
| 461 | this->OutGradArray->SetName(this->GradientArrayName); |
| 462 | this->OutGradArray->SetNumberOfComponents(this->InArray->GetNumberOfComponents() * 3); |
| 463 | this->OutGradArray->SetNumberOfTuples(this->InArray->GetNumberOfTuples()); |
| 464 | GradientWorker gradientWorker(this->InArray, this->OutGradArray, this->ExtensiveComputation); |
| 465 | |
| 466 | // For now HTG Gradient doesn't support masks because the unlimited cursors don't either. |
| 467 | // See https://gitlab.kitware.com/vtk/vtk/-/issues/19294 |
| 468 | // So we need to make a copy of the input and remove its mask to perform the |
| 469 | // gradient processing. |
| 470 | vtkNew<vtkHyperTreeGrid> inputCopy; |
| 471 | inputCopy->ShallowCopy(input); |
| 472 | inputCopy->SetMask(nullptr); |
| 473 | |
| 474 | // GradieGradientnt computation |
| 475 |
nothing calls this directly
no test coverage detected