53 #ifndef vtk_m_worklet_contourtree_augmented_contourtree_maker_inc_compute_regular_structure_locate_superarcs_h
54 #define vtk_m_worklet_contourtree_augmented_contourtree_maker_inc_compute_regular_structure_locate_superarcs_h
63 namespace contourtree_augmented
65 namespace contourtree_maker_inc
74 WholeArrayIn contourTreeWhenTransferred,
75 WholeArrayIn contourTreeHyperparents,
76 WholeArrayIn contourTreeHyperarcs,
77 WholeArrayIn contourTreeHypernodes,
78 WholeArrayIn contourTreeSupernodes,
96 template <
typename InOutFieldPortalType,
typename InFieldPortalType>
99 const InFieldPortalType& contourTreeWhenTransferredPortal,
100 const InFieldPortalType& contourTreeHyperparentsPortal,
101 const InFieldPortalType& contourTreeHyperarcsPortal,
102 const InFieldPortalType& contourTreeHypernodesPortal,
103 const InFieldPortalType& contourTreeSupernodesPortal,
116 vtkm::Id topWhen = contourTreeWhenTransferredPortal.Get(topSuperparent);
117 vtkm::Id bottomWhen = contourTreeWhenTransferredPortal.Get(bottomSuperparent);
119 vtkm::Id topHyperparent = contourTreeHyperparentsPortal.Get(topSuperparent);
120 vtkm::Id bottomHyperparent = contourTreeHyperparentsPortal.Get(bottomSuperparent);
132 topSuperparent = contourTreeHyperarcsPortal.Get(
MaskedIndex(topHyperparent));
133 top = contourTreeSupernodesPortal.Get(
MaskedIndex(topSuperparent));
135 topWhen = contourTreeWhenTransferredPortal.Get(
MaskedIndex(topSuperparent));
139 hyperparent = topHyperparent;
144 topHyperparent = contourTreeHyperparentsPortal.Get(
MaskedIndex(topSuperparent));
150 bottomSuperparent = contourTreeHyperarcsPortal.Get(
MaskedIndex(bottomHyperparent));
151 bottom = contourTreeSupernodesPortal.Get(
MaskedIndex(bottomSuperparent));
152 bottomWhen = contourTreeWhenTransferredPortal.Get(
MaskedIndex(bottomSuperparent));
156 hyperparent = bottomHyperparent;
161 bottomHyperparent = contourTreeHyperparentsPortal.Get(
MaskedIndex(bottomSuperparent));
168 hyperparent = bottomHyperparent;
172 if (
IsAscending(contourTreeHyperarcsPortal.Get(hyperparent)))
175 vtkm::Id lowSupernode = contourTreeHypernodesPortal.Get(hyperparent);
182 highSupernode = contourTreeHypernodesPortal.Get(
MaskedIndex(hyperparent) + 1) - 1;
185 if (contourTreeSupernodesPortal.Get(highSupernode) < node)
186 contourTreeSuperparentsPortal.Set(node, highSupernode);
191 while (highSupernode - lowSupernode > 1)
194 vtkm::Id midSupernode = (lowSupernode + highSupernode) / 2;
196 if (contourTreeSupernodesPortal.Get(midSupernode) > node)
197 highSupernode = midSupernode;
200 lowSupernode = midSupernode;
204 contourTreeSuperparentsPortal.Set(node, lowSupernode);
210 vtkm::Id highSupernode = contourTreeHypernodesPortal.Get(hyperparent);
220 lowSupernode = contourTreeHypernodesPortal.Get(
MaskedIndex(hyperparent) + 1) - 1;
224 if (contourTreeSupernodesPortal.Get(lowSupernode) > node)
225 contourTreeSuperparentsPortal.Set(node, lowSupernode);
230 while (lowSupernode - highSupernode > 1)
233 vtkm::Id midSupernode = (highSupernode + lowSupernode) / 2;
235 if (contourTreeSupernodesPortal.Get(midSupernode) > node)
236 highSupernode = midSupernode;
239 lowSupernode = midSupernode;
242 contourTreeSuperparentsPortal.Set(node, highSupernode);
409 WholeArrayIn contourTreeWhenTransferred,
410 WholeArrayIn contourTreeHyperparents,
411 WholeArrayIn contourTreeHyperarcs,
412 WholeArrayIn contourTreeHypernodes,
413 WholeArrayIn contourTreeSupernodes,
417 ExecObject meshBoundary);
419 typedef void ExecutionSignature(_1,
InputIndex, _2, _3, _4, _5, _6, _7, _8, _9, _10);
433 template <
typename InOutFieldPortalType,
typename InFieldPortalType,
typename MeshBoundaryType>
436 const InFieldPortalType& contourTreeWhenTransferredPortal,
437 const InFieldPortalType& contourTreeHyperparentsPortal,
438 const InFieldPortalType& contourTreeHyperarcsPortal,
439 const InFieldPortalType& contourTreeHypernodesPortal,
440 const InFieldPortalType& contourTreeSupernodesPortal,
444 const MeshBoundaryType& meshBoundary)
const
448 if (
NoSuchElement(contourTreeSuperparentsPortal.Get(node)) &&
449 meshBoundary.LiesOnBoundary(sortOrder))
456 vtkm::Id topWhen = contourTreeWhenTransferredPortal.Get(topSuperparent);
457 vtkm::Id bottomWhen = contourTreeWhenTransferredPortal.Get(bottomSuperparent);
459 vtkm::Id topHyperparent = contourTreeHyperparentsPortal.Get(topSuperparent);
460 vtkm::Id bottomHyperparent = contourTreeHyperparentsPortal.Get(bottomSuperparent);
472 topSuperparent = contourTreeHyperarcsPortal.Get(
MaskedIndex(topHyperparent));
473 top = contourTreeSupernodesPortal.Get(
MaskedIndex(topSuperparent));
475 topWhen = contourTreeWhenTransferredPortal.Get(
MaskedIndex(topSuperparent));
479 hyperparent = topHyperparent;
484 topHyperparent = contourTreeHyperparentsPortal.Get(
MaskedIndex(topSuperparent));
490 bottomSuperparent = contourTreeHyperarcsPortal.Get(
MaskedIndex(bottomHyperparent));
491 bottom = contourTreeSupernodesPortal.Get(
MaskedIndex(bottomSuperparent));
492 bottomWhen = contourTreeWhenTransferredPortal.Get(
MaskedIndex(bottomSuperparent));
496 hyperparent = bottomHyperparent;
501 bottomHyperparent = contourTreeHyperparentsPortal.Get(
MaskedIndex(bottomSuperparent));
508 hyperparent = bottomHyperparent;
512 if (
IsAscending(contourTreeHyperarcsPortal.Get(hyperparent)))
515 vtkm::Id lowSupernode = contourTreeHypernodesPortal.Get(hyperparent);
522 highSupernode = contourTreeHypernodesPortal.Get(
MaskedIndex(hyperparent) + 1) - 1;
525 if (contourTreeSupernodesPortal.Get(highSupernode) < node)
526 contourTreeSuperparentsPortal.Set(node, highSupernode);
531 while (highSupernode - lowSupernode > 1)
534 vtkm::Id midSupernode = (lowSupernode + highSupernode) / 2;
536 if (contourTreeSupernodesPortal.Get(midSupernode) > node)
537 highSupernode = midSupernode;
540 lowSupernode = midSupernode;
544 contourTreeSuperparentsPortal.Set(node, lowSupernode);
550 vtkm::Id highSupernode = contourTreeHypernodesPortal.Get(hyperparent);
560 lowSupernode = contourTreeHypernodesPortal.Get(
MaskedIndex(hyperparent) + 1) - 1;
564 if (contourTreeSupernodesPortal.Get(lowSupernode) > node)
565 contourTreeSuperparentsPortal.Set(node, lowSupernode);
570 while (lowSupernode - highSupernode > 1)
573 vtkm::Id midSupernode = (highSupernode + lowSupernode) / 2;
575 if (contourTreeSupernodesPortal.Get(midSupernode) > node)
576 highSupernode = midSupernode;
579 lowSupernode = midSupernode;
582 contourTreeSuperparentsPortal.Set(node, highSupernode);