Update names in MergeTree (and matching names in other classes) to comply with VTKm style

This commit is contained in:
Oliver Ruebel 2020-01-23 10:46:56 -08:00
parent 6bfd119220
commit 7ced203f6a
27 changed files with 452 additions and 447 deletions

@ -731,8 +731,8 @@ int main(int argc, char* argv[])
// create explicit representation of the branch decompostion from the array representation
BranchType* branchDecompostionRoot =
ctaug_ns::ProcessContourTree::ComputeBranchDecomposition<ValueType>(
filter.GetContourTree().superparents,
filter.GetContourTree().supernodes,
filter.GetContourTree().Superparents,
filter.GetContourTree().Supernodes,
whichBranch,
branchMinimum,
branchMaximum,
@ -886,31 +886,31 @@ int main(int argc, char* argv[])
<< std::left
<< " #Arcs"
<< ": "
<< ct.arcs.GetNumberOfValues()
<< ct.Arcs.GetNumberOfValues()
<< std::endl
<< std::setw(42)
<< std::left
<< " #Superparents"
<< ": "
<< ct.superparents.GetNumberOfValues()
<< ct.Superparents.GetNumberOfValues()
<< std::endl
<< std::setw(42)
<< std::left
<< " #Superarcs"
<< ": "
<< ct.superarcs.GetNumberOfValues()
<< ct.Superarcs.GetNumberOfValues()
<< std::endl
<< std::setw(42)
<< std::left
<< " #Supernodes"
<< ": "
<< ct.supernodes.GetNumberOfValues()
<< ct.Supernodes.GetNumberOfValues()
<< std::endl
<< std::setw(42)
<< std::left
<< " #Hyperparents"
<< ": "
<< ct.hyperparents.GetNumberOfValues()
<< ct.Hyperparents.GetNumberOfValues()
<< std::endl
<< std::setw(42)
<< std::left
@ -922,13 +922,13 @@ int main(int argc, char* argv[])
<< std::left
<< " #Hypernodes"
<< ": "
<< ct.hypernodes.GetNumberOfValues()
<< ct.Hypernodes.GetNumberOfValues()
<< std::endl
<< std::setw(42)
<< std::left
<< " #Hyperarcs"
<< ": "
<< ct.hyperarcs.GetNumberOfValues()
<< ct.Hyperarcs.GetNumberOfValues()
<< std::endl);
// Flush ouput streams just to make sure everything has been logged (in particular when using MPI)
std::cout << std::flush;

@ -331,7 +331,7 @@ public:
vtkm::cont::Algorithm::Copy(transformedIndex, localGlobalMeshIndex);
// Compute the local contour tree mesh
auto localContourTreeMesh = new vtkm::worklet::contourtree_augmented::ContourTreeMesh<T>(
contourTree.arcs, sortOrder, field, localGlobalMeshIndex);
contourTree.Arcs, sortOrder, field, localGlobalMeshIndex);
return localContourTreeMesh;
}
else if (computeRegularStructure == 2)
@ -496,7 +496,7 @@ void MergeBlockFunctor(
{
// If we have the fully augmented contour tree
newContourTreeMesh = new vtkm::worklet::contourtree_augmented::ContourTreeMesh<FieldType>(
currContourTree.arcs, contourTreeMeshOut);
currContourTree.Arcs, contourTreeMeshOut);
}
else if (block->ComputeRegularStructure == 2)
{
@ -679,7 +679,7 @@ vtkm::cont::DataSet ContourTreeAugmented::DoExecute(
// Construct the expected result for serial execution. Note, in serial the result currently
// not actually being used, but in parallel we need the sorted mesh values as output
// This part is being hit when we run in serial or parallel with more then one rank
return CreateResultFieldPoint(input, ContourTreeData.arcs, this->GetOutputFieldName());
return CreateResultFieldPoint(input, ContourTreeData.Arcs, this->GetOutputFieldName());
} // ContourTreeAugmented::DoExecute

@ -136,7 +136,7 @@ public:
IdArrayType globalIndex;
// the hyperarcs - i.e. the pseudoextremum defining the hyperarc the vertex is on
IdArrayType hyperarcs;
IdArrayType Hyperarcs;
// the first edge for each vertex
IdArrayType firstEdge;
@ -296,7 +296,7 @@ void ActiveGraph::Initialise(Mesh& mesh, const MeshExtrema& meshExtrema)
// we need to keep track of what the index of each vertex is in the active graph
// for most vertices, this should have the NO_SUCH_VERTEX flag set
AllocateVertexArrays(
nCriticalPoints); // allocates outdegree, globalIndex, hyperarcs, activeVertices
nCriticalPoints); // allocates outdegree, globalIndex, Hyperarcs, activeVertices
// our processing now depends on the degree of the vertex
// but basically, we want to set up the arrays for this vertex:
@ -317,7 +317,7 @@ void ActiveGraph::Initialise(Mesh& mesh, const MeshExtrema& meshExtrema)
activeIndices,
globalIndex,
outdegree,
hyperarcs,
this->Hyperarcs,
activeVertices);
// now we need to compute the firstEdge array from the outDegrees
@ -356,7 +356,7 @@ void ActiveGraph::Initialise(Mesh& mesh, const MeshExtrema& meshExtrema)
// then we loop through the active vertices to convert their indices to active graph indices
active_graph_inc_ns::InitializeHyperarcsFromActiveIndices initHyperarcsWorklet;
this->Invoke(initHyperarcsWorklet, hyperarcs, activeIndices);
this->Invoke(initHyperarcsWorklet, this->Hyperarcs, activeIndices);
// finally, allocate and initialise the edgeSorter array
edgeSorter.Allocate(activeEdges.GetNumberOfValues());
@ -422,7 +422,7 @@ void ActiveGraph::TransferSaddleStarts()
// update all of the edges so that the far end resets to the result of the ascent in the previous step
active_graph_inc_ns::TransferSaddleStartsResetEdgeFar transferSaddleResetWorklet;
this->Invoke(transferSaddleResetWorklet, activeEdges, hyperarcs, edgeFar);
this->Invoke(transferSaddleResetWorklet, activeEdges, this->Hyperarcs, edgeFar);
// in parallel, we need to create a vector to count the first edge for each vertex
IdArrayType newOutdegree;
@ -435,7 +435,7 @@ void ActiveGraph::TransferSaddleStarts()
firstEdge,
outdegree,
activeEdges,
hyperarcs,
this->Hyperarcs,
edgeFar,
newOutdegree);
@ -484,8 +484,13 @@ void ActiveGraph::FindGoverningSaddles()
active_graph_inc_ns::FindGoverningSaddlesWorklet findGovSaddlesWorklet;
vtkm::cont::ArrayHandleIndex edgeIndexArray(edgeSorter.GetNumberOfValues());
this->Invoke(
findGovSaddlesWorklet, edgeIndexArray, edgeSorter, edgeFar, edgeNear, hyperarcs, outdegree);
this->Invoke(findGovSaddlesWorklet,
edgeIndexArray,
edgeSorter,
edgeFar,
edgeNear,
this->Hyperarcs,
outdegree);
DebugPrint("Governing Saddles Set", __FILE__, __LINE__);
} // FindGoverningSaddles()
@ -496,7 +501,7 @@ void ActiveGraph::TransferRegularPoints()
{ // TransferRegularPointsWorklet
// we need to label the regular points that have been identified
active_graph_inc_ns::TransferRegularPointsWorklet transRegPtWorklet(isJoinGraph);
this->Invoke(transRegPtWorklet, activeVertices, hyperarcs, outdegree);
this->Invoke(transRegPtWorklet, activeVertices, this->Hyperarcs, outdegree);
DebugPrint("Regular Points Should Now Be Labelled", __FILE__, __LINE__);
} // TransferRegularPointsWorklet()
@ -538,13 +543,13 @@ void ActiveGraph::CompactActiveEdges()
// Run workflet to compute newOutdegree for each vertex
active_graph_inc_ns::CompactActiveEdgesComputeNewVertexOutdegree computeNewOutdegreeWorklet;
this->Invoke(computeNewOutdegreeWorklet,
activeVertices, // (input)
activeEdges, // (input)
edgeFar, // (input)
firstEdge, // (input)
outdegree, // (input)
hyperarcs, // (input/output)
newOutdegree // (output)
activeVertices, // (input)
activeEdges, // (input)
edgeFar, // (input)
firstEdge, // (input)
outdegree, // (input)
this->Hyperarcs, // (input/output)
newOutdegree // (output)
);
// now we do a reduction to compute the offsets of each vertex
@ -558,7 +563,7 @@ void ActiveGraph::CompactActiveEdges()
// create a temporary vector for copying
IdArrayType newActiveEdges;
newActiveEdges.Allocate(nNewEdges);
// overwriting hyperarcs in parallel is safe, as the worst than can happen is
// overwriting Hyperarcs in parallel is safe, as the worst than can happen is
// that another valid ascent is found; for comparison and validation purposes
// however it makes sense to have a `canoical' computation. To achieve this
// canonical computation, we need to write into a new array during computation
@ -578,7 +583,7 @@ void ActiveGraph::CompactActiveEdges()
edgeFar, // (input/output)
firstEdge, // (input/output)
outdegree, // (input/output)
hyperarcs // (input/output)
this->Hyperarcs // (input/output)
);
// resize the original array and recopy
@ -588,7 +593,7 @@ void ActiveGraph::CompactActiveEdges()
newActiveEdges; // vtkm ArrayHandles are smart, so we can just swap it in without having to copy
// for canonical computation: swap in newly computed hyperarc array
// hyperarcs.swap(newHyperarcs);
// this->Hyperarcs.swap(newHyperarcs);
DebugPrint("Active Edges Now Compacted", __FILE__, __LINE__);
} // CompactActiveEdges()
@ -608,7 +613,7 @@ void ActiveGraph::BuildChains()
for (vtkm::Id logStep = 0; logStep < numLogSteps; logStep++)
{ // per log step
active_graph_inc_ns::BuildChainsWorklet buildChainsWorklet;
this->Invoke(buildChainsWorklet, activeVertices, hyperarcs);
this->Invoke(buildChainsWorklet, activeVertices, this->Hyperarcs);
} // per log step
DebugPrint("Chains Built", __FILE__, __LINE__);
} // BuildChains()
@ -619,7 +624,7 @@ void ActiveGraph::BuildTrunk()
{ //BuildTrunk
// all remaining vertices belong to the trunk
active_graph_inc_ns::BuildTrunkWorklet buildTrunkWorklet;
this->Invoke(buildTrunkWorklet, activeVertices, hyperarcs);
this->Invoke(buildTrunkWorklet, activeVertices, this->Hyperarcs);
DebugPrint("Trunk Built", __FILE__, __LINE__);
} //BuildTrunk
@ -636,60 +641,60 @@ void ActiveGraph::FindSuperAndHyperNodes(MergeTree& tree)
// The following commented code block is variant ported directly from PPP2 using std::partial_sum. This has been replaced here with vtkm's ScanExclusive.
/*auto oneIfSupernode = [](vtkm::Id v) { return IsSupernode(v) ? 1 : 0; };
IdArrayType newSupernodePosition;
newSupernodePosition.Allocate(hyperarcs.GetNumberOfValues());
newSupernodePosition.Allocate(this->Hyperarcs.GetNumberOfValues());
newSupernodePosition.GetPortalControl().Set(0, 0);
std::partial_sum(
boost::make_transform_iterator(vtkm::cont::ArrayPortalToIteratorBegin(hyperarcs.GetPortalControl()), oneIfSupernode),
boost::make_transform_iterator(vtkm::cont::ArrayPortalToIteratorEnd(hyperarcs.GetPortalControl()) - 1, oneIfSupernode),
boost::make_transform_iterator(vtkm::cont::ArrayPortalToIteratorBegin(this->Hyperarcs.GetPortalControl()), oneIfSupernode),
boost::make_transform_iterator(vtkm::cont::ArrayPortalToIteratorEnd(this->Hyperarcs.GetPortalControl()) - 1, oneIfSupernode),
vtkm::cont::ArrayPortalToIteratorBegin(newSupernodePosition.GetPortalControl()) + 1);*/
IdArrayType newSupernodePosition;
OnefIfSupernode oneIfSupernodeFunctor;
auto oneIfSupernodeArrayHandle = vtkm::cont::ArrayHandleTransform<IdArrayType, OnefIfSupernode>(
hyperarcs, oneIfSupernodeFunctor);
this->Hyperarcs, oneIfSupernodeFunctor);
vtkm::cont::Algorithm::ScanExclusive(oneIfSupernodeArrayHandle, newSupernodePosition);
nSupernodes =
this->GetLastValue(newSupernodePosition) + oneIfSupernodeFunctor(this->GetLastValue(hyperarcs));
nSupernodes = this->GetLastValue(newSupernodePosition) +
oneIfSupernodeFunctor(this->GetLastValue(this->Hyperarcs));
tree.supernodes.ReleaseResources();
tree.supernodes.Allocate(nSupernodes);
tree.Supernodes.ReleaseResources();
tree.Supernodes.Allocate(nSupernodes);
// The following commented code block is variant ported directly from PPP2 using std::partial_sum. This has been replaced here with vtkm's ScanExclusive.
/*
auto oneIfHypernode = [](vtkm::Id v) { return IsHypernode(v) ? 1 : 0; };
IdArrayType newHypernodePosition;
newHypernodePosition.Allocate(hyperarcs.GetNumberOfValues());
newHypernodePosition.Allocate(this->Hyperarcs.GetNumberOfValues());
newHypernodePosition.GetPortalControl().Set(0, 0);
std::partial_sum(
boost::make_transform_iterator(vtkm::cont::ArrayPortalToIteratorBegin(hyperarcs.GetPortalControl()), oneIfHypernode),
boost::make_transform_iterator(vtkm::cont::ArrayPortalToIteratorEnd(hyperarcs.GetPortalControl()) - 1, oneIfHypernode),
boost::make_transform_iterator(vtkm::cont::ArrayPortalToIteratorBegin(this->Hyperarcs.GetPortalControl()), oneIfHypernode),
boost::make_transform_iterator(vtkm::cont::ArrayPortalToIteratorEnd(this->Hyperarcs.GetPortalControl()) - 1, oneIfHypernode),
vtkm::cont::ArrayPortalToIteratorBegin(newHypernodePosition.GetPortalControl()) + 1);
*/
IdArrayType newHypernodePosition;
OnefIfHypernode oneIfHypernodeFunctor;
auto oneIfHypernodeArrayHandle = vtkm::cont::ArrayHandleTransform<IdArrayType, OnefIfHypernode>(
hyperarcs, oneIfHypernodeFunctor);
this->Hyperarcs, oneIfHypernodeFunctor);
vtkm::cont::Algorithm::ScanExclusive(oneIfHypernodeArrayHandle, newHypernodePosition);
nHypernodes =
this->GetLastValue(newHypernodePosition) + oneIfHypernodeFunctor(this->GetLastValue(hyperarcs));
nHypernodes = this->GetLastValue(newHypernodePosition) +
oneIfHypernodeFunctor(this->GetLastValue(this->Hyperarcs));
tree.hypernodes.ReleaseResources();
tree.hypernodes.Allocate(globalIndex.GetNumberOfValues());
tree.Hypernodes.ReleaseResources();
tree.Hypernodes.Allocate(globalIndex.GetNumberOfValues());
// perform stream compression
active_graph_inc_ns::FindSuperAndHyperNodesWorklet findSuperAndHyperNodesWorklet;
vtkm::cont::ArrayHandleIndex graphVertexIndex(globalIndex.GetNumberOfValues());
this->Invoke(findSuperAndHyperNodesWorklet,
graphVertexIndex,
hyperarcs,
this->Hyperarcs,
newHypernodePosition,
newSupernodePosition,
hyperID,
tree.hypernodes,
tree.supernodes);
tree.Hypernodes,
tree.Supernodes);
DebugPrint("Super/Hypernodes Found", __FILE__, __LINE__);
tree.DebugPrint("Super/Hypernodes Found", __FILE__, __LINE__);
@ -703,12 +708,12 @@ void ActiveGraph::SetSuperArcs(MergeTree& tree)
// 1. set the hyperparents
// allocate space for the hyperparents
tree.hyperparents.ReleaseResources();
tree.hyperparents.Allocate(nSupernodes);
tree.Hyperparents.ReleaseResources();
tree.Hyperparents.Allocate(nSupernodes);
// execute the worklet to set the hyperparents
active_graph_inc_ns::SetSuperArcsSetTreeHyperparents setTreeHyperparentsWorklet;
this->Invoke(setTreeHyperparentsWorklet, tree.supernodes, hyperarcs, tree.hyperparents);
this->Invoke(setTreeHyperparentsWorklet, tree.Supernodes, this->Hyperarcs, tree.Hyperparents);
tree.DebugPrint("Hyperparents Set", __FILE__, __LINE__);
// a. And the super ID array needs setting up
@ -717,23 +722,23 @@ void ActiveGraph::SetSuperArcs(MergeTree& tree)
vtkm::cont::make_ArrayHandleConstant(NO_SUCH_ELEMENT, globalIndex.GetNumberOfValues()),
superID);
vtkm::cont::ArrayHandleIndex supernodeIndex(nSupernodes);
PermutedIdArrayType permutedSuperID(tree.supernodes, superID);
PermutedIdArrayType permutedSuperID(tree.Supernodes, superID);
vtkm::cont::Algorithm::Copy(supernodeIndex, permutedSuperID);
// 2. Sort the supernodes into segments according to hyperparent
// See comparator for details
vtkm::cont::Algorithm::Sort(tree.supernodes,
vtkm::cont::Algorithm::Sort(tree.Supernodes,
active_graph_inc_ns::HyperArcSuperNodeComparator(
tree.hyperparents, this->superID, tree.isJoinTree));
tree.Hyperparents, this->superID, tree.IsJoinTree));
// 3. Now update the other arrays to match
IdArrayType hyperParentsTemp;
hyperParentsTemp.Allocate(nSupernodes);
auto permutedTreeHyperparents = vtkm::cont::make_ArrayHandlePermutation(
vtkm::cont::make_ArrayHandlePermutation(tree.supernodes, superID), tree.hyperparents);
vtkm::cont::make_ArrayHandlePermutation(tree.Supernodes, superID), tree.Hyperparents);
vtkm::cont::Algorithm::Copy(permutedTreeHyperparents, hyperParentsTemp);
vtkm::cont::Algorithm::Copy(hyperParentsTemp, tree.hyperparents);
vtkm::cont::Algorithm::Copy(hyperParentsTemp, tree.Hyperparents);
hyperParentsTemp.ReleaseResources();
// a. And the super ID array needs setting up // TODO Check if we really need this?
vtkm::cont::Algorithm::Copy(supernodeIndex, permutedSuperID);
@ -742,31 +747,31 @@ void ActiveGraph::SetSuperArcs(MergeTree& tree)
tree.DebugPrint("Supernodes Sorted", __FILE__, __LINE__);
// 4. Allocate memory for superarcs
tree.superarcs.ReleaseResources();
tree.superarcs.Allocate(nSupernodes);
tree.firstSuperchild.ReleaseResources();
tree.firstSuperchild.Allocate(nHypernodes);
tree.Superarcs.ReleaseResources();
tree.Superarcs.Allocate(nSupernodes);
tree.FirstSuperchild.ReleaseResources();
tree.FirstSuperchild.Allocate(nHypernodes);
// 5. Each supernode points to its neighbour in the list, except at the end of segments
// execute the worklet to set the tree.hyperparents and tree.firstSuperchild
// execute the worklet to set the tree.Hyperparents and tree.FirstSuperchild
active_graph_inc_ns::SetSuperArcsSetTreeSuperarcs setTreeSuperarcsWorklet;
this->Invoke(setTreeSuperarcsWorklet,
tree.supernodes, // (input)
hyperarcs, // (input)
tree.hyperparents, // (input)
tree.Supernodes, // (input)
this->Hyperarcs, // (input)
tree.Hyperparents, // (input)
superID, // (input)
hyperID, // (input)
tree.superarcs, // (output)
tree.firstSuperchild // (output)
tree.Superarcs, // (output)
tree.FirstSuperchild // (output)
);
// 6. Now we can reset the supernodes to mesh IDs
PermutedIdArrayType permuteGlobalIndex(tree.supernodes, globalIndex);
vtkm::cont::Algorithm::Copy(permuteGlobalIndex, tree.supernodes);
PermutedIdArrayType permuteGlobalIndex(tree.Supernodes, globalIndex);
vtkm::cont::Algorithm::Copy(permuteGlobalIndex, tree.Supernodes);
// 7. and the hyperparent to point to a hyperarc rather than a graph index
PermutedIdArrayType permuteHyperID(tree.hyperparents, hyperID);
vtkm::cont::Algorithm::Copy(permuteHyperID, tree.hyperparents);
PermutedIdArrayType permuteHyperID(tree.Hyperparents, hyperID);
vtkm::cont::Algorithm::Copy(permuteHyperID, tree.Hyperparents);
tree.DebugPrint("Superarcs Set", __FILE__, __LINE__);
} // SetSuperArcs()
@ -776,15 +781,15 @@ void ActiveGraph::SetSuperArcs(MergeTree& tree)
void ActiveGraph::SetHyperArcs(MergeTree& tree)
{ // SetHyperArcs()
// 1. Allocate memory for hypertree
tree.hypernodes.Shrink(
tree.Hypernodes.Shrink(
nHypernodes); // Has been allocated previously. The values are needed but the size may be too large.
tree.hyperarcs.ReleaseResources();
tree.hyperarcs.Allocate(nHypernodes); // Has not been allocated yet
tree.Hyperarcs.ReleaseResources();
tree.Hyperarcs.Allocate(nHypernodes); // Has not been allocated yet
// 2. Use the superIDs already set to fill in the hyperarcs array
// 2. Use the superIDs already set to fill in the Hyperarcs array
active_graph_inc_ns::SetHyperArcsWorklet setHyperArcsWorklet;
this->Invoke(
setHyperArcsWorklet, tree.hypernodes, tree.hyperarcs, this->hyperarcs, this->superID);
setHyperArcsWorklet, tree.Hypernodes, tree.Hyperarcs, this->Hyperarcs, this->superID);
// Debug output
DebugPrint("Hyperarcs Set", __FILE__, __LINE__);
@ -804,28 +809,28 @@ void ActiveGraph::SetArcs(MergeTree& tree, MeshExtrema& meshExtrema)
active_graph_inc_ns::SetArcsSetSuperAndHypernodeArcs setSuperAndHypernodeArcsWorklet;
this->Invoke(setSuperAndHypernodeArcsWorklet,
this->globalIndex,
this->hyperarcs,
this->Hyperarcs,
this->hyperID,
tree.arcs,
tree.superparents);
tree.Arcs,
tree.Superparents);
DebugPrint("Sliding Arcs Set", __FILE__, __LINE__);
tree.DebugPrint("Sliding Arcs Set", __FILE__, __LINE__);
// 2. Loop through all vertices to slide down hyperarcs
// 2. Loop through all vertices to slide down Hyperarcs
active_graph_inc_ns::SetArcsSlideVertices slideVerticesWorklet(
isJoinGraph, nSupernodes, nHypernodes);
this->Invoke(slideVerticesWorklet,
tree.arcs, // (input)
tree.Arcs, // (input)
extrema, // (input) i.e,. meshExtrema.Peaks or meshExtrema.Pits
tree.firstSuperchild, // (input)
tree.supernodes, // (input)
tree.superparents); // (input/output)
tree.FirstSuperchild, // (input)
tree.Supernodes, // (input)
tree.Superparents); // (input/output)
tree.DebugPrint("Sliding Finished", __FILE__, __LINE__);
// 3. Now set the superparents correctly for the supernodes
PermuteIndexType permuteTreeSuperparents(tree.supernodes, tree.superparents);
PermuteIndexType permuteTreeSuperparents(tree.Supernodes, tree.Superparents);
vtkm::cont::ArrayHandleIndex supernodesIndex(nSupernodes);
vtkm::cont::Algorithm::Copy(supernodesIndex, permuteTreeSuperparents);
@ -833,22 +838,22 @@ void ActiveGraph::SetArcs(MergeTree& tree, MeshExtrema& meshExtrema)
// 4. Finally, sort all of the vertices onto their superarcs
IdArrayType nodes;
vtkm::cont::ArrayHandleIndex nodesIndex(tree.arcs.GetNumberOfValues());
vtkm::cont::ArrayHandleIndex nodesIndex(tree.Arcs.GetNumberOfValues());
vtkm::cont::Algorithm::Copy(nodesIndex, nodes);
// 5. Sort the nodes into segments according to superparent
// See comparator for details
vtkm::cont::Algorithm::Sort(
nodes, active_graph_inc_ns::SuperArcNodeComparator(tree.superparents, tree.isJoinTree));
nodes, active_graph_inc_ns::SuperArcNodeComparator(tree.Superparents, tree.IsJoinTree));
// 6. Connect the nodes to each other
active_graph_inc_ns::SetArcsConnectNodes connectNodesWorklet;
this->Invoke(connectNodesWorklet,
tree.arcs, // (input/output)
tree.Arcs, // (input/output)
nodes, // (input)
tree.superparents, // (input)
tree.superarcs, // (input)
tree.supernodes); // (input)
tree.Superparents, // (input)
tree.Superarcs, // (input)
tree.Supernodes); // (input)
tree.DebugPrint("Arcs Set", __FILE__, __LINE__);
} // SetArcs()
@ -859,7 +864,7 @@ void ActiveGraph::AllocateVertexArrays(vtkm::Id nElems)
{
globalIndex.Allocate(nElems);
outdegree.Allocate(nElems);
hyperarcs.Allocate(nElems);
this->Hyperarcs.Allocate(nElems);
activeVertices.Allocate(nElems);
}
@ -884,7 +889,7 @@ void ActiveGraph::ReleaseTemporaryArrays()
activeEdges.ReleaseResources();
activeVertices.ReleaseResources();
edgeSorter.ReleaseResources();
hyperarcs.ReleaseResources();
this->Hyperarcs.ReleaseResources();
hyperID.ReleaseResources();
superID.ReleaseResources();
}
@ -912,7 +917,7 @@ void ActiveGraph::DebugPrint(const char* message, const char* fileName, long lin
PrintIndices("Global Index", globalIndex);
PrintIndices("First Edge", firstEdge);
PrintIndices("Outdegree", outdegree);
PrintIndices("Hyperarc ID", hyperarcs);
PrintIndices("Hyperarc ID", this->Hyperarcs);
PrintIndices("Hypernode ID", hyperID);
PrintIndices("Supernode ID", superID);
std::cout << std::endl;
@ -925,7 +930,7 @@ void ActiveGraph::DebugPrint(const char* message, const char* fileName, long lin
IdArrayType activeOutdegree;
PermuteArray<vtkm::Id>(outdegree, activeVertices, activeOutdegree);
IdArrayType activeHyperarcs;
PermuteArray<vtkm::Id>(hyperarcs, activeVertices, activeHyperarcs);
PermuteArray<vtkm::Id>(this->Hyperarcs, activeVertices, activeHyperarcs);
std::cout << "Active Vertex Arrays - Size: " << activeVertices.GetNumberOfValues() << std::endl;
PrintHeader(activeVertices.GetNumberOfValues());
PrintIndices("Active Vertices", activeVertices);

@ -110,28 +110,28 @@ public:
IdArrayType nodes;
// vector of (regular) arcs in the merge tree
IdArrayType arcs;
IdArrayType Arcs;
// vector storing which superarc owns each node
IdArrayType superparents;
IdArrayType Superparents;
// VECTORS INDEXED ON T = SIZE OF TREE
// vector storing the list of supernodes by ID
// WARNING: THESE ARE NOT SORTED BY INDEX
// Instead, they are sorted by hyperarc, secondarily on index
IdArrayType supernodes;
IdArrayType Supernodes;
// vector of superarcs in the merge tree
// stored as supernode indices
IdArrayType superarcs;
IdArrayType Superarcs;
// for boundary augmented contour tree (note: these use the same convention as supernodes/superarcs)
IdArrayType augmentnodes;
IdArrayType augmentarcs;
// vector of hyperarcs to which each supernode/arc belongs
IdArrayType hyperparents;
// vector of Hyperarcs to which each supernode/arc belongs
IdArrayType Hyperparents;
// vector tracking which superarc was transferred on which iteration
IdArrayType whenTransferred;
@ -139,18 +139,18 @@ public:
// VECTORS INDEXED ON H = SIZE OF HYPERTREE
// vector of sort indices for the hypernodes
IdArrayType hypernodes;
IdArrayType Hypernodes;
// vector of hyperarcs in the merge tree
// vector of Hyperarcs in the merge tree
// NOTE: These are supernode IDs, not hypernode IDs
// because not all hyperarcs lead to hypernodes
IdArrayType hyperarcs;
// because not all Hyperarcs lead to hypernodes
IdArrayType Hyperarcs;
// THIS ONE HAS BEEN DELETED BECAUSE IT'S THE SAME AS THE HYPERNODE ID
// ALTHOUGH THIS IS NOT NECESSARY, IT'S THE RESULT OF THE CONSTRUCTION
// vector to find the first child superarc
// IdArrayType firstSuperchild;
// IdArrayType FirstSuperchild;
// ROUTINES
@ -176,13 +176,13 @@ public:
ContourTree::ContourTree()
: arcs()
, superparents()
, supernodes()
, superarcs()
, hyperparents()
, hypernodes()
, hyperarcs()
: Arcs()
, Superparents()
, Supernodes()
, Superarcs()
, Hyperparents()
, Hypernodes()
, Hyperarcs()
{ // ContourTree()
} // ContourTree()
@ -191,26 +191,26 @@ ContourTree::ContourTree()
void ContourTree::Init(vtkm::Id dataSize)
{ // Init()
vtkm::cont::ArrayHandleConstant<vtkm::Id> noSuchElementArray((vtkm::Id)NO_SUCH_ELEMENT, dataSize);
vtkm::cont::Algorithm::Copy(noSuchElementArray, arcs);
vtkm::cont::Algorithm::Copy(noSuchElementArray, superparents);
vtkm::cont::Algorithm::Copy(noSuchElementArray, this->Arcs);
vtkm::cont::Algorithm::Copy(noSuchElementArray, this->Superparents);
} // Init()
inline void ContourTree::PrintContent() const
{
PrintHeader(arcs.GetNumberOfValues());
PrintIndices("Arcs", arcs);
PrintIndices("Superparents", superparents);
PrintHeader(this->Arcs.GetNumberOfValues());
PrintIndices("Arcs", this->Arcs);
PrintIndices("Superparents", this->Superparents);
std::cout << std::endl;
PrintHeader(supernodes.GetNumberOfValues());
PrintIndices("Supernodes", supernodes);
PrintIndices("Superarcs", superarcs);
PrintIndices("Hyperparents", hyperparents);
PrintHeader(this->Supernodes.GetNumberOfValues());
PrintIndices("Supernodes", this->Supernodes);
PrintIndices("Superarcs", this->Superarcs);
PrintIndices("Hyperparents", this->Hyperparents);
PrintIndices("When Xferred", whenTransferred);
std::cout << std::endl;
PrintHeader(hypernodes.GetNumberOfValues());
PrintIndices("Hypernodes", hypernodes);
PrintIndices("Hyperarcs", hyperarcs);
PrintHeader(this->Hypernodes.GetNumberOfValues());
PrintIndices("Hypernodes", this->Hypernodes);
PrintIndices("Hyperarcs", this->Hyperarcs);
PrintHeader(augmentnodes.GetNumberOfValues());
PrintIndices("Augmentnodes", augmentnodes);
PrintIndices("Augmentarcs", augmentarcs);
@ -249,14 +249,14 @@ void ContourTree::PrintDotSuperStructure()
printf("\tsize=\"6.5, 9\"\n\tratio=\"fill\"\n");
auto whenTransferredPortal = whenTransferred.GetPortalConstControl();
auto supernodesPortal = supernodes.GetPortalConstControl();
auto superarcsPortal = superarcs.GetPortalConstControl();
auto hypernodesPortal = hypernodes.GetPortalConstControl();
auto hyperparentsPortal = hyperparents.GetPortalConstControl();
auto hyperarcsPortal = hyperarcs.GetPortalConstControl();
auto supernodesPortal = this->Supernodes.GetPortalConstControl();
auto superarcsPortal = this->Superarcs.GetPortalConstControl();
auto hypernodesPortal = this->Hypernodes.GetPortalConstControl();
auto hyperparentsPortal = this->Hyperparents.GetPortalConstControl();
auto hyperarcsPortal = this->Hyperarcs.GetPortalConstControl();
// colour the nodes by the iteration they transfer (mod # of colors) - paired iterations have similar colors RGBCMY
for (vtkm::Id supernode = 0; supernode < supernodes.GetNumberOfValues(); supernode++)
for (vtkm::Id supernode = 0; supernode < this->Supernodes.GetNumberOfValues(); supernode++)
{ // per supernode
vtkm::Id iteration = MaskedIndex(whenTransferredPortal.Get(supernode));
printf("\tnode s%lli [style=filled,fillcolor=%s]\n",
@ -265,7 +265,7 @@ void ContourTree::PrintDotSuperStructure()
} // per supernode
// loop through supernodes
for (vtkm::Id supernode = 0; supernode < supernodes.GetNumberOfValues(); supernode++)
for (vtkm::Id supernode = 0; supernode < this->Supernodes.GetNumberOfValues(); supernode++)
{ // per supernode
// skip the global root
if (NoSuchElement(superarcsPortal.Get(supernode)))
@ -284,7 +284,7 @@ void ContourTree::PrintDotSuperStructure()
} // per supernode
// now loop through hypernodes to show hyperarcs
for (vtkm::Id hypernode = 0; hypernode < hypernodes.GetNumberOfValues(); hypernode++)
for (vtkm::Id hypernode = 0; hypernode < this->Hypernodes.GetNumberOfValues(); hypernode++)
{ // per hypernode
// skip the global root
if (NoSuchElement(hyperarcsPortal.Get(hypernode)))
@ -298,7 +298,7 @@ void ContourTree::PrintDotSuperStructure()
} // per hypernode
// now add the hyperparents
for (vtkm::Id supernode = 0; supernode < supernodes.GetNumberOfValues(); supernode++)
for (vtkm::Id supernode = 0; supernode < this->Supernodes.GetNumberOfValues(); supernode++)
{ // per supernode
printf(
"\ts%lli -> s%lli [constraint=false][style=dotted]\n",
@ -307,11 +307,11 @@ void ContourTree::PrintDotSuperStructure()
} // per supernode
// now use the hyperstructure to define subgraphs
for (vtkm::Id hypernode = 0; hypernode < hypernodes.GetNumberOfValues(); hypernode++)
for (vtkm::Id hypernode = 0; hypernode < this->Hypernodes.GetNumberOfValues(); hypernode++)
{ // per hypernode
vtkm::Id firstChild = hypernodesPortal.Get(hypernode);
vtkm::Id childSentinel = (hypernode == hypernodes.GetNumberOfValues() - 1)
? supernodes.GetNumberOfValues()
vtkm::Id childSentinel = (hypernode == this->Hypernodes.GetNumberOfValues() - 1)
? this->Supernodes.GetNumberOfValues()
: hypernodesPortal.Get(hypernode + 1);
printf("\tsubgraph H%lli{ ", (vtkm::Int64)hypernode);
for (vtkm::Id supernode = firstChild; supernode < childSentinel; supernode++)

@ -223,56 +223,56 @@ void ContourTreeMaker::ComputeHyperAndSuperStructure()
if (activeSupernodes.GetNumberOfValues() == 1)
{ // meet at a vertex
vtkm::Id superID = activeSupernodes.GetPortalControl().Get(0);
contourTree.superarcs.GetPortalControl().Set(superID, (vtkm::Id)NO_SUCH_ELEMENT);
contourTree.hyperarcs.GetPortalControl().Set(superID, (vtkm::Id)NO_SUCH_ELEMENT);
contourTree.hyperparents.GetPortalControl().Set(superID, superID);
contourTree.Superarcs.GetPortalControl().Set(superID, (vtkm::Id)NO_SUCH_ELEMENT);
contourTree.Hyperarcs.GetPortalControl().Set(superID, (vtkm::Id)NO_SUCH_ELEMENT);
contourTree.Hyperparents.GetPortalControl().Set(superID, superID);
contourTree.whenTransferred.GetPortalControl().Set(superID, nIterations | IS_HYPERNODE);
} // meet at a vertex
DebugPrint("Contour Tree Constructed. Now Swizzling", __FILE__, __LINE__);
// next, we have to set up the hyper and super structure arrays one at a time
// at present, all superarcs / hyperarcs are expressed in terms of supernode IDs
// at present, all superarcs / Hyperarcs are expressed in terms of supernode IDs
// but we will want to move supernodes around.
// the first step is therefore to find the new order of supernodes by sorting
// we will use the hypernodes array for this, as we will want a copy to end up there
vtkm::cont::ArrayHandleIndex initContourTreeHypernodes(
contourTree.supernodes
contourTree.Supernodes
.GetNumberOfValues()); // create linear sequence of numbers 0, 1, .. nSupernodes
vtkm::cont::Algorithm::Copy(initContourTreeHypernodes, contourTree.hypernodes);
vtkm::cont::Algorithm::Copy(initContourTreeHypernodes, contourTree.Hypernodes);
// now we sort hypernodes array with a comparator
vtkm::cont::Algorithm::Sort(
contourTree.hypernodes,
contourTree.Hypernodes,
contourtree_maker_inc_ns::ContourTreeSuperNodeComparator(
contourTree.hyperparents, contourTree.supernodes, contourTree.whenTransferred));
contourTree.Hyperparents, contourTree.Supernodes, contourTree.whenTransferred));
// we have to permute a bunch of arrays, so let's have some temporaries to store them
IdArrayType permutedHyperparents;
PermuteArray<vtkm::Id>(contourTree.hyperparents, contourTree.hypernodes, permutedHyperparents);
PermuteArray<vtkm::Id>(contourTree.Hyperparents, contourTree.Hypernodes, permutedHyperparents);
IdArrayType permutedSupernodes;
PermuteArray<vtkm::Id>(contourTree.supernodes, contourTree.hypernodes, permutedSupernodes);
PermuteArray<vtkm::Id>(contourTree.Supernodes, contourTree.Hypernodes, permutedSupernodes);
IdArrayType permutedSuperarcs;
PermuteArray<vtkm::Id>(contourTree.superarcs, contourTree.hypernodes, permutedSuperarcs);
PermuteArray<vtkm::Id>(contourTree.Superarcs, contourTree.Hypernodes, permutedSuperarcs);
// now we establish the reverse index array
IdArrayType superSortIndex;
superSortIndex.Allocate(contourTree.supernodes.GetNumberOfValues());
superSortIndex.Allocate(contourTree.Supernodes.GetNumberOfValues());
// The following copy is equivalent to
// for (vtkm::Id supernode = 0; supernode < contourTree.supernodes.size(); supernode++)
// superSortIndex[contourTree.hypernodes[supernode]] = supernode;
// for (vtkm::Id supernode = 0; supernode < contourTree.Supernodes.size(); supernode++)
// superSortIndex[contourTree.Hypernodes[supernode]] = supernode;
//typedef vtkm::cont::ArrayHandlePermutation<IdArrayType, vtkm::cont::ArrayHandleIndex> PermuteArrayHandleIndex;
vtkm::cont::ArrayHandlePermutation<IdArrayType, IdArrayType> permutedSuperSortIndex(
contourTree.hypernodes, // index array
contourTree.Hypernodes, // index array
superSortIndex); // value array
vtkm::cont::Algorithm::Copy(
vtkm::cont::ArrayHandleIndex(contourTree.supernodes.GetNumberOfValues()), // source value array
vtkm::cont::ArrayHandleIndex(contourTree.Supernodes.GetNumberOfValues()), // source value array
permutedSuperSortIndex); // target array
// we then copy the supernodes & hyperparents back to the main array
vtkm::cont::Algorithm::Copy(permutedSupernodes, contourTree.supernodes);
vtkm::cont::Algorithm::Copy(permutedHyperparents, contourTree.hyperparents);
vtkm::cont::Algorithm::Copy(permutedSupernodes, contourTree.Supernodes);
vtkm::cont::Algorithm::Copy(permutedHyperparents, contourTree.Hyperparents);
// we need an extra permutation to get the superarcs correct
@ -280,28 +280,28 @@ void ContourTreeMaker::ComputeHyperAndSuperStructure()
this->Invoke(permuteSuperarcsWorklet,
permutedSuperarcs, // (input)
superSortIndex, // (input)
contourTree.superarcs); // (output)
contourTree.Superarcs); // (output)
// PrintIndices("Sorted", contourTree.hypernodes);
// PrintIndices("Hyperparents", contourTree.hyperparents);
// PrintIndices("Supernodes", contourTree.supernodes);
// PrintIndices("Superarcs", contourTree.superarcs);
// PrintIndices("Sorted", contourTree.Hypernodes);
// PrintIndices("Hyperparents", contourTree.Hyperparents);
// PrintIndices("Supernodes", contourTree.Supernodes);
// PrintIndices("Superarcs", contourTree.Superarcs);
// PrintIndices("Perm Superarcs", permutedSuperarcs);
// PrintIndices("SuperSortIndex", superSortIndex);
// we will permute the hyperarcs & copy them back with the new supernode target IDs
IdArrayType permutedHyperarcs;
PermuteArray<vtkm::Id>(contourTree.hyperarcs, contourTree.hypernodes, permutedHyperarcs);
PermuteArray<vtkm::Id>(contourTree.Hyperarcs, contourTree.Hypernodes, permutedHyperarcs);
contourtree_maker_inc_ns::ComputeHyperAndSuperStructure_PermuteArcs permuteHyperarcsWorklet;
this->Invoke(permuteHyperarcsWorklet, permutedHyperarcs, superSortIndex, contourTree.hyperarcs);
this->Invoke(permuteHyperarcsWorklet, permutedHyperarcs, superSortIndex, contourTree.Hyperarcs);
// now swizzle the whenTransferred value
IdArrayType permutedWhenTransferred;
PermuteArray<vtkm::Id>(
contourTree.whenTransferred, contourTree.hypernodes, permutedWhenTransferred);
contourTree.whenTransferred, contourTree.Hypernodes, permutedWhenTransferred);
vtkm::cont::Algorithm::Copy(permutedWhenTransferred, contourTree.whenTransferred);
// now we compress both the hypernodes & hyperarcs
// now we compress both the hypernodes & Hyperarcs
IdArrayType newHypernodePosition;
OnefIfHypernode oneIfHypernodeFunctor;
auto oneIfHypernodeArrayHandle = vtkm::cont::ArrayHandleTransform<IdArrayType, OnefIfHypernode>(
@ -328,49 +328,49 @@ void ContourTreeMaker::ComputeHyperAndSuperStructure()
contourtree_maker_inc_ns::ComputeHyperAndSuperStructure_SetNewHypernodesAndArcs
setNewHypernodesAndArcsWorklet;
this->Invoke(setNewHypernodesAndArcsWorklet,
contourTree.supernodes,
contourTree.Supernodes,
contourTree.whenTransferred,
contourTree.hypernodes,
contourTree.hyperarcs,
contourTree.Hypernodes,
contourTree.Hyperarcs,
newHypernodePosition,
newHypernodes,
newHyperarcs);
// swap in the new computed arrays.
// vtkm ArrayHandles are smart so we can just swap the new data in here rather than copy
//vtkm::cont::Algorithm::Copy(newHypernodes, contourTree.hypernodes);
//vtkm::cont::Algorithm::Copy(newHyperarcs, contourTree.hyperarcs);
contourTree.hypernodes.ReleaseResources();
contourTree.hypernodes = newHypernodes;
contourTree.hyperarcs.ReleaseResources();
contourTree.hyperarcs = newHyperarcs;
//vtkm::cont::Algorithm::Copy(newHypernodes, contourTree.Hypernodes);
//vtkm::cont::Algorithm::Copy(newHyperarcs, contourTree.Hyperarcs);
contourTree.Hypernodes.ReleaseResources();
contourTree.Hypernodes = newHypernodes;
contourTree.Hyperarcs.ReleaseResources();
contourTree.Hyperarcs = newHyperarcs;
// now reuse the superSortIndex array for hypernode IDs
// The following copy is equivalent to
// for (vtkm::Id hypernode = 0; hypernode < contourTree.hypernodes.size(); hypernode++)
// superSortIndex[contourTree.hypernodes[hypernode]] = hypernode;
// source data array is a simple linear index from 0 to #hypernodes
vtkm::cont::ArrayHandleIndex tempHypernodeIndexArray(contourTree.hypernodes.GetNumberOfValues());
// target data array for the copy operation is superSortIndex permuted by contourTree.hypernodes
// for (vtkm::Id hypernode = 0; hypernode < contourTree.Hypernodes.size(); hypernode++)
// superSortIndex[contourTree.Hypernodes[hypernode]] = hypernode;
// source data array is a simple linear index from 0 to #Hypernodes
vtkm::cont::ArrayHandleIndex tempHypernodeIndexArray(contourTree.Hypernodes.GetNumberOfValues());
// target data array for the copy operation is superSortIndex permuted by contourTree.Hypernodes
permutedSuperSortIndex = vtkm::cont::ArrayHandlePermutation<IdArrayType, IdArrayType>(
contourTree.hypernodes, superSortIndex);
contourTree.Hypernodes, superSortIndex);
vtkm::cont::Algorithm::Copy(tempHypernodeIndexArray, permutedSuperSortIndex);
// loop through the hyperparents array, setting the first one for each
contourtree_maker_inc_ns::ComputeHyperAndSuperStructure_HypernodesSetFirstSuperchild
hypernodesSetFirstSuperchildWorklet;
this->Invoke(hypernodesSetFirstSuperchildWorklet,
contourTree.hyperparents,
contourTree.Hyperparents,
superSortIndex,
contourTree.hypernodes);
contourTree.Hypernodes);
// do a separate loop to reset the hyperparent's ID
// This does the following
// for (vtkm::Id supernode = 0; supernode < contourTree.supernodes.size(); supernode++)
// contourTree.hyperparents[supernode] = superSortIndex[MaskedIndex(contourTree.hyperparents[supernode])];
// for (vtkm::Id supernode = 0; supernode < contourTree.Supernodes.size(); supernode++)
// contourTree.Hyperparents[supernode] = superSortIndex[MaskedIndex(contourTree.Hyperparents[supernode])];
contourtree_maker_inc_ns::ComputeHyperAndSuperStructure_ResetHyperparentsId
resetHyperparentsIdWorklet;
this->Invoke(resetHyperparentsIdWorklet, superSortIndex, contourTree.hyperparents);
this->Invoke(resetHyperparentsIdWorklet, superSortIndex, contourTree.Hyperparents);
DebugPrint("Contour Tree Super Structure Constructed", __FILE__, __LINE__);
} // ComputeHyperAndSuperStructure()
@ -381,45 +381,45 @@ void ContourTreeMaker::ComputeRegularStructure(MeshExtrema& meshExtrema)
{ // ComputeRegularStructure()
// First step - use the superstructure to set the superparent for all supernodes
auto supernodesIndex = vtkm::cont::ArrayHandleIndex(
contourTree.supernodes.GetNumberOfValues()); // Counting array of length #supernodes to
contourTree.Supernodes.GetNumberOfValues()); // Counting array of length #supernodes to
auto permutedSuperparents = vtkm::cont::make_ArrayHandlePermutation(
contourTree.supernodes,
contourTree.superparents); // superparents array permmuted by the supernodes array
contourTree.Supernodes,
contourTree.Superparents); // superparents array permmuted by the supernodes array
vtkm::cont::Algorithm::Copy(supernodesIndex, permutedSuperparents);
// The above copy is equivlant to
// for (indexType supernode = 0; supernode < contourTree.supernodes.size(); supernode++)
// contourTree.superparents[contourTree.supernodes[supernode]] = supernode;
// contourTree.superparents[contourTree.Supernodes[supernode]] = supernode;
// Second step - for all remaining (regular) nodes, locate the superarc to which they belong
contourtree_maker_inc_ns::ComputeRegularStructure_LocateSuperarcs locateSuperarcsWorklet(
contourTree.hypernodes.GetNumberOfValues(), contourTree.supernodes.GetNumberOfValues());
contourTree.Hypernodes.GetNumberOfValues(), contourTree.Supernodes.GetNumberOfValues());
this->Invoke(locateSuperarcsWorklet,
contourTree.superparents, // (input/output)
contourTree.Superparents, // (input/output)
contourTree.whenTransferred, // (input)
contourTree.hyperparents, // (input)
contourTree.hyperarcs, // (input)
contourTree.hypernodes, // (input)
contourTree.supernodes, // (input)
contourTree.Hyperparents, // (input)
contourTree.Hyperarcs, // (input)
contourTree.Hypernodes, // (input)
contourTree.Supernodes, // (input)
meshExtrema.Peaks, // (input)
meshExtrema.Pits); // (input)
// We have now set the superparent correctly for each node, and need to sort them to get the correct regular arcs
vtkm::cont::Algorithm::Copy(vtkm::cont::ArrayHandleIndex(contourTree.arcs.GetNumberOfValues()),
vtkm::cont::Algorithm::Copy(vtkm::cont::ArrayHandleIndex(contourTree.Arcs.GetNumberOfValues()),
contourTree.nodes);
vtkm::cont::Algorithm::Sort(contourTree.nodes,
contourtree_maker_inc_ns::ContourTreeNodeComparator(
contourTree.superparents, contourTree.superarcs));
contourTree.Superparents, contourTree.Superarcs));
// now set the arcs based on the array
contourtree_maker_inc_ns::ComputeRegularStructure_SetArcs setArcsWorklet(
contourTree.arcs.GetNumberOfValues());
contourTree.Arcs.GetNumberOfValues());
this->Invoke(setArcsWorklet,
contourTree.nodes, // (input) arcSorter array
contourTree.superparents, // (input)
contourTree.superarcs, // (input)
contourTree.supernodes, // (input)
contourTree.arcs); // (output)
contourTree.Superparents, // (input)
contourTree.Superarcs, // (input)
contourTree.Supernodes, // (input)
contourTree.Arcs); // (output)
DebugPrint("Regular Structure Computed", __FILE__, __LINE__);
} // ComputeRegularStructure()
@ -448,28 +448,28 @@ void ContourTreeMaker::ComputeBoundaryRegularStructure(
const MeshBoundaryExecObj& meshBoundaryExecObj)
{ // ComputeRegularStructure()
// First step - use the superstructure to set the superparent for all supernodes
auto supernodesIndex = vtkm::cont::ArrayHandleIndex(contourTree.supernodes.GetNumberOfValues());
auto supernodesIndex = vtkm::cont::ArrayHandleIndex(contourTree.Supernodes.GetNumberOfValues());
IdArrayType superparents;
InitIdArrayTypeNoSuchElement(superparents, mesh.GetNumberOfVertices());
// superparents array permmuted by the supernodes array
auto permutedSuperparents =
vtkm::cont::make_ArrayHandlePermutation(contourTree.supernodes, superparents);
vtkm::cont::make_ArrayHandlePermutation(contourTree.Supernodes, superparents);
vtkm::cont::Algorithm::Copy(supernodesIndex, permutedSuperparents);
// The above copy is equivlant to
// for (indexType supernode = 0; supernode < contourTree.supernodes.size(); supernode++)
// superparents[contourTree.supernodes[supernode]] = supernode;
// for (indexType supernode = 0; supernode < contourTree.Supernodes.size(); supernode++)
// superparents[contourTree.Supernodes[supernode]] = supernode;
// Second step - for all remaining (regular) nodes, locate the superarc to which they belong
contourtree_maker_inc_ns::ComputeRegularStructure_LocateSuperarcsOnBoundary
locateSuperarcsOnBoundaryWorklet(contourTree.hypernodes.GetNumberOfValues(),
contourTree.supernodes.GetNumberOfValues());
locateSuperarcsOnBoundaryWorklet(contourTree.Hypernodes.GetNumberOfValues(),
contourTree.Supernodes.GetNumberOfValues());
this->Invoke(locateSuperarcsOnBoundaryWorklet,
superparents, // (input/output)
contourTree.whenTransferred, // (input)
contourTree.hyperparents, // (input)
contourTree.hyperarcs, // (input)
contourTree.hypernodes, // (input)
contourTree.supernodes, // (input)
contourTree.Hyperparents, // (input)
contourTree.Hyperarcs, // (input)
contourTree.Hypernodes, // (input)
contourTree.Supernodes, // (input)
meshExtrema.Peaks, // (input)
meshExtrema.Pits, // (input)
meshBoundaryExecObj); // (input)
@ -508,7 +508,7 @@ void ContourTreeMaker::ComputeBoundaryRegularStructure(
// use a comparator to do the sort
vtkm::cont::Algorithm::Sort(
augmentnodes_sorted,
contourtree_maker_inc_ns::ContourTreeNodeComparator(superparents, contourTree.superarcs));
contourtree_maker_inc_ns::ContourTreeNodeComparator(superparents, contourTree.Superarcs));
// now set the arcs based on the array
InitIdArrayTypeNoSuchElement(contourTree.augmentarcs,
contourTree.augmentnodes.GetNumberOfValues());
@ -517,8 +517,8 @@ void ContourTreeMaker::ComputeBoundaryRegularStructure(
this->Invoke(setAugmentArcsWorklet,
augmentnodes_sorted, // (input) arcSorter array
superparents, // (input)
contourTree.superarcs, // (input)
contourTree.supernodes, // (input)
contourTree.Superarcs, // (input)
contourTree.Supernodes, // (input)
toCompressed, // (input)
contourTree.augmentarcs); // (output)
DebugPrint("Regular Boundary Structure Computed", __FILE__, __LINE__);
@ -539,25 +539,25 @@ void ContourTreeMaker::AugmentMergeTrees()
/*
// 1. Allocate an array that is guaranteed to be big enough
// - the sum of the sizes of the trees or the total size of the data
vtkm::Id nJoinSupernodes = joinTree.supernodes.GetNumberOfValues();
vtkm::Id nSplitSupernodes = splitTree.supernodes.GetNumberOfValues();
vtkm::Id nJoinSupernodes = joinTree.Supernodes.GetNumberOfValues();
vtkm::Id nSplitSupernodes = splitTree.Supernodes.GetNumberOfValues();
vtkm::Id nSupernodes = nJoinSupernodes + nSplitSupernodes;
if (nSupernodes > joinTree.arcs.GetNumberOfValues())
nSupernodes = joinTree.arcs.GetNumberOfValues();
contourTree.supernodes.Allocate(nSupernodes);
if (nSupernodes > joinTree.Arcs.GetNumberOfValues())
nSupernodes = joinTree.Arcs.GetNumberOfValues();
contourTree.Supernodes.Allocate(nSupernodes);
// 2. Make copies of the lists of join & split supernodes & sort them
IdArrayType joinSort;
joinSort.Allocate(nJoinSupernodes);
vtkm::cont::Algorithm::Copy(joinTree.supernodes, joinSort);
vtkm::cont::Algorithm::Copy(joinTree.Supernodes, joinSort);
vtkm::cont::Algorithm::Sort(joinSort);
IdArrayType splitSort;
splitSort.Allocate(nSplitSupernodes);
vtkm::cont::Algorithm::Copy(splitTree.supernodes, splitSort);
vtkm::cont::Algorithm::Copy(splitTree.Supernodes, splitSort);
vtkm::cont::Algorithm::Sort(splitSort);
// 3. Use set_union to combine the lists
auto contTreeSuperNodesBegin = vtkm::cont::ArrayPortalToIteratorBegin(contourTree.supernodes.GetPortalControl());
auto contTreeSuperNodesBegin = vtkm::cont::ArrayPortalToIteratorBegin(contourTree.Supernodes.GetPortalControl());
auto tail = std::set_union(vtkm::cont::ArrayPortalToIteratorBegin(joinSort.GetPortalControl()),
vtkm::cont::ArrayPortalToIteratorEnd(joinSort.GetPortalControl()),
vtkm::cont::ArrayPortalToIteratorBegin(splitSort.GetPortalControl()),
@ -570,27 +570,27 @@ void ContourTreeMaker::AugmentMergeTrees()
splitSort.ReleaseResources();
// 4. Resize the supernode array accordingly
contourTree.supernodes.Shrink(nSupernodes);
contourTree.Supernodes.Shrink(nSupernodes);
*/
// 1. Allocate an array that is guaranteed to be big enough
// - the sum of the sizes of the trees or the total size of the data
vtkm::Id nJoinSupernodes = joinTree.supernodes.GetNumberOfValues();
vtkm::Id nSplitSupernodes = splitTree.supernodes.GetNumberOfValues();
vtkm::Id nJoinSupernodes = joinTree.Supernodes.GetNumberOfValues();
vtkm::Id nSplitSupernodes = splitTree.Supernodes.GetNumberOfValues();
vtkm::Id nSupernodes = nJoinSupernodes + nSplitSupernodes;
// TODO Check whether this replacement for Step 2 to 4 is a problem in terms of performance
// Step 2 - 4 in original PPP2. Create a sorted list of all unique supernodes from the Join and Split tree.
contourTree.supernodes.Allocate(nSupernodes);
contourTree.Supernodes.Allocate(nSupernodes);
vtkm::cont::Algorithm::CopySubRange(
joinTree.supernodes, 0, nJoinSupernodes, contourTree.supernodes, 0);
joinTree.Supernodes, 0, nJoinSupernodes, contourTree.Supernodes, 0);
vtkm::cont::Algorithm::CopySubRange(
splitTree.supernodes, 0, nSplitSupernodes, contourTree.supernodes, nJoinSupernodes);
splitTree.Supernodes, 0, nSplitSupernodes, contourTree.Supernodes, nJoinSupernodes);
// Need to sort before Unique because VTKM only guarantees to find neighboring duplicates
vtkm::cont::Algorithm::Sort(contourTree.supernodes);
vtkm::cont::Algorithm::Unique(contourTree.supernodes);
nSupernodes = contourTree.supernodes.GetNumberOfValues();
vtkm::cont::Algorithm::Sort(contourTree.Supernodes);
vtkm::cont::Algorithm::Unique(contourTree.Supernodes);
nSupernodes = contourTree.Supernodes.GetNumberOfValues();
// 5. Create lookup arrays for the join & split supernodes' new IDs
IdArrayType newJoinID;
@ -609,11 +609,11 @@ void ContourTreeMaker::AugmentMergeTrees()
contourtree_maker_inc_ns::AugmentMergeTrees_InitNewJoinSplitIDAndSuperparents
initNewJoinSplitIDAndSuperparentsWorklet;
this->Invoke(initNewJoinSplitIDAndSuperparentsWorklet,
contourTree.supernodes, //input
joinTree.superparents, //input
splitTree.superparents, //input
joinTree.supernodes, //input
splitTree.supernodes, //input
contourTree.Supernodes, //input
joinTree.Superparents, //input
splitTree.Superparents, //input
joinTree.Supernodes, //input
splitTree.Supernodes, //input
joinSuperparents, //output
splitSuperparents, //output
newJoinID, //output
@ -628,7 +628,7 @@ void ContourTreeMaker::AugmentMergeTrees()
// the augmented superarcs. We start with the join superarcs
vtkm::cont::Algorithm::Sort(
activeSupernodes,
active_graph_inc_ns::SuperArcNodeComparator(joinSuperparents, joinTree.isJoinTree));
active_graph_inc_ns::SuperArcNodeComparator(joinSuperparents, joinTree.IsJoinTree));
// 9. Set the augmented join superarcs
augmentedJoinSuperarcs.Allocate(nSupernodes);
@ -636,7 +636,7 @@ void ContourTreeMaker::AugmentMergeTrees()
this->Invoke(setAugmentedJoinArcsWorklet,
activeSupernodes, // (input domain)
joinSuperparents, // (input)
joinTree.superarcs, // (input)
joinTree.Superarcs, // (input)
newJoinID, // (input)
augmentedJoinSuperarcs); // (output)
@ -645,7 +645,7 @@ void ContourTreeMaker::AugmentMergeTrees()
// now sort by the split superparent
vtkm::cont::Algorithm::Sort(
activeSupernodes,
active_graph_inc_ns::SuperArcNodeComparator(splitSuperparents, splitTree.isJoinTree));
active_graph_inc_ns::SuperArcNodeComparator(splitSuperparents, splitTree.IsJoinTree));
// 11. Set the augmented split superarcs
augmentedSplitSuperarcs.Allocate(nSupernodes);
@ -653,17 +653,17 @@ void ContourTreeMaker::AugmentMergeTrees()
this->Invoke(setAugmentedSplitArcsWorklet,
activeSupernodes, // (input domain)
splitSuperparents, // (input)
splitTree.superarcs, // (input)
splitTree.Superarcs, // (input)
newSplitID, // (input)
augmentedSplitSuperarcs); // (output)
// 12. Lastly, we can initialise all of the remaining arrays
vtkm::cont::ArrayHandleConstant<vtkm::Id> noSuchElementArray((vtkm::Id)NO_SUCH_ELEMENT,
nSupernodes);
vtkm::cont::Algorithm::Copy(noSuchElementArray, contourTree.superarcs);
vtkm::cont::Algorithm::Copy(noSuchElementArray, contourTree.hyperparents);
vtkm::cont::Algorithm::Copy(noSuchElementArray, contourTree.hypernodes);
vtkm::cont::Algorithm::Copy(noSuchElementArray, contourTree.hyperarcs);
vtkm::cont::Algorithm::Copy(noSuchElementArray, contourTree.Superarcs);
vtkm::cont::Algorithm::Copy(noSuchElementArray, contourTree.Hyperparents);
vtkm::cont::Algorithm::Copy(noSuchElementArray, contourTree.Hypernodes);
vtkm::cont::Algorithm::Copy(noSuchElementArray, contourTree.Hyperarcs);
vtkm::cont::Algorithm::Copy(noSuchElementArray, contourTree.whenTransferred);
// TODO We should only need to allocate the updegree/downdegree arrays. We initialize them with 0 here to ensure consistency of debug output
@ -735,13 +735,13 @@ void ContourTreeMaker::TransferLeafChains(bool isJoin)
// TODO below we initialize the outbound and inbound arrays with 0 to ensure consistency of debug output. Check if this is needed.
IdArrayType outbound;
vtkm::cont::Algorithm::Copy(
vtkm::cont::ArrayHandleConstant<vtkm::Id>(0, contourTree.supernodes.GetNumberOfValues()),
vtkm::cont::ArrayHandleConstant<vtkm::Id>(0, contourTree.Supernodes.GetNumberOfValues()),
outbound);
//outbound.Allocate(contourTree.supernodes.GetNumberOfValues());
//outbound.Allocate(contourTree.Supernodes.GetNumberOfValues());
IdArrayType inbound;
//inbound.Allocate(contourTree.supernodes.GetNumberOfValues());
//inbound.Allocate(contourTree.Supernodes.GetNumberOfValues());
vtkm::cont::Algorithm::Copy(
vtkm::cont::ArrayHandleConstant<vtkm::Id>(0, contourTree.supernodes.GetNumberOfValues()),
vtkm::cont::ArrayHandleConstant<vtkm::Id>(0, contourTree.Supernodes.GetNumberOfValues()),
inbound);
@ -812,9 +812,9 @@ void ContourTreeMaker::TransferLeafChains(bool isJoin)
inwards); // (input)
vtkm::cont::TryExecute(task,
activeSupernodes, // (input)
contourTree.hyperparents, // (output)
contourTree.hyperarcs, // (output)
contourTree.superarcs, // (output)
contourTree.Hyperparents, // (output)
contourTree.Hyperarcs, // (output)
contourTree.Superarcs, // (output)
contourTree.whenTransferred); // (output)
DebugPrint(isJoin ? "Upper Regular Chains Transferred" : "Lower Regular Chains Transferred",
@ -823,7 +823,7 @@ void ContourTreeMaker::TransferLeafChains(bool isJoin)
} // ContourTreeMaker::TransferLeafChains()
// routine to compress trees by removing regular vertices as well as hypernodes
// routine to compress trees by removing regular vertices as well as Hypernodes
void ContourTreeMaker::CompressTrees()
{ // ContourTreeMaker::CompressTrees()
@ -840,7 +840,7 @@ void ContourTreeMaker::CompressTrees()
contourtree_maker_inc_ns::CompressTrees_Step compressTreesStepWorklet;
this->Invoke(compressTreesStepWorklet,
activeSupernodes, // (input)
contourTree.superarcs, // (input)
contourTree.Superarcs, // (input)
augmentedJoinSuperarcs, // (input/output)
augmentedSplitSuperarcs // (input/output)
);

@ -78,49 +78,49 @@ class MergeTree
{ // class MergeTree
public:
// whether it is join or split tree
bool isJoinTree;
bool IsJoinTree;
// VECTORS INDEXED ON N = SIZE OF DATA
// the list of nodes is implicit
// vector of (regular) arcs in the merge tree
IdArrayType arcs;
IdArrayType Arcs;
// vector storing which superarc owns each node
IdArrayType superparents;
IdArrayType Superparents;
// VECTORS INDEXED ON T = SIZE OF TREE
// vector storing the list of supernodes by ID
// WARNING: THESE ARE NOT SORTED BY INDEX
// Instead, they are sorted by hyperarc, secondarily on index
IdArrayType supernodes;
IdArrayType Supernodes;
// vector of superarcs in the merge tree
// stored as supernode indices
IdArrayType superarcs;
IdArrayType Superarcs;
// vector of hyperarcs to which each supernode/arc belongs
IdArrayType hyperparents;
// vector of Hyperarcs to which each supernode/arc belongs
IdArrayType Hyperparents;
// VECTORS INDEXED ON H = SIZE OF HYPERTREE
// vector of sort indices for the hypernodes
IdArrayType hypernodes;
IdArrayType Hypernodes;
// vector of hyperarcs in the merge tree
// vector of Hyperarcs in the merge tree
// NOTE: These are supernode IDs, not hypernode IDs
// because not all hyperarcs lead to hypernodes
IdArrayType hyperarcs;
// because not all Hyperarcs lead to hypernodes
IdArrayType Hyperarcs;
// vector to find the first child superarc
IdArrayType firstSuperchild;
IdArrayType FirstSuperchild;
// ROUTINES
// creates merge tree (empty)
MergeTree(vtkm::Id meshSize, bool IsJoinTree);
MergeTree(vtkm::Id meshSize, bool isJoinTree);
// debug routine
void DebugPrint(const char* message, const char* fileName, long lineNum);
@ -143,23 +143,23 @@ public:
// creates merge tree (empty)
inline MergeTree::MergeTree(vtkm::Id meshSize, bool IsJoinTree)
: isJoinTree(IsJoinTree)
, supernodes()
, superarcs()
, hyperparents()
, hypernodes()
, hyperarcs()
, firstSuperchild()
inline MergeTree::MergeTree(vtkm::Id meshSize, bool isJoinTree)
: IsJoinTree(isJoinTree)
, Supernodes()
, Superarcs()
, Hyperparents()
, Hypernodes()
, Hyperarcs()
, FirstSuperchild()
{ // MergeTree()
// Allocate the arcs array
// TODO it should be sufficient to just allocate arcs without initializing it with 0s
vtkm::cont::ArrayHandleConstant<vtkm::Id> meshSizeNullArray(0, meshSize);
vtkm::cont::Algorithm::Copy(meshSizeNullArray, arcs);
vtkm::cont::Algorithm::Copy(meshSizeNullArray, this->Arcs);
// Initialize the superparents with NO_SUCH_ELEMENT
vtkm::cont::ArrayHandleConstant<vtkm::Id> noSuchElementArray((vtkm::Id)NO_SUCH_ELEMENT, meshSize);
vtkm::cont::Algorithm::Copy(noSuchElementArray, superparents);
vtkm::cont::Algorithm::Copy(noSuchElementArray, this->Superparents);
} // MergeTree()
@ -176,19 +176,19 @@ inline void MergeTree::DebugPrint(const char* message, const char* fileName, lon
std::cout << "---------------------------" << std::endl;
std::cout << std::endl;
PrintHeader(arcs.GetNumberOfValues());
PrintIndices("Arcs", arcs);
PrintIndices("Superparents", superparents);
PrintHeader(this->Arcs.GetNumberOfValues());
PrintIndices("Arcs", this->Arcs);
PrintIndices("Superparents", this->Superparents);
std::cout << std::endl;
PrintHeader(supernodes.GetNumberOfValues());
PrintIndices("Supernodes", supernodes);
PrintIndices("Superarcs", superarcs);
PrintIndices("Hyperparents", hyperparents);
PrintHeader(this->Supernodes.GetNumberOfValues());
PrintIndices("Supernodes", this->Supernodes);
PrintIndices("Superarcs", this->Superarcs);
PrintIndices("Hyperparents", this->Hyperparents);
std::cout << std::endl;
PrintHeader(hypernodes.GetNumberOfValues());
PrintIndices("Hypernodes", hypernodes);
PrintIndices("Hyperarcs", hyperarcs);
PrintIndices("First Superchild", firstSuperchild);
PrintHeader(this->Hypernodes.GetNumberOfValues());
PrintIndices("Hypernodes", this->Hypernodes);
PrintIndices("Hyperarcs", this->Hyperarcs);
PrintIndices("First Superchild", FirstSuperchild);
std::cout << std::endl;
#else
// Prevent unused parameter warning
@ -225,7 +225,7 @@ inline void MergeTree::DebugPrintTree(const char* message,
std::cout << std::setw(30) << std::left << fileName << ":" << std::right << std::setw(4)
<< lineNum << std::endl;
std::cout << std::left << std::string(message) << std::endl;
if (isJoinTree)
if (this->IsJoinTree)
{
std::cout << "Join Tree:" << std::endl;
}

@ -115,10 +115,10 @@ public:
std::vector<EdgePair> arcSorter;
// fill it up
auto arcsPortal = contourTree.arcs.GetPortalConstControl();
auto arcsPortal = contourTree.Arcs.GetPortalConstControl();
auto sortOrderPortal = sortOrder.GetPortalConstControl();
for (vtkm::Id node = 0; node < contourTree.arcs.GetNumberOfValues(); node++)
for (vtkm::Id node = 0; node < contourTree.Arcs.GetNumberOfValues(); node++)
{ // per node
// retrieve ID of target supernode
vtkm::Id arcTo = arcsPortal.Get(node);
@ -160,11 +160,11 @@ public:
std::vector<EdgePair> superarcSorter;
// fill it up
auto supernodesPortal = contourTree.supernodes.GetPortalConstControl();
auto superarcsPortal = contourTree.superarcs.GetPortalConstControl();
auto supernodesPortal = contourTree.Supernodes.GetPortalConstControl();
auto superarcsPortal = contourTree.Superarcs.GetPortalConstControl();
auto sortOrderPortal = sortOrder.GetPortalConstControl();
for (vtkm::Id supernode = 0; supernode < contourTree.supernodes.GetNumberOfValues();
for (vtkm::Id supernode = 0; supernode < contourTree.Supernodes.GetNumberOfValues();
supernode++)
{ // per supernode
// sort ID of the supernode
@ -219,18 +219,18 @@ public:
{ // ContourTreeMaker::ComputeWeights()
// start by storing the first sorted vertex ID for each superarc
IdArrayType firstVertexForSuperparent;
firstVertexForSuperparent.Allocate(contourTree.superarcs.GetNumberOfValues());
superarcIntrinsicWeight.Allocate(contourTree.superarcs.GetNumberOfValues());
firstVertexForSuperparent.Allocate(contourTree.Superarcs.GetNumberOfValues());
superarcIntrinsicWeight.Allocate(contourTree.Superarcs.GetNumberOfValues());
auto superarcIntrinsicWeightPortal = superarcIntrinsicWeight.GetPortalControl();
auto firstVertexForSuperparentPortal = firstVertexForSuperparent.GetPortalControl();
auto superparentsPortal = contourTree.superparents.GetPortalConstControl();
auto hyperparentsPortal = contourTree.hyperparents.GetPortalConstControl();
auto hypernodesPortal = contourTree.hypernodes.GetPortalConstControl();
auto hyperarcsPortal = contourTree.hyperarcs.GetPortalConstControl();
// auto superarcsPortal = contourTree.superarcs.GetPortalConstControl();
auto superparentsPortal = contourTree.Superparents.GetPortalConstControl();
auto hyperparentsPortal = contourTree.Hyperparents.GetPortalConstControl();
auto hypernodesPortal = contourTree.Hypernodes.GetPortalConstControl();
auto hyperarcsPortal = contourTree.Hyperarcs.GetPortalConstControl();
// auto superarcsPortal = contourTree.Superarcs.GetPortalConstControl();
auto nodesPortal = contourTree.nodes.GetPortalConstControl();
auto whenTransferredPortal = contourTree.whenTransferred.GetPortalConstControl();
for (vtkm::Id sortedNode = 0; sortedNode < contourTree.arcs.GetNumberOfValues(); sortedNode++)
for (vtkm::Id sortedNode = 0; sortedNode < contourTree.Arcs.GetNumberOfValues(); sortedNode++)
{ // per node in sorted order
vtkm::Id sortID = nodesPortal.Get(sortedNode);
vtkm::Id superparent = superparentsPortal.Get(sortID);
@ -240,10 +240,10 @@ public:
firstVertexForSuperparentPortal.Set(superparent, sortedNode);
} // per node in sorted order
// now we use that to compute the intrinsic weights
for (vtkm::Id superarc = 0; superarc < contourTree.superarcs.GetNumberOfValues(); superarc++)
if (superarc == contourTree.superarcs.GetNumberOfValues() - 1)
for (vtkm::Id superarc = 0; superarc < contourTree.Superarcs.GetNumberOfValues(); superarc++)
if (superarc == contourTree.Superarcs.GetNumberOfValues() - 1)
superarcIntrinsicWeightPortal.Set(superarc,
contourTree.arcs.GetNumberOfValues() -
contourTree.Arcs.GetNumberOfValues() -
firstVertexForSuperparentPortal.Get(superarc));
else
superarcIntrinsicWeightPortal.Set(superarc,
@ -252,13 +252,13 @@ public:
// now initialise the arrays for transfer & dependent weights
vtkm::cont::ArrayCopy(
vtkm::cont::ArrayHandleConstant<vtkm::Id>(0, contourTree.superarcs.GetNumberOfValues()),
vtkm::cont::ArrayHandleConstant<vtkm::Id>(0, contourTree.Superarcs.GetNumberOfValues()),
superarcDependentWeight);
vtkm::cont::ArrayCopy(
vtkm::cont::ArrayHandleConstant<vtkm::Id>(0, contourTree.supernodes.GetNumberOfValues()),
vtkm::cont::ArrayHandleConstant<vtkm::Id>(0, contourTree.Supernodes.GetNumberOfValues()),
supernodeTransferWeight);
vtkm::cont::ArrayCopy(
vtkm::cont::ArrayHandleConstant<vtkm::Id>(0, contourTree.hyperarcs.GetNumberOfValues()),
vtkm::cont::ArrayHandleConstant<vtkm::Id>(0, contourTree.Hyperarcs.GetNumberOfValues()),
hyperarcDependentWeight);
// set up the array which tracks which supernodes to deal with on which iteration
@ -266,7 +266,7 @@ public:
vtkm::cont::ArrayCopy(vtkm::cont::ArrayHandleConstant<vtkm::Id>(0, nIterations + 1),
firstSupernodePerIteration);
auto firstSupernodePerIterationPortal = firstSupernodePerIteration.GetPortalControl();
for (vtkm::Id supernode = 0; supernode < contourTree.supernodes.GetNumberOfValues();
for (vtkm::Id supernode = 0; supernode < contourTree.Supernodes.GetNumberOfValues();
supernode++)
{ // per supernode
vtkm::Id when = MaskedIndex(whenTransferredPortal.Get(supernode));
@ -285,7 +285,7 @@ public:
firstSupernodePerIterationPortal.Get(iteration + 1));
// set the sentinel at the end of the array
firstSupernodePerIterationPortal.Set(nIterations, contourTree.supernodes.GetNumberOfValues());
firstSupernodePerIterationPortal.Set(nIterations, contourTree.Supernodes.GetNumberOfValues());
// now use that array to construct a similar array for hypernodes
IdArrayType firstHypernodePerIteration;
@ -297,7 +297,7 @@ public:
for (vtkm::Id iteration = 0; iteration < nIterations; iteration++)
firstHypernodePerIterationPortal.Set(
iteration, hyperparentsPortal.Get(firstSupernodePerIterationPortal.Get(iteration)));
firstHypernodePerIterationPortal.Set(nIterations, contourTree.hypernodes.GetNumberOfValues());
firstHypernodePerIterationPortal.Set(nIterations, contourTree.Hypernodes.GetNumberOfValues());
// now iterate, propagating weights inwards
for (vtkm::Id iteration = 0; iteration < nIterations; iteration++)
@ -369,9 +369,9 @@ public:
// last superarc for the hyperarc
vtkm::Id lastSuperarc;
// special case for the last hyperarc
if (hypernode == contourTree.hypernodes.GetNumberOfValues() - 1)
if (hypernode == contourTree.Hypernodes.GetNumberOfValues() - 1)
// take the last superarc in the array
lastSuperarc = contourTree.supernodes.GetNumberOfValues() - 1;
lastSuperarc = contourTree.Supernodes.GetNumberOfValues() - 1;
else
// otherwise, take the next hypernode's ID and subtract 1
lastSuperarc = hypernodesPortal.Get(hypernode + 1) - 1;
@ -399,12 +399,12 @@ public:
IdArrayType& branchSaddle,
IdArrayType& branchParent)
{ // ComputeVolumeBranchDecomposition()
auto superarcsPortal = contourTree.superarcs.GetPortalConstControl();
auto superarcsPortal = contourTree.Superarcs.GetPortalConstControl();
auto superarcDependentWeightPortal = superarcDependentWeight.GetPortalConstControl();
auto superarcIntrinsicWeightPortal = superarcIntrinsicWeight.GetPortalConstControl();
// cache the number of non-root supernodes & superarcs
vtkm::Id nSupernodes = contourTree.supernodes.GetNumberOfValues();
vtkm::Id nSupernodes = contourTree.Supernodes.GetNumberOfValues();
vtkm::Id nSuperarcs = nSupernodes - 1;
// STAGE I: Find the upward and downwards weight for each superarc, and set up arrays
@ -555,7 +555,7 @@ public:
{ // ComputeBranchData()
// Set up constants
vtkm::Id nSupernodes = contourTree.supernodes.GetNumberOfValues();
vtkm::Id nSupernodes = contourTree.Supernodes.GetNumberOfValues();
auto noSuchElementArray =
vtkm::cont::ArrayHandleConstant<vtkm::Id>((vtkm::Id)NO_SUCH_ELEMENT, nSupernodes);
vtkm::cont::ArrayCopy(noSuchElementArray, whichBranch);
@ -663,14 +663,14 @@ public:
vtkm::cont::Algorithm::Sort(
supernodeSorter,
process_contourtree_inc_ns::SuperNodeBranchComparator(whichBranch, contourTree.supernodes));
process_contourtree_inc_ns::SuperNodeBranchComparator(whichBranch, contourTree.Supernodes));
IdArrayType permutedBranches;
permutedBranches.Allocate(nSupernodes);
PermuteArray<vtkm::Id>(whichBranch, supernodeSorter, permutedBranches);
IdArrayType permutedRegularID;
permutedRegularID.Allocate(nSupernodes);
PermuteArray<vtkm::Id>(contourTree.supernodes, supernodeSorter, permutedRegularID);
PermuteArray<vtkm::Id>(contourTree.Supernodes, supernodeSorter, permutedRegularID);
#ifdef DEBUG_PRINT
std::cout << "VI A. Sorted into Branches" << std::endl;
@ -925,7 +925,7 @@ public:
{ // ComputeHeightBranchDecomposition()
// Cache the number of non-root supernodes & superarcs
vtkm::Id nSupernodes = contourTree.supernodes.GetNumberOfValues();
vtkm::Id nSupernodes = contourTree.Supernodes.GetNumberOfValues();
auto noSuchElementArray =
vtkm::cont::ArrayHandleConstant<vtkm::Id>((vtkm::Id)NO_SUCH_ELEMENT, nSupernodes);
@ -945,14 +945,14 @@ public:
// Compute the Euler Tour
process_contourtree_inc_ns::EulerTour tour;
tour.computeEulerTour(contourTree.superarcs.GetPortalConstControl());
tour.computeEulerTour(contourTree.Superarcs.GetPortalConstControl());
// Reroot the Euler Tour at the global min
tour.getTourAtRoot(MaskedIndex(contourTree.superparents.GetPortalConstControl().Get(0)),
tour.getTourAtRoot(MaskedIndex(contourTree.Superparents.GetPortalConstControl().Get(0)),
minTourEdges.GetPortalControl());
// Reroot the Euler Tour at the global max
tour.getTourAtRoot(MaskedIndex(contourTree.superparents.GetPortalConstControl().Get(
tour.getTourAtRoot(MaskedIndex(contourTree.Superparents.GetPortalConstControl().Get(
contourTree.nodes.GetNumberOfValues() - 1)),
maxTourEdges.GetPortalControl());
@ -970,13 +970,13 @@ public:
// This is why I have left the option to do a BFS style search in serial instead of doing an a prefix min/max for every subtree in the euler tour
if (false == useParallelMinMaxSearch)
{
ProcessContourTree::findMinMax(contourTree.supernodes.GetPortalConstControl(),
ProcessContourTree::findMinMax(contourTree.Supernodes.GetPortalConstControl(),
minTourEdges.GetPortalConstControl(),
true,
minValues.GetPortalControl(),
minParents.GetPortalControl());
ProcessContourTree::findMinMax(contourTree.supernodes.GetPortalConstControl(),
ProcessContourTree::findMinMax(contourTree.Supernodes.GetPortalConstControl(),
maxTourEdges.GetPortalConstControl(),
false,
maxValues.GetPortalControl(),
@ -985,10 +985,10 @@ public:
else
{
ProcessContourTree::findMinMaxParallel(
contourTree.supernodes, minTourEdges, true, minValues, minParents);
contourTree.Supernodes, minTourEdges, true, minValues, minParents);
ProcessContourTree::findMinMaxParallel(
contourTree.supernodes, maxTourEdges, false, maxValues, maxParents);
contourTree.Supernodes, maxTourEdges, false, maxValues, maxParents);
}
//
@ -1001,7 +1001,7 @@ public:
Invoke(bestUpDownWorklet,
tour.first,
contourTree.nodes,
contourTree.supernodes,
contourTree.Supernodes,
minValues,
minParents,
maxValues,

@ -69,8 +69,8 @@ namespace active_graph_inc
class BuildChainsWorklet : public vtkm::worklet::WorkletMapField
{
public:
typedef void ControlSignature(FieldIn activeVertices, // (input) activeVertices
WholeArrayInOut hyperacrcs); // (input/output) hyperarcs
typedef void ControlSignature(FieldIn activeVertices, // (input) activeVertices
WholeArrayInOut hyperarcs); // (input/output) hyperarcs
typedef void ExecutionSignature(_1, InputIndex, _2);
using InputDomain = _1;

@ -71,7 +71,7 @@ class BuildTrunkWorklet : public vtkm::worklet::WorkletMapField
{
public:
typedef void ControlSignature(FieldIn activeVertices, // (input) activeVertices
WholeArrayInOut hyperacrs); // (input/output) hyperarcs
WholeArrayInOut hyperarcs); // (input/output) hyperarcs
typedef void ExecutionSignature(_1, InputIndex, _2);
using InputDomain = _1;

@ -121,7 +121,7 @@ public:
// In serial this worklet implements the following operation
/*
for (indexType node = 0; node < tree.arcs.size(); node++)
for (indexType node = 0; node < tree.Arcs.size(); node++)
{ // per node
indexType nodeID = nodes[node];
// work out whether we have the first node on the superarc
@ -131,21 +131,21 @@ public:
indexType superarc = tree.superarcs[superparent];
// explicit check for global minimum
if (NoSuchElement(superarc))
tree.arcs[nodeID] = NO_SUCH_ELEMENT;
tree.Arcs[nodeID] = NO_SUCH_ELEMENT;
else
tree.arcs[nodeID] = tree.supernodes[tree.superarcs[superparent]];
tree.Arcs[nodeID] = tree.Supernodes[tree.superarcs[superparent]];
} // left edge
else if (superparent != tree.superparents[nodes[node-1]])
else if (superparent != tree.Superparents[nodes[node-1]])
{ // any other transition
indexType superarc = tree.superarcs[superparent];
// explicit check for global minimum
if (NoSuchElement(superarc))
tree.arcs[nodeID] = NO_SUCH_ELEMENT;
tree.Arcs[nodeID] = NO_SUCH_ELEMENT;
else
tree.arcs[nodeID] = tree.supernodes[tree.superarcs[superparent]];
tree.Arcs[nodeID] = tree.Supernodes[tree.superarcs[superparent]];
} // any other transition
else
tree.arcs[nodeID] = nodes[node-1];
tree.Arcs[nodeID] = nodes[node-1];
} // per node
*/
}

@ -129,17 +129,17 @@ public:
indexType nodeID = globalIndex[graphVertex];
if (NoSuchElement(graphTarget))
{ // trunk hypernode
tree.arcs[nodeID] = NO_SUCH_ELEMENT | IS_HYPERNODE | IS_SUPERNODE;
tree.superparents[nodeID] = hyperID[graphVertex];
tree.Arcs[nodeID] = NO_SUCH_ELEMENT | IS_HYPERNODE | IS_SUPERNODE;
tree.Superparents[nodeID] = hyperID[graphVertex];
} // trunk hypernode
else if (IsHypernode(graphTarget))
{ // hypernode
tree.arcs[nodeID] = globalIndex[MaskedIndex(graphTarget)] | IS_HYPERNODE | IS_SUPERNODE;
tree.superparents[nodeID] = hyperID[graphVertex];
tree.Arcs[nodeID] = globalIndex[MaskedIndex(graphTarget)] | IS_HYPERNODE | IS_SUPERNODE;
tree.Superparents[nodeID] = hyperID[graphVertex];
} // hypernode
else
{ // supernode
tree.arcs[nodeID] = globalIndex[MaskedIndex(graphTarget)] | IS_SUPERNODE;
tree.Arcs[nodeID] = globalIndex[MaskedIndex(graphTarget)] | IS_SUPERNODE;
} // supernode
} // per graph vertex

@ -73,7 +73,7 @@ public:
WholeArrayIn treeArcs, // (input) arcs from the tree
WholeArrayIn
meshExtrema, // (input) extrema from the mesh (i.e, pits or peaks depending on if we have a join or split tree)
WholeArrayIn treeFirstSuperchild, // (input) firstSuperchild from the tree
WholeArrayIn treeFirstSuperchild, // (input) FirstSuperchild from the tree
WholeArrayIn treeSupernodes, // (input) supernodes from the tree
WholeArrayInOut treeSuperparents); // (input/output) superparents from the tree
typedef void ExecutionSignature(_1, InputIndex, _2, _3, _4, _5);
@ -177,31 +177,31 @@ public:
// In serial this worklet implements the following operation
/*
for (indexType nodeID = 0; nodeID < tree.arcs.size(); nodeID++)
for (indexType nodeID = 0; nodeID < tree.Arcs.size(); nodeID++)
{ // per node
// ignore if the flag is already set
if (IsSupernode(tree.arcs[nodeID]))
if (IsSupernode(tree.Arcs[nodeID]))
continue;
// start at the "top" end, retrieved from initial extremal array
vtkm::Id fromID = extrema[nodeID];
// get the "bottom" end from arcs array (it's a peak, so it's set already)
vtkm::Id toID = tree.arcs[MaskedIndex(fromID)];
vtkm::Id toID = tree.Arcs[MaskedIndex(fromID)];
// loop to bottom or until to node is "below" this node
while (!NoSuchElement(toID) && (IsJoinGraph ?
(MaskedIndex(toID) > MaskedIndex(nodeID)): (MaskedIndex(toID) < MaskedIndex(nodeID))))
{ // sliding loop
fromID = toID;
toID = tree.arcs[MaskedIndex(fromID)];
toID = tree.Arcs[MaskedIndex(fromID)];
} // sliding loop
// now we've found a hyperarc, we need to search to place ourselves on a superarc
// it's a binary search! first we get the hyperarc ID, which we've stored in superparents.
indexType hyperID = tree.superparents[MaskedIndex(fromID)];
indexType leftSupernodeID = tree.firstSuperchild[hyperID];
indexType leftNodeID = tree.supernodes[leftSupernodeID];
indexType hyperID = tree.Superparents[MaskedIndex(fromID)];
indexType leftSupernodeID = tree.FirstSuperchild[hyperID];
indexType leftNodeID = tree.Supernodes[leftSupernodeID];
// the idea here is to compare the node ID against the node IDs for supernodes along the hyperarc
// however, the "low" end - i.e. the end to which it is pruned, is not stored explicitly.
@ -216,7 +216,7 @@ public:
// special case for the left-hand edge
if (IsJoinGraph ? (nodeID < leftNodeID) : (nodeID > leftNodeID))
{ // below left hand end
tree.superparents[nodeID] = leftSupernodeID;
tree.Superparents[nodeID] = leftSupernodeID;
} // below left hand ned
else
{ // not below the left hand end
@ -228,14 +228,14 @@ public:
if (hyperID == NumHypernodes - 1)
rightSupernodeID = NumSupernodes - 1;
else
rightSupernodeID = tree.firstSuperchild[hyperID + 1] - 1;
rightSupernodeID = tree.FirstSuperchild[hyperID + 1] - 1;
} // join graph
else
{ // split graph
if (hyperID == 0)
rightSupernodeID = NumSupernodes - 1;
else
rightSupernodeID = tree.firstSuperchild[hyperID - 1] - 1;
rightSupernodeID = tree.FirstSuperchild[hyperID - 1] - 1;
} // split graph
// the right end is guaranteed to be the hypernode at the top, which is not
@ -245,7 +245,7 @@ public:
{ // binary search
vtkm::Id midSupernodeID = (leftSupernodeID + rightSupernodeID) / 2;
// std::cout << "Mid Supernode ID: " << midSupernodeID << std::endl;
vtkm::Id midNodeID = tree.supernodes[midSupernodeID];
vtkm::Id midNodeID = tree.Supernodes[midSupernodeID];
// std::cout << "Mid Node ID: " << midNodeID << std::endl;
// this is NEVER equal, because nodeID cannot be a supernode
if (IsJoinGraph ? (midNodeID > nodeID) : (midNodeID < nodeID))
@ -255,7 +255,7 @@ public:
} // binary search
// we have now found the supernode/arc to which the vertex belongs
tree.superparents[nodeID] = rightSupernodeID;
tree.Superparents[nodeID] = rightSupernodeID;
} // not below the left hand end
} // per node
*/

@ -102,7 +102,7 @@ public:
for (indexType supernode = 0; supernode < nSupernodes; supernode++)
{ // per graph vertex
// retrieve the graph index
indexType graphVertex = tree.supernodes[supernode];
indexType graphVertex = tree.Supernodes[supernode];
// retrieve the ID stored in the hyperarcs array
indexType graphTarget = hyperarcs[graphVertex];

@ -76,7 +76,7 @@ public:
WholeArrayIn superId, // (input) superID from the active graph
WholeArrayIn hyperId, // (input) hyperID from the active graph
WholeArrayOut treeSuperarcs, // (output) superarcs from the tree
WholeArrayOut treeFirstSuperchild); // (output) firstSuperchild from the tree
WholeArrayOut treeFirstSuperchild); // (output) FirstSuperchild from the tree
typedef void ExecutionSignature(_1, InputIndex, _2, _3, _4, _5, _6, _7);
using InputDomain = _1;
@ -140,7 +140,7 @@ public:
for (indexType supernode = 0; supernode < nSupernodes; supernode++)
{ // per supernode
// retrieve the actual supernode ID in the graph
indexType graphIndex = tree.supernodes[supernode];
indexType graphIndex = tree.Supernodes[supernode];
// retrieve the hyperparent (which is still a graph index, not a hypernode index)
indexType hyperparent = tree.hyperparents[supernode];
@ -173,7 +173,7 @@ public:
tree.superarcs[supernode] = superID[MaskedIndex(prunesTo)];
// we also need to set the first superchild for the hypergraph
tree.firstSuperchild[hyperID[hyperparent]] = supernode;
tree.FirstSuperchild[hyperID[hyperparent]] = supernode;
} // first supernode
// all others just point to their neighbour
else

@ -89,8 +89,8 @@ public:
bool operator()(const vtkm::Id& i, const vtkm::Id& j) const
{ // operator()
// first make sure we have the "top" end set correctly
vtkm::Id superarcI = SuperparentsPortal.Get(i);
vtkm::Id superarcJ = SuperparentsPortal.Get(j);
vtkm::Id superarcI = this->SuperparentsPortal.Get(i);
vtkm::Id superarcJ = this->SuperparentsPortal.Get(j);
// now test on that
if (superarcI < superarcJ)

@ -123,7 +123,7 @@ public:
{ // per supernode
// find the regular ID for the supernode
vtkm::Id nodeID = contourTree.supernodes[supernode];
vtkm::Id nodeID = contourTree.Supernodes[supernode];
// Transfer the join information
// look up the join superparent in the join tree
@ -131,7 +131,7 @@ public:
// save the join superparent
joinSuperparents[supernode] = joinSuperparent;
// now, if the join superparent's mesh ID is the node itself, we're at a join supernode
if (joinTree.supernodes[joinSuperparent] == nodeID)
if (joinTree.Supernodes[joinSuperparent] == nodeID)
newJoinID[joinSuperparent] = supernode;
// Transfer the split information
@ -140,7 +140,7 @@ public:
// save the split superparent
splitSuperparents[supernode] = splitSuperparent;
// now, if the split superparent's mesh ID is the node, we're at a split supernode
if (splitTree.supernodes[splitSuperparent] == nodeID)
if (splitTree.Supernodes[splitSuperparent] == nodeID)
newSplitID[splitSuperparent] = supernode;
} // per supernode

@ -103,7 +103,7 @@ public:
// In serial this worklet implements the following operation
/*
for (vtkm::Id supernode = 0; supernode < contourTree.supernodes.size(); supernode++)
for (vtkm::Id supernode = 0; supernode < contourTree.Supernodes.size(); supernode++)
{ // per supernode
bool isFirstSuperchild = false;
vtkm::Id hyperparent = contourTree.hyperparents[supernode];

@ -93,7 +93,7 @@ public:
// In serial this worklet implements the following operation
/*
for (vtkm::Id supernode = 0; supernode < contourTree.supernodes.size(); supernode++)
for (vtkm::Id supernode = 0; supernode < contourTree.Supernodes.size(); supernode++)
{ // per node
vtkm::Id superarc = permutedSuperarcs[supernode];

@ -90,7 +90,7 @@ public:
// In serial this worklet implements the following operation
/*
for (vtkm::Id supernode = 0; supernode < contourTree.supernodes.size(); supernode++)
for (vtkm::Id supernode = 0; supernode < contourTree.Supernodes.size(); supernode++)
contourTree.hyperparents[supernode] = superSortIndex[MaskedIndex(contourTree.hyperparents[supernode])];
} // per supernode
*/

@ -107,7 +107,7 @@ public:
// In serial this worklet implements the following operation
/*
for (vtkm::Id supernode = 0; supernode < contourTree.supernodes.size(); supernode++)
for (vtkm::Id supernode = 0; supernode < contourTree.Supernodes.size(); supernode++)
{ // per supernode
bool isAHypernode = IsHypernode(contourTree.whenTransferred[supernode]);

@ -82,8 +82,8 @@ public:
typedef void ExecutionSignature(_1, InputIndex, _2, _3, _4, _5, _6, _7, _8);
using InputDomain = _1;
vtkm::Id NumHypernodes; // contourTree.hypernodes.GetNumberOfValues()
vtkm::Id NumSupernodes; // contourTree.supernodes.GetNumberOfValues()
vtkm::Id NumHypernodes; // contourTree.Hypernodes.GetNumberOfValues()
vtkm::Id NumSupernodes; // contourTree.Supernodes.GetNumberOfValues()
// Default Constructor
VTKM_EXEC_CONT
@ -247,7 +247,7 @@ public:
} // regular nodes only
/*
// In serial this worklet implements the following operation
for (indexType node = 0; node < contourTree.arcs.size(); node++)
for (indexType node = 0; node < contourTree.Arcs.size(); node++)
{ // per node
// if the superparent is already set, it's a supernode, so skip it.
if (NoSuchElement(contourTree.superparents[node]))
@ -256,8 +256,8 @@ public:
indexType top = meshExtrema.Peaks[node];
indexType bottom = meshExtrema.Pits[node];
// these are the regular IDs of supernodes, so their superparents are already set
indexType topSuperparent = contourTree.superparents[top];
indexType bottomSuperparent = contourTree.superparents[bottom];
indexType topSuperparent = contourTree.Superparents[top];
indexType bottomSuperparent = contourTree.Superparents[bottom];
// and we can also find out when they transferred
indexType topWhen = contourTree.whenTransferred[topSuperparent];
indexType bottomWhen = contourTree.whenTransferred[bottomSuperparent];
@ -278,7 +278,7 @@ public:
{ // top pruned first
// we prune down to the bottom of the hyperarc in either case, by updating the top superparent
topSuperparent = contourTree.hyperarcs[MaskedIndex(topHyperparent)];
top = contourTree.supernodes[MaskedIndex(topSuperparent)];
top = contourTree.Supernodes[MaskedIndex(topSuperparent)];
topWhen = contourTree.whenTransferred[MaskedIndex(topSuperparent)];
// test to see if we've passed the node
@ -296,7 +296,7 @@ public:
{ // bottom pruned first
// we prune up to the top of the hyperarc in either case, by updating the bottom superparent
bottomSuperparent = contourTree.hyperarcs[MaskedIndex(bottomHyperparent)];
bottom = contourTree.supernodes[MaskedIndex(bottomSuperparent)];
bottom = contourTree.Supernodes[MaskedIndex(bottomSuperparent)];
bottomWhen = contourTree.whenTransferred[MaskedIndex(bottomSuperparent)];
// test to see if we've passed the node
if (bottom > node)
@ -322,18 +322,18 @@ public:
if (IsAscending(contourTree.hyperarcs[hyperparent]))
{ // ascending hyperarc
// the supernodes on the hyperarc are in sorted low-high order
indexType lowSupernode = contourTree.hypernodes[hyperparent];
indexType lowSupernode = contourTree.Hypernodes[hyperparent];
indexType highSupernode;
// if it's at the right hand end, take the last supernode in the array
if (MaskedIndex(hyperparent) == contourTree.hypernodes.size() - 1)
highSupernode = contourTree.supernodes.size() - 1;
if (MaskedIndex(hyperparent) == contourTree.Hypernodes.size() - 1)
highSupernode = contourTree.Supernodes.size() - 1;
// otherwise, take the supernode just before the next hypernode
else
highSupernode = contourTree.hypernodes[MaskedIndex(hyperparent) + 1] - 1;
highSupernode = contourTree.Hypernodes[MaskedIndex(hyperparent) + 1] - 1;
// now, the high supernode may be lower than the element, because the node belongs
// between it and the high end of the hyperarc
if (contourTree.supernodes[highSupernode] < node)
contourTree.superparents[node] = highSupernode;
if (contourTree.Supernodes[highSupernode] < node)
contourTree.Superparents[node] = highSupernode;
// otherwise, we do a binary search of the superarcs
else
{ // node between high & low
@ -343,35 +343,35 @@ public:
// find the midway supernode
indexType midSupernode = (lowSupernode + highSupernode) / 2;
// test against the node
if (contourTree.supernodes[midSupernode] > node)
if (contourTree.Supernodes[midSupernode] > node)
highSupernode = midSupernode;
// == can't happen since node is regular
else
lowSupernode = midSupernode;
} // binary search
// now we can use the low node as the superparent
contourTree.superparents[node] = lowSupernode;
contourTree.Superparents[node] = lowSupernode;
} // node between high & low
} // ascending hyperarc
else
{ // descending hyperarc
// the supernodes on the hyperarc are in sorted high-low order
indexType highSupernode = contourTree.hypernodes[hyperparent];
indexType highSupernode = contourTree.Hypernodes[hyperparent];
indexType lowSupernode;
// if it's at the right hand end, take the last supernode in the array
if (MaskedIndex(hyperparent) == contourTree.hypernodes.size() - 1)
if (MaskedIndex(hyperparent) == contourTree.Hypernodes.size() - 1)
{ // last hyperarc
lowSupernode = contourTree.supernodes.size() - 1;
lowSupernode = contourTree.Supernodes.size() - 1;
} // last hyperarc
// otherwise, take the supernode just before the next hypernode
else
{ // other hyperarc
lowSupernode = contourTree.hypernodes[MaskedIndex(hyperparent) + 1] - 1;
lowSupernode = contourTree.Hypernodes[MaskedIndex(hyperparent) + 1] - 1;
} // other hyperarc
// now, the low supernode may be higher than the element, because the node belongs
// between it and the low end of the hyperarc
if (contourTree.supernodes[lowSupernode] > node)
contourTree.superparents[node] = lowSupernode;
if (contourTree.Supernodes[lowSupernode] > node)
contourTree.Superparents[node] = lowSupernode;
// otherwise, we do a binary search of the superarcs
else
{ // node between low & high
@ -381,14 +381,14 @@ public:
// find the midway supernode
indexType midSupernode = (highSupernode + lowSupernode) / 2;
// test against the node
if (contourTree.supernodes[midSupernode] > node)
if (contourTree.Supernodes[midSupernode] > node)
highSupernode = midSupernode;
// == can't happen since node is regular
else
lowSupernode = midSupernode;
} // binary search
// now we can use the high node as the superparent
contourTree.superparents[node] = highSupernode;
contourTree.Superparents[node] = highSupernode;
} // node between low & high
} // descending hyperarc
} // regular nodes only
@ -420,8 +420,8 @@ public:
typedef void ExecutionSignature(_1, InputIndex, _2, _3, _4, _5, _6, _7, _8, _9);
using InputDomain = _1;
vtkm::Id NumHypernodes; // contourTree.hypernodes.GetNumberOfValues()
vtkm::Id NumSupernodes; // contourTree.supernodes.GetNumberOfValues()
vtkm::Id NumHypernodes; // contourTree.Hypernodes.GetNumberOfValues()
vtkm::Id NumSupernodes; // contourTree.Supernodes.GetNumberOfValues()
vtkm::Id NumRows, NumColumns, NumSlices; // Mesh 2D or 3D - NumRows, NumColumns, NumSlices
@ -588,17 +588,17 @@ public:
} // regular nodes only
/*
// In serial this worklet implements the following operation
for (indexType node = 0; node < contourTree.arcs.size(); node++)
for (indexType node = 0; node < contourTree.Arcs.size(); node++)
{ // per node
// if the superparent is already set, it's a supernode, so skip it.
if (NoSuchElement(contourTree.superparents[node]) && mesh.liesOnBoundary(node))
if (NoSuchElement(contourTree.Superparents[node]) && mesh.liesOnBoundary(node))
{ // regular nodes only
// we will need to prune top and bottom until one of them prunes past the node
indexType top = meshExtrema.Peaks[node];
indexType bottom = meshExtrema.Pits[node];
// these are the regular IDs of supernodes, so their superparents are already set
indexType topSuperparent = contourTree.superparents[top];
indexType bottomSuperparent = contourTree.superparents[bottom];
indexType topSuperparent = contourTree.Superparents[top];
indexType bottomSuperparent = contourTree.Superparents[bottom];
// and we can also find out when they transferred
indexType topWhen = contourTree.whenTransferred[topSuperparent];
indexType bottomWhen = contourTree.whenTransferred[bottomSuperparent];
@ -619,7 +619,7 @@ public:
{ // top pruned first
// we prune down to the bottom of the hyperarc in either case, by updating the top superparent
topSuperparent = contourTree.hyperarcs[MaskedIndex(topHyperparent)];
top = contourTree.supernodes[MaskedIndex(topSuperparent)];
top = contourTree.Supernodes[MaskedIndex(topSuperparent)];
topWhen = contourTree.whenTransferred[MaskedIndex(topSuperparent)];
// test to see if we've passed the node
@ -637,7 +637,7 @@ public:
{ // bottom pruned first
// we prune up to the top of the hyperarc in either case, by updating the bottom superparent
bottomSuperparent = contourTree.hyperarcs[MaskedIndex(bottomHyperparent)];
bottom = contourTree.supernodes[MaskedIndex(bottomSuperparent)];
bottom = contourTree.Supernodes[MaskedIndex(bottomSuperparent)];
bottomWhen = contourTree.whenTransferred[MaskedIndex(bottomSuperparent)];
// test to see if we've passed the node
if (bottom > node)
@ -663,18 +663,18 @@ public:
if (IsAscending(contourTree.hyperarcs[hyperparent]))
{ // ascending hyperarc
// the supernodes on the hyperarc are in sorted low-high order
indexType lowSupernode = contourTree.hypernodes[hyperparent];
indexType lowSupernode = contourTree.Hypernodes[hyperparent];
indexType highSupernode;
// if it's at the right hand end, take the last supernode in the array
if (MaskedIndex(hyperparent) == contourTree.hypernodes.size() - 1)
highSupernode = contourTree.supernodes.size() - 1;
if (MaskedIndex(hyperparent) == contourTree.Hypernodes.size() - 1)
highSupernode = contourTree.Supernodes.size() - 1;
// otherwise, take the supernode just before the next hypernode
else
highSupernode = contourTree.hypernodes[MaskedIndex(hyperparent) + 1] - 1;
highSupernode = contourTree.Hypernodes[MaskedIndex(hyperparent) + 1] - 1;
// now, the high supernode may be lower than the element, because the node belongs
// between it and the high end of the hyperarc
if (contourTree.supernodes[highSupernode] < node)
contourTree.superparents[node] = highSupernode;
if (contourTree.Supernodes[highSupernode] < node)
contourTree.Superparents[node] = highSupernode;
// otherwise, we do a binary search of the superarcs
else
{ // node between high & low
@ -684,35 +684,35 @@ public:
// find the midway supernode
indexType midSupernode = (lowSupernode + highSupernode) / 2;
// test against the node
if (contourTree.supernodes[midSupernode] > node)
if (contourTree.Supernodes[midSupernode] > node)
highSupernode = midSupernode;
// == can't happen since node is regular
else
lowSupernode = midSupernode;
} // binary search
// now we can use the low node as the superparent
contourTree.superparents[node] = lowSupernode;
contourTree.Superparents[node] = lowSupernode;
} // node between high & low
} // ascending hyperarc
else
{ // descending hyperarc
// the supernodes on the hyperarc are in sorted high-low order
indexType highSupernode = contourTree.hypernodes[hyperparent];
// the Supernodes on the hyperarc are in sorted high-low order
indexType highSupernode = contourTree.Hypernodes[hyperparent];
indexType lowSupernode;
// if it's at the right hand end, take the last supernode in the array
if (MaskedIndex(hyperparent) == contourTree.hypernodes.size() - 1)
if (MaskedIndex(hyperparent) == contourTree.Hypernodes.size() - 1)
{ // last hyperarc
lowSupernode = contourTree.supernodes.size() - 1;
lowSupernode = contourTree.Supernodes.size() - 1;
} // last hyperarc
// otherwise, take the supernode just before the next hypernode
else
{ // other hyperarc
lowSupernode = contourTree.hypernodes[MaskedIndex(hyperparent) + 1] - 1;
lowSupernode = contourTree.Hypernodes[MaskedIndex(hyperparent) + 1] - 1;
} // other hyperarc
// now, the low supernode may be higher than the element, because the node belongs
// between it and the low end of the hyperarc
if (contourTree.supernodes[lowSupernode] > node)
contourTree.superparents[node] = lowSupernode;
if (contourTree.Supernodes[lowSupernode] > node)
contourTree.Superparents[node] = lowSupernode;
// otherwise, we do a binary search of the superarcs
else
{ // node between low & high
@ -722,14 +722,14 @@ public:
// find the midway supernode
indexType midSupernode = (highSupernode + lowSupernode) / 2;
// test against the node
if (contourTree.supernodes[midSupernode] > node)
if (contourTree.Supernodes[midSupernode] > node)
highSupernode = midSupernode;
// == can't happen since node is regular
else
lowSupernode = midSupernode;
} // binary search
// now we can use the high node as the superparent
contourTree.superparents[node] = highSupernode;
contourTree.Superparents[node] = highSupernode;
} // node between low & high
} // descending hyperarc
} // regular nodes only

@ -77,7 +77,7 @@ public:
typedef void ExecutionSignature(_1, InputIndex, _2, _3, _4, _5);
using InputDomain = _1;
vtkm::Id NumArcs; // contourTree.arcs.GetNumberOfValues()
vtkm::Id NumArcs; // contourTree.Arcs.GetNumberOfValues()
// Default Constructor
VTKM_EXEC_CONT
@ -138,19 +138,19 @@ public:
// In serial this worklet implements the following operation
/*
for (vtkm::Id sortedNode = 0; sortedNode < contourTree.arcs.size(); sortedNode++)
for (vtkm::Id sortedNode = 0; sortedNode < contourTree.Arcs.size(); sortedNode++)
{ // per node
// convert arcSorter to node ID
vtkm::Id nodeID = arcSorter[sortedNode];
vtkm::Id superparent = contourTree.superparents[nodeID];
vtkm::Id superparent = contourTree.Superparents[nodeID];
// the end element is always the last
bool isLastOnSuperarc = false;
if (sortedNode == contourTree.arcs.size()-1)
if (sortedNode == contourTree.Arcs.size()-1)
isLastOnSuperarc = true;
// otherwise look for a change in the superparent
else
isLastOnSuperarc = (superparent != contourTree.superparents[arcSorter[sortedNode + 1]]);
isLastOnSuperarc = (superparent != contourTree.Superparents[arcSorter[sortedNode + 1]]);
// if it's the last on the superarc
if (isLastOnSuperarc)
@ -159,14 +159,14 @@ public:
vtkm::Id superarcEnd = contourTree.superarcs[superparent];
// this only happens for the root of the tree, but is still needed
if (NoSuchElement(superarcEnd))
contourTree.arcs[nodeID] = NO_SUCH_ELEMENT;
contourTree.Arcs[nodeID] = NO_SUCH_ELEMENT;
else
contourTree.arcs[nodeID] = contourTree.supernodes[MaskedIndex(superarcEnd)] | (superarcEnd & IS_ASCENDING);
contourTree.Arcs[nodeID] = contourTree.Supernodes[MaskedIndex(superarcEnd)] | (superarcEnd & IS_ASCENDING);
} // last on superarc
else
{ // not last on superarc
vtkm::Id neighbour = arcSorter[sortedNode+1];
contourTree.arcs[nodeID] = neighbour | ((neighbour > nodeID) ? IS_ASCENDING : 0);
contourTree.Arcs[nodeID] = neighbour | ((neighbour > nodeID) ? IS_ASCENDING : 0);
} // not last on superarc
} // per node
@ -189,7 +189,7 @@ public:
typedef void ExecutionSignature(_1, InputIndex, _2, _3, _4, _5, _6);
using InputDomain = _1;
vtkm::Id NumArcs; // contourTree.arcs.GetNumberOfValues()
vtkm::Id NumArcs; // contourTree.Arcs.GetNumberOfValues()
// Default Constructor
VTKM_EXEC_CONT

@ -82,8 +82,8 @@ public:
VTKM_CONT
ContourTreeNodeComparatorImpl(const IdArrayType& superparents, const IdArrayType& superarcs)
{
SuperparentsPortal = superparents.PrepareForInput(DeviceAdapter());
SuperarcsPortal = superarcs.PrepareForInput(DeviceAdapter());
this->SuperparentsPortal = superparents.PrepareForInput(DeviceAdapter());
this->SuperarcsPortal = superarcs.PrepareForInput(DeviceAdapter());
}
// () operator - gets called to do comparison
@ -91,8 +91,8 @@ public:
bool operator()(const vtkm::Id& leftNode, const vtkm::Id& rightNode) const
{ // operator()
// first compare the left & right superparents
vtkm::Id leftSuperparent = SuperparentsPortal.Get(leftNode);
vtkm::Id rightSuperparent = SuperparentsPortal.Get(rightNode);
vtkm::Id leftSuperparent = this->SuperparentsPortal.Get(leftNode);
vtkm::Id rightSuperparent = this->SuperparentsPortal.Get(rightNode);
if (leftSuperparent < rightSuperparent)
return true;
else if (leftSuperparent > rightSuperparent)
@ -100,7 +100,7 @@ public:
// the parents are equal, so we compare the nodes, which are sort indices & indicate value
// but we need to flip for ascending edges - we retrieve this information from the superarcs array
bool isAscendingSuperarc = IsAscending(SuperarcsPortal.Get(leftSuperparent));
bool isAscendingSuperarc = IsAscending(this->SuperarcsPortal.Get(leftSuperparent));
if (leftNode < rightNode)
return isAscendingSuperarc;
else if (leftNode > rightNode)

@ -85,7 +85,7 @@ public:
const IdArrayType& supernodes,
const IdArrayType& whenTransferred)
{
HyperparentsPortal = hyperparents.PrepareForInput(DeviceAdapter());
this->HyperparentsPortal = hyperparents.PrepareForInput(DeviceAdapter());
SupernodesPortal = supernodes.PrepareForInput(DeviceAdapter());
WhenTransferredPortal = whenTransferred.PrepareForInput(DeviceAdapter());
}
@ -103,8 +103,8 @@ public:
return false;
// next compare the left & right hyperparents
vtkm::Id leftHyperparent = HyperparentsPortal.Get(MaskedIndex(leftComparand));
vtkm::Id rightHyperparent = HyperparentsPortal.Get(MaskedIndex(rightComparand));
vtkm::Id leftHyperparent = this->HyperparentsPortal.Get(MaskedIndex(leftComparand));
vtkm::Id rightHyperparent = this->HyperparentsPortal.Get(MaskedIndex(rightComparand));
if (MaskedIndex(leftHyperparent) < MaskedIndex(rightHyperparent))
return true;
if (MaskedIndex(leftHyperparent) > MaskedIndex(rightHyperparent))

@ -89,7 +89,7 @@ public:
VTKM_CONT
ArcComparatorImpl(const IdArrayType& ct_arcs)
{ // constructor
ArcsPortal = ct_arcs.PrepareForInput(DeviceAdapter());
this->ArcsPortal = ct_arcs.PrepareForInput(DeviceAdapter());
} // constructor
// () operator - gets called to do comparison

@ -96,8 +96,8 @@ public:
ExecutionSignature(InputIndex, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14);
using InputDomain = _1;
vtkm::Id numHypernodes; // contourTree.hypernodes.GetNumberOfValues()
vtkm::Id numSupernodes; // contourTree.supernodes.GetNumberOfValues()
vtkm::Id numHypernodes; // contourTree.Hypernodes.GetNumberOfValues()
vtkm::Id numSupernodes; // contourTree.Supernodes.GetNumberOfValues()
// Default Constructor
VTKM_EXEC_CONT

@ -74,14 +74,14 @@ class SuperNodeBranchComparatorImpl
public:
using IdPortalType =
typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<DeviceAdapter>::PortalConst;
IdPortalType whichBranchPortal;
IdPortalType supernodesPortal;
IdPortalType WhichBranchPortal;
IdPortalType SupernodesPortal;
// constructor
SuperNodeBranchComparatorImpl(const IdArrayType& WhichBranch, const IdArrayType& Supernodes)
SuperNodeBranchComparatorImpl(const IdArrayType& WhichBranch, const IdArrayType& supernodes)
{ // constructor
whichBranchPortal = WhichBranch.PrepareForInput(DeviceAdapter());
supernodesPortal = Supernodes.PrepareForInput(DeviceAdapter());
WhichBranchPortal = WhichBranch.PrepareForInput(DeviceAdapter());
SupernodesPortal = supernodes.PrepareForInput(DeviceAdapter());
} // constructor
// () operator - gets called to do comparison
@ -89,8 +89,8 @@ public:
bool operator()(const vtkm::Id& i, const vtkm::Id& j) const
{ // operator()
// retrieve which branch the supernodes are on
vtkm::Id branchI = MaskedIndex(whichBranchPortal.Get(i));
vtkm::Id branchJ = MaskedIndex(whichBranchPortal.Get(j));
vtkm::Id branchI = MaskedIndex(WhichBranchPortal.Get(i));
vtkm::Id branchJ = MaskedIndex(WhichBranchPortal.Get(j));
// and test them
if (branchI < branchJ)
@ -99,8 +99,8 @@ public:
return false;
// now fall back on regular ID
vtkm::Id regularI = supernodesPortal.Get(i);
vtkm::Id regularJ = supernodesPortal.Get(j);
vtkm::Id regularI = this->SupernodesPortal.Get(i);
vtkm::Id regularJ = this->SupernodesPortal.Get(j);
if (regularI < regularJ)
return true;