diff --git a/vtkm/filter/scalar_topology/worklet/branch_decomposition/HierarchicalVolumetricBranchDecomposer.h b/vtkm/filter/scalar_topology/worklet/branch_decomposition/HierarchicalVolumetricBranchDecomposer.h index 35a8b8609..034be5d6e 100644 --- a/vtkm/filter/scalar_topology/worklet/branch_decomposition/HierarchicalVolumetricBranchDecomposer.h +++ b/vtkm/filter/scalar_topology/worklet/branch_decomposition/HierarchicalVolumetricBranchDecomposer.h @@ -506,12 +506,19 @@ inline void HierarchicalVolumetricBranchDecomposer::CollapseBranches( vtkm::worklet::contourtree_distributed::FindSuperArcBetweenNodes findSuperArcBetweenNodes{ hierarchicalTreeSuperarcs }; + // Get the number of rounds + auto numRoundsArray = hierarchicalTreeDataSet.GetField("NumRounds") + .GetData() + .AsArrayHandle>(); + vtkm::Id numRounds = vtkm::cont::ArrayGetValue(0, numRoundsArray); using vtkm::worklet::scalar_topology::hierarchical_volumetric_branch_decomposer:: CollapseBranchesWorklet; - this->Invoke(CollapseBranchesWorklet{}, // the worklet + CollapseBranchesWorklet collapseBranchesWorklet(numRounds); + this->Invoke(collapseBranchesWorklet, // the worklet this->BestUpSupernode, // input this->BestDownSupernode, // input + hierarchicalTreeSuperarcs, // input findRegularByGlobal, // input ExecutionObject findSuperArcBetweenNodes, // input ExecutionObject hierarchicalTreeRegular2Supernode, // input diff --git a/vtkm/filter/scalar_topology/worklet/branch_decomposition/hierarchical_volumetric_branch_decomposer/CollapseBranchesWorklet.h b/vtkm/filter/scalar_topology/worklet/branch_decomposition/hierarchical_volumetric_branch_decomposer/CollapseBranchesWorklet.h index 498f7eb5f..d16e8b108 100644 --- a/vtkm/filter/scalar_topology/worklet/branch_decomposition/hierarchical_volumetric_branch_decomposer/CollapseBranchesWorklet.h +++ b/vtkm/filter/scalar_topology/worklet/branch_decomposition/hierarchical_volumetric_branch_decomposer/CollapseBranchesWorklet.h @@ -65,6 +65,7 @@ public: using ControlSignature = void( FieldIn bestUpSupernode, FieldIn bestDownSupernode, + FieldIn superarcs, // Execution objects from the hierarchical tree to use the FindRegularByGlobal function ExecObject findRegularByGlobal, // Execution objects from the hierarchical tree to use the FindSuperArcBetweenNodes, function @@ -72,12 +73,15 @@ public: WholeArrayIn hierarchicalTreeRegular2supernode, WholeArrayIn hierarchicalTreeWhichRound, WholeArrayInOut branchRoot); - using ExecutionSignature = void(InputIndex, _1, _2, _3, _4, _5, _6, _7); + using ExecutionSignature = void(InputIndex, _1, _2, _3, _4, _5, _6, _7, _8); using InputDomain = _1; /// Default Constructor VTKM_EXEC_CONT - CollapseBranchesWorklet() {} + CollapseBranchesWorklet(vtkm::Id numRounds) + : NumRounds(numRounds) + { + } /// operator() of the workelt template NumRounds) && + (vtkm::worklet::contourtree_augmented::NoSuchElement(superarcsId))) + { + return; + } + // if there is no best up, we're at an upper leaf and will not connect up two superarcs anyway, so we can skip the supernode if (vtkm::worklet::contourtree_augmented::NoSuchElement(bestUpSupernodeId)) { @@ -233,6 +250,8 @@ public: */ } // operator()() +private: + vtkm::Id NumRounds; }; // CollapseBranchesWorklet