mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-19 02:25:42 +00:00
Update names in MergeTree (and matching names in other classes) to comply with VTKm style
This commit is contained in:
parent
6bfd119220
commit
7ced203f6a
@ -731,8 +731,8 @@ int main(int argc, char* argv[])
|
|||||||
// create explicit representation of the branch decompostion from the array representation
|
// create explicit representation of the branch decompostion from the array representation
|
||||||
BranchType* branchDecompostionRoot =
|
BranchType* branchDecompostionRoot =
|
||||||
ctaug_ns::ProcessContourTree::ComputeBranchDecomposition<ValueType>(
|
ctaug_ns::ProcessContourTree::ComputeBranchDecomposition<ValueType>(
|
||||||
filter.GetContourTree().superparents,
|
filter.GetContourTree().Superparents,
|
||||||
filter.GetContourTree().supernodes,
|
filter.GetContourTree().Supernodes,
|
||||||
whichBranch,
|
whichBranch,
|
||||||
branchMinimum,
|
branchMinimum,
|
||||||
branchMaximum,
|
branchMaximum,
|
||||||
@ -886,31 +886,31 @@ int main(int argc, char* argv[])
|
|||||||
<< std::left
|
<< std::left
|
||||||
<< " #Arcs"
|
<< " #Arcs"
|
||||||
<< ": "
|
<< ": "
|
||||||
<< ct.arcs.GetNumberOfValues()
|
<< ct.Arcs.GetNumberOfValues()
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< std::setw(42)
|
<< std::setw(42)
|
||||||
<< std::left
|
<< std::left
|
||||||
<< " #Superparents"
|
<< " #Superparents"
|
||||||
<< ": "
|
<< ": "
|
||||||
<< ct.superparents.GetNumberOfValues()
|
<< ct.Superparents.GetNumberOfValues()
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< std::setw(42)
|
<< std::setw(42)
|
||||||
<< std::left
|
<< std::left
|
||||||
<< " #Superarcs"
|
<< " #Superarcs"
|
||||||
<< ": "
|
<< ": "
|
||||||
<< ct.superarcs.GetNumberOfValues()
|
<< ct.Superarcs.GetNumberOfValues()
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< std::setw(42)
|
<< std::setw(42)
|
||||||
<< std::left
|
<< std::left
|
||||||
<< " #Supernodes"
|
<< " #Supernodes"
|
||||||
<< ": "
|
<< ": "
|
||||||
<< ct.supernodes.GetNumberOfValues()
|
<< ct.Supernodes.GetNumberOfValues()
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< std::setw(42)
|
<< std::setw(42)
|
||||||
<< std::left
|
<< std::left
|
||||||
<< " #Hyperparents"
|
<< " #Hyperparents"
|
||||||
<< ": "
|
<< ": "
|
||||||
<< ct.hyperparents.GetNumberOfValues()
|
<< ct.Hyperparents.GetNumberOfValues()
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< std::setw(42)
|
<< std::setw(42)
|
||||||
<< std::left
|
<< std::left
|
||||||
@ -922,13 +922,13 @@ int main(int argc, char* argv[])
|
|||||||
<< std::left
|
<< std::left
|
||||||
<< " #Hypernodes"
|
<< " #Hypernodes"
|
||||||
<< ": "
|
<< ": "
|
||||||
<< ct.hypernodes.GetNumberOfValues()
|
<< ct.Hypernodes.GetNumberOfValues()
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< std::setw(42)
|
<< std::setw(42)
|
||||||
<< std::left
|
<< std::left
|
||||||
<< " #Hyperarcs"
|
<< " #Hyperarcs"
|
||||||
<< ": "
|
<< ": "
|
||||||
<< ct.hyperarcs.GetNumberOfValues()
|
<< ct.Hyperarcs.GetNumberOfValues()
|
||||||
<< std::endl);
|
<< std::endl);
|
||||||
// Flush ouput streams just to make sure everything has been logged (in particular when using MPI)
|
// Flush ouput streams just to make sure everything has been logged (in particular when using MPI)
|
||||||
std::cout << std::flush;
|
std::cout << std::flush;
|
||||||
|
@ -331,7 +331,7 @@ public:
|
|||||||
vtkm::cont::Algorithm::Copy(transformedIndex, localGlobalMeshIndex);
|
vtkm::cont::Algorithm::Copy(transformedIndex, localGlobalMeshIndex);
|
||||||
// Compute the local contour tree mesh
|
// Compute the local contour tree mesh
|
||||||
auto localContourTreeMesh = new vtkm::worklet::contourtree_augmented::ContourTreeMesh<T>(
|
auto localContourTreeMesh = new vtkm::worklet::contourtree_augmented::ContourTreeMesh<T>(
|
||||||
contourTree.arcs, sortOrder, field, localGlobalMeshIndex);
|
contourTree.Arcs, sortOrder, field, localGlobalMeshIndex);
|
||||||
return localContourTreeMesh;
|
return localContourTreeMesh;
|
||||||
}
|
}
|
||||||
else if (computeRegularStructure == 2)
|
else if (computeRegularStructure == 2)
|
||||||
@ -496,7 +496,7 @@ void MergeBlockFunctor(
|
|||||||
{
|
{
|
||||||
// If we have the fully augmented contour tree
|
// If we have the fully augmented contour tree
|
||||||
newContourTreeMesh = new vtkm::worklet::contourtree_augmented::ContourTreeMesh<FieldType>(
|
newContourTreeMesh = new vtkm::worklet::contourtree_augmented::ContourTreeMesh<FieldType>(
|
||||||
currContourTree.arcs, contourTreeMeshOut);
|
currContourTree.Arcs, contourTreeMeshOut);
|
||||||
}
|
}
|
||||||
else if (block->ComputeRegularStructure == 2)
|
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
|
// 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
|
// 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
|
// 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
|
} // ContourTreeAugmented::DoExecute
|
||||||
|
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ public:
|
|||||||
IdArrayType globalIndex;
|
IdArrayType globalIndex;
|
||||||
|
|
||||||
// the hyperarcs - i.e. the pseudoextremum defining the hyperarc the vertex is on
|
// the hyperarcs - i.e. the pseudoextremum defining the hyperarc the vertex is on
|
||||||
IdArrayType hyperarcs;
|
IdArrayType Hyperarcs;
|
||||||
|
|
||||||
// the first edge for each vertex
|
// the first edge for each vertex
|
||||||
IdArrayType firstEdge;
|
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
|
// 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
|
// for most vertices, this should have the NO_SUCH_VERTEX flag set
|
||||||
AllocateVertexArrays(
|
AllocateVertexArrays(
|
||||||
nCriticalPoints); // allocates outdegree, globalIndex, hyperarcs, activeVertices
|
nCriticalPoints); // allocates outdegree, globalIndex, Hyperarcs, activeVertices
|
||||||
|
|
||||||
// our processing now depends on the degree of the vertex
|
// our processing now depends on the degree of the vertex
|
||||||
// but basically, we want to set up the arrays for this 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,
|
activeIndices,
|
||||||
globalIndex,
|
globalIndex,
|
||||||
outdegree,
|
outdegree,
|
||||||
hyperarcs,
|
this->Hyperarcs,
|
||||||
activeVertices);
|
activeVertices);
|
||||||
|
|
||||||
// now we need to compute the firstEdge array from the outDegrees
|
// 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
|
// then we loop through the active vertices to convert their indices to active graph indices
|
||||||
active_graph_inc_ns::InitializeHyperarcsFromActiveIndices initHyperarcsWorklet;
|
active_graph_inc_ns::InitializeHyperarcsFromActiveIndices initHyperarcsWorklet;
|
||||||
this->Invoke(initHyperarcsWorklet, hyperarcs, activeIndices);
|
this->Invoke(initHyperarcsWorklet, this->Hyperarcs, activeIndices);
|
||||||
|
|
||||||
// finally, allocate and initialise the edgeSorter array
|
// finally, allocate and initialise the edgeSorter array
|
||||||
edgeSorter.Allocate(activeEdges.GetNumberOfValues());
|
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
|
// 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;
|
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
|
// in parallel, we need to create a vector to count the first edge for each vertex
|
||||||
IdArrayType newOutdegree;
|
IdArrayType newOutdegree;
|
||||||
@ -435,7 +435,7 @@ void ActiveGraph::TransferSaddleStarts()
|
|||||||
firstEdge,
|
firstEdge,
|
||||||
outdegree,
|
outdegree,
|
||||||
activeEdges,
|
activeEdges,
|
||||||
hyperarcs,
|
this->Hyperarcs,
|
||||||
edgeFar,
|
edgeFar,
|
||||||
newOutdegree);
|
newOutdegree);
|
||||||
|
|
||||||
@ -484,8 +484,13 @@ void ActiveGraph::FindGoverningSaddles()
|
|||||||
active_graph_inc_ns::FindGoverningSaddlesWorklet findGovSaddlesWorklet;
|
active_graph_inc_ns::FindGoverningSaddlesWorklet findGovSaddlesWorklet;
|
||||||
vtkm::cont::ArrayHandleIndex edgeIndexArray(edgeSorter.GetNumberOfValues());
|
vtkm::cont::ArrayHandleIndex edgeIndexArray(edgeSorter.GetNumberOfValues());
|
||||||
|
|
||||||
this->Invoke(
|
this->Invoke(findGovSaddlesWorklet,
|
||||||
findGovSaddlesWorklet, edgeIndexArray, edgeSorter, edgeFar, edgeNear, hyperarcs, outdegree);
|
edgeIndexArray,
|
||||||
|
edgeSorter,
|
||||||
|
edgeFar,
|
||||||
|
edgeNear,
|
||||||
|
this->Hyperarcs,
|
||||||
|
outdegree);
|
||||||
|
|
||||||
DebugPrint("Governing Saddles Set", __FILE__, __LINE__);
|
DebugPrint("Governing Saddles Set", __FILE__, __LINE__);
|
||||||
} // FindGoverningSaddles()
|
} // FindGoverningSaddles()
|
||||||
@ -496,7 +501,7 @@ void ActiveGraph::TransferRegularPoints()
|
|||||||
{ // TransferRegularPointsWorklet
|
{ // TransferRegularPointsWorklet
|
||||||
// we need to label the regular points that have been identified
|
// we need to label the regular points that have been identified
|
||||||
active_graph_inc_ns::TransferRegularPointsWorklet transRegPtWorklet(isJoinGraph);
|
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__);
|
DebugPrint("Regular Points Should Now Be Labelled", __FILE__, __LINE__);
|
||||||
} // TransferRegularPointsWorklet()
|
} // TransferRegularPointsWorklet()
|
||||||
@ -538,13 +543,13 @@ void ActiveGraph::CompactActiveEdges()
|
|||||||
// Run workflet to compute newOutdegree for each vertex
|
// Run workflet to compute newOutdegree for each vertex
|
||||||
active_graph_inc_ns::CompactActiveEdgesComputeNewVertexOutdegree computeNewOutdegreeWorklet;
|
active_graph_inc_ns::CompactActiveEdgesComputeNewVertexOutdegree computeNewOutdegreeWorklet;
|
||||||
this->Invoke(computeNewOutdegreeWorklet,
|
this->Invoke(computeNewOutdegreeWorklet,
|
||||||
activeVertices, // (input)
|
activeVertices, // (input)
|
||||||
activeEdges, // (input)
|
activeEdges, // (input)
|
||||||
edgeFar, // (input)
|
edgeFar, // (input)
|
||||||
firstEdge, // (input)
|
firstEdge, // (input)
|
||||||
outdegree, // (input)
|
outdegree, // (input)
|
||||||
hyperarcs, // (input/output)
|
this->Hyperarcs, // (input/output)
|
||||||
newOutdegree // (output)
|
newOutdegree // (output)
|
||||||
);
|
);
|
||||||
|
|
||||||
// now we do a reduction to compute the offsets of each vertex
|
// 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
|
// create a temporary vector for copying
|
||||||
IdArrayType newActiveEdges;
|
IdArrayType newActiveEdges;
|
||||||
newActiveEdges.Allocate(nNewEdges);
|
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
|
// that another valid ascent is found; for comparison and validation purposes
|
||||||
// however it makes sense to have a `canoical' computation. To achieve this
|
// however it makes sense to have a `canoical' computation. To achieve this
|
||||||
// canonical computation, we need to write into a new array during computation
|
// canonical computation, we need to write into a new array during computation
|
||||||
@ -578,7 +583,7 @@ void ActiveGraph::CompactActiveEdges()
|
|||||||
edgeFar, // (input/output)
|
edgeFar, // (input/output)
|
||||||
firstEdge, // (input/output)
|
firstEdge, // (input/output)
|
||||||
outdegree, // (input/output)
|
outdegree, // (input/output)
|
||||||
hyperarcs // (input/output)
|
this->Hyperarcs // (input/output)
|
||||||
);
|
);
|
||||||
|
|
||||||
// resize the original array and recopy
|
// 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
|
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
|
// for canonical computation: swap in newly computed hyperarc array
|
||||||
// hyperarcs.swap(newHyperarcs);
|
// this->Hyperarcs.swap(newHyperarcs);
|
||||||
|
|
||||||
DebugPrint("Active Edges Now Compacted", __FILE__, __LINE__);
|
DebugPrint("Active Edges Now Compacted", __FILE__, __LINE__);
|
||||||
} // CompactActiveEdges()
|
} // CompactActiveEdges()
|
||||||
@ -608,7 +613,7 @@ void ActiveGraph::BuildChains()
|
|||||||
for (vtkm::Id logStep = 0; logStep < numLogSteps; logStep++)
|
for (vtkm::Id logStep = 0; logStep < numLogSteps; logStep++)
|
||||||
{ // per log step
|
{ // per log step
|
||||||
active_graph_inc_ns::BuildChainsWorklet buildChainsWorklet;
|
active_graph_inc_ns::BuildChainsWorklet buildChainsWorklet;
|
||||||
this->Invoke(buildChainsWorklet, activeVertices, hyperarcs);
|
this->Invoke(buildChainsWorklet, activeVertices, this->Hyperarcs);
|
||||||
} // per log step
|
} // per log step
|
||||||
DebugPrint("Chains Built", __FILE__, __LINE__);
|
DebugPrint("Chains Built", __FILE__, __LINE__);
|
||||||
} // BuildChains()
|
} // BuildChains()
|
||||||
@ -619,7 +624,7 @@ void ActiveGraph::BuildTrunk()
|
|||||||
{ //BuildTrunk
|
{ //BuildTrunk
|
||||||
// all remaining vertices belong to the trunk
|
// all remaining vertices belong to the trunk
|
||||||
active_graph_inc_ns::BuildTrunkWorklet buildTrunkWorklet;
|
active_graph_inc_ns::BuildTrunkWorklet buildTrunkWorklet;
|
||||||
this->Invoke(buildTrunkWorklet, activeVertices, hyperarcs);
|
this->Invoke(buildTrunkWorklet, activeVertices, this->Hyperarcs);
|
||||||
|
|
||||||
DebugPrint("Trunk Built", __FILE__, __LINE__);
|
DebugPrint("Trunk Built", __FILE__, __LINE__);
|
||||||
} //BuildTrunk
|
} //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.
|
// 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; };
|
/*auto oneIfSupernode = [](vtkm::Id v) { return IsSupernode(v) ? 1 : 0; };
|
||||||
IdArrayType newSupernodePosition;
|
IdArrayType newSupernodePosition;
|
||||||
newSupernodePosition.Allocate(hyperarcs.GetNumberOfValues());
|
newSupernodePosition.Allocate(this->Hyperarcs.GetNumberOfValues());
|
||||||
newSupernodePosition.GetPortalControl().Set(0, 0);
|
newSupernodePosition.GetPortalControl().Set(0, 0);
|
||||||
|
|
||||||
std::partial_sum(
|
std::partial_sum(
|
||||||
boost::make_transform_iterator(vtkm::cont::ArrayPortalToIteratorBegin(hyperarcs.GetPortalControl()), oneIfSupernode),
|
boost::make_transform_iterator(vtkm::cont::ArrayPortalToIteratorBegin(this->Hyperarcs.GetPortalControl()), oneIfSupernode),
|
||||||
boost::make_transform_iterator(vtkm::cont::ArrayPortalToIteratorEnd(hyperarcs.GetPortalControl()) - 1, oneIfSupernode),
|
boost::make_transform_iterator(vtkm::cont::ArrayPortalToIteratorEnd(this->Hyperarcs.GetPortalControl()) - 1, oneIfSupernode),
|
||||||
vtkm::cont::ArrayPortalToIteratorBegin(newSupernodePosition.GetPortalControl()) + 1);*/
|
vtkm::cont::ArrayPortalToIteratorBegin(newSupernodePosition.GetPortalControl()) + 1);*/
|
||||||
|
|
||||||
IdArrayType newSupernodePosition;
|
IdArrayType newSupernodePosition;
|
||||||
OnefIfSupernode oneIfSupernodeFunctor;
|
OnefIfSupernode oneIfSupernodeFunctor;
|
||||||
auto oneIfSupernodeArrayHandle = vtkm::cont::ArrayHandleTransform<IdArrayType, OnefIfSupernode>(
|
auto oneIfSupernodeArrayHandle = vtkm::cont::ArrayHandleTransform<IdArrayType, OnefIfSupernode>(
|
||||||
hyperarcs, oneIfSupernodeFunctor);
|
this->Hyperarcs, oneIfSupernodeFunctor);
|
||||||
vtkm::cont::Algorithm::ScanExclusive(oneIfSupernodeArrayHandle, newSupernodePosition);
|
vtkm::cont::Algorithm::ScanExclusive(oneIfSupernodeArrayHandle, newSupernodePosition);
|
||||||
|
|
||||||
nSupernodes =
|
nSupernodes = this->GetLastValue(newSupernodePosition) +
|
||||||
this->GetLastValue(newSupernodePosition) + oneIfSupernodeFunctor(this->GetLastValue(hyperarcs));
|
oneIfSupernodeFunctor(this->GetLastValue(this->Hyperarcs));
|
||||||
|
|
||||||
tree.supernodes.ReleaseResources();
|
tree.Supernodes.ReleaseResources();
|
||||||
tree.supernodes.Allocate(nSupernodes);
|
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.
|
// 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; };
|
auto oneIfHypernode = [](vtkm::Id v) { return IsHypernode(v) ? 1 : 0; };
|
||||||
IdArrayType newHypernodePosition;
|
IdArrayType newHypernodePosition;
|
||||||
newHypernodePosition.Allocate(hyperarcs.GetNumberOfValues());
|
newHypernodePosition.Allocate(this->Hyperarcs.GetNumberOfValues());
|
||||||
newHypernodePosition.GetPortalControl().Set(0, 0);
|
newHypernodePosition.GetPortalControl().Set(0, 0);
|
||||||
std::partial_sum(
|
std::partial_sum(
|
||||||
boost::make_transform_iterator(vtkm::cont::ArrayPortalToIteratorBegin(hyperarcs.GetPortalControl()), oneIfHypernode),
|
boost::make_transform_iterator(vtkm::cont::ArrayPortalToIteratorBegin(this->Hyperarcs.GetPortalControl()), oneIfHypernode),
|
||||||
boost::make_transform_iterator(vtkm::cont::ArrayPortalToIteratorEnd(hyperarcs.GetPortalControl()) - 1, oneIfHypernode),
|
boost::make_transform_iterator(vtkm::cont::ArrayPortalToIteratorEnd(this->Hyperarcs.GetPortalControl()) - 1, oneIfHypernode),
|
||||||
vtkm::cont::ArrayPortalToIteratorBegin(newHypernodePosition.GetPortalControl()) + 1);
|
vtkm::cont::ArrayPortalToIteratorBegin(newHypernodePosition.GetPortalControl()) + 1);
|
||||||
*/
|
*/
|
||||||
IdArrayType newHypernodePosition;
|
IdArrayType newHypernodePosition;
|
||||||
OnefIfHypernode oneIfHypernodeFunctor;
|
OnefIfHypernode oneIfHypernodeFunctor;
|
||||||
auto oneIfHypernodeArrayHandle = vtkm::cont::ArrayHandleTransform<IdArrayType, OnefIfHypernode>(
|
auto oneIfHypernodeArrayHandle = vtkm::cont::ArrayHandleTransform<IdArrayType, OnefIfHypernode>(
|
||||||
hyperarcs, oneIfHypernodeFunctor);
|
this->Hyperarcs, oneIfHypernodeFunctor);
|
||||||
vtkm::cont::Algorithm::ScanExclusive(oneIfHypernodeArrayHandle, newHypernodePosition);
|
vtkm::cont::Algorithm::ScanExclusive(oneIfHypernodeArrayHandle, newHypernodePosition);
|
||||||
|
|
||||||
nHypernodes =
|
nHypernodes = this->GetLastValue(newHypernodePosition) +
|
||||||
this->GetLastValue(newHypernodePosition) + oneIfHypernodeFunctor(this->GetLastValue(hyperarcs));
|
oneIfHypernodeFunctor(this->GetLastValue(this->Hyperarcs));
|
||||||
|
|
||||||
tree.hypernodes.ReleaseResources();
|
tree.Hypernodes.ReleaseResources();
|
||||||
tree.hypernodes.Allocate(globalIndex.GetNumberOfValues());
|
tree.Hypernodes.Allocate(globalIndex.GetNumberOfValues());
|
||||||
|
|
||||||
// perform stream compression
|
// perform stream compression
|
||||||
active_graph_inc_ns::FindSuperAndHyperNodesWorklet findSuperAndHyperNodesWorklet;
|
active_graph_inc_ns::FindSuperAndHyperNodesWorklet findSuperAndHyperNodesWorklet;
|
||||||
vtkm::cont::ArrayHandleIndex graphVertexIndex(globalIndex.GetNumberOfValues());
|
vtkm::cont::ArrayHandleIndex graphVertexIndex(globalIndex.GetNumberOfValues());
|
||||||
this->Invoke(findSuperAndHyperNodesWorklet,
|
this->Invoke(findSuperAndHyperNodesWorklet,
|
||||||
graphVertexIndex,
|
graphVertexIndex,
|
||||||
hyperarcs,
|
this->Hyperarcs,
|
||||||
newHypernodePosition,
|
newHypernodePosition,
|
||||||
newSupernodePosition,
|
newSupernodePosition,
|
||||||
hyperID,
|
hyperID,
|
||||||
tree.hypernodes,
|
tree.Hypernodes,
|
||||||
tree.supernodes);
|
tree.Supernodes);
|
||||||
|
|
||||||
DebugPrint("Super/Hypernodes Found", __FILE__, __LINE__);
|
DebugPrint("Super/Hypernodes Found", __FILE__, __LINE__);
|
||||||
tree.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
|
// 1. set the hyperparents
|
||||||
// allocate space for the hyperparents
|
// allocate space for the hyperparents
|
||||||
tree.hyperparents.ReleaseResources();
|
tree.Hyperparents.ReleaseResources();
|
||||||
tree.hyperparents.Allocate(nSupernodes);
|
tree.Hyperparents.Allocate(nSupernodes);
|
||||||
|
|
||||||
// execute the worklet to set the hyperparents
|
// execute the worklet to set the hyperparents
|
||||||
active_graph_inc_ns::SetSuperArcsSetTreeHyperparents setTreeHyperparentsWorklet;
|
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__);
|
tree.DebugPrint("Hyperparents Set", __FILE__, __LINE__);
|
||||||
// a. And the super ID array needs setting up
|
// 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()),
|
vtkm::cont::make_ArrayHandleConstant(NO_SUCH_ELEMENT, globalIndex.GetNumberOfValues()),
|
||||||
superID);
|
superID);
|
||||||
vtkm::cont::ArrayHandleIndex supernodeIndex(nSupernodes);
|
vtkm::cont::ArrayHandleIndex supernodeIndex(nSupernodes);
|
||||||
PermutedIdArrayType permutedSuperID(tree.supernodes, superID);
|
PermutedIdArrayType permutedSuperID(tree.Supernodes, superID);
|
||||||
vtkm::cont::Algorithm::Copy(supernodeIndex, permutedSuperID);
|
vtkm::cont::Algorithm::Copy(supernodeIndex, permutedSuperID);
|
||||||
|
|
||||||
// 2. Sort the supernodes into segments according to hyperparent
|
// 2. Sort the supernodes into segments according to hyperparent
|
||||||
// See comparator for details
|
// See comparator for details
|
||||||
vtkm::cont::Algorithm::Sort(tree.supernodes,
|
vtkm::cont::Algorithm::Sort(tree.Supernodes,
|
||||||
active_graph_inc_ns::HyperArcSuperNodeComparator(
|
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
|
// 3. Now update the other arrays to match
|
||||||
IdArrayType hyperParentsTemp;
|
IdArrayType hyperParentsTemp;
|
||||||
hyperParentsTemp.Allocate(nSupernodes);
|
hyperParentsTemp.Allocate(nSupernodes);
|
||||||
auto permutedTreeHyperparents = vtkm::cont::make_ArrayHandlePermutation(
|
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(permutedTreeHyperparents, hyperParentsTemp);
|
||||||
vtkm::cont::Algorithm::Copy(hyperParentsTemp, tree.hyperparents);
|
vtkm::cont::Algorithm::Copy(hyperParentsTemp, tree.Hyperparents);
|
||||||
hyperParentsTemp.ReleaseResources();
|
hyperParentsTemp.ReleaseResources();
|
||||||
// a. And the super ID array needs setting up // TODO Check if we really need this?
|
// a. And the super ID array needs setting up // TODO Check if we really need this?
|
||||||
vtkm::cont::Algorithm::Copy(supernodeIndex, permutedSuperID);
|
vtkm::cont::Algorithm::Copy(supernodeIndex, permutedSuperID);
|
||||||
@ -742,31 +747,31 @@ void ActiveGraph::SetSuperArcs(MergeTree& tree)
|
|||||||
tree.DebugPrint("Supernodes Sorted", __FILE__, __LINE__);
|
tree.DebugPrint("Supernodes Sorted", __FILE__, __LINE__);
|
||||||
|
|
||||||
// 4. Allocate memory for superarcs
|
// 4. Allocate memory for superarcs
|
||||||
tree.superarcs.ReleaseResources();
|
tree.Superarcs.ReleaseResources();
|
||||||
tree.superarcs.Allocate(nSupernodes);
|
tree.Superarcs.Allocate(nSupernodes);
|
||||||
tree.firstSuperchild.ReleaseResources();
|
tree.FirstSuperchild.ReleaseResources();
|
||||||
tree.firstSuperchild.Allocate(nHypernodes);
|
tree.FirstSuperchild.Allocate(nHypernodes);
|
||||||
|
|
||||||
// 5. Each supernode points to its neighbour in the list, except at the end of segments
|
// 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;
|
active_graph_inc_ns::SetSuperArcsSetTreeSuperarcs setTreeSuperarcsWorklet;
|
||||||
this->Invoke(setTreeSuperarcsWorklet,
|
this->Invoke(setTreeSuperarcsWorklet,
|
||||||
tree.supernodes, // (input)
|
tree.Supernodes, // (input)
|
||||||
hyperarcs, // (input)
|
this->Hyperarcs, // (input)
|
||||||
tree.hyperparents, // (input)
|
tree.Hyperparents, // (input)
|
||||||
superID, // (input)
|
superID, // (input)
|
||||||
hyperID, // (input)
|
hyperID, // (input)
|
||||||
tree.superarcs, // (output)
|
tree.Superarcs, // (output)
|
||||||
tree.firstSuperchild // (output)
|
tree.FirstSuperchild // (output)
|
||||||
);
|
);
|
||||||
|
|
||||||
// 6. Now we can reset the supernodes to mesh IDs
|
// 6. Now we can reset the supernodes to mesh IDs
|
||||||
PermutedIdArrayType permuteGlobalIndex(tree.supernodes, globalIndex);
|
PermutedIdArrayType permuteGlobalIndex(tree.Supernodes, globalIndex);
|
||||||
vtkm::cont::Algorithm::Copy(permuteGlobalIndex, tree.supernodes);
|
vtkm::cont::Algorithm::Copy(permuteGlobalIndex, tree.Supernodes);
|
||||||
|
|
||||||
// 7. and the hyperparent to point to a hyperarc rather than a graph index
|
// 7. and the hyperparent to point to a hyperarc rather than a graph index
|
||||||
PermutedIdArrayType permuteHyperID(tree.hyperparents, hyperID);
|
PermutedIdArrayType permuteHyperID(tree.Hyperparents, hyperID);
|
||||||
vtkm::cont::Algorithm::Copy(permuteHyperID, tree.hyperparents);
|
vtkm::cont::Algorithm::Copy(permuteHyperID, tree.Hyperparents);
|
||||||
|
|
||||||
tree.DebugPrint("Superarcs Set", __FILE__, __LINE__);
|
tree.DebugPrint("Superarcs Set", __FILE__, __LINE__);
|
||||||
} // SetSuperArcs()
|
} // SetSuperArcs()
|
||||||
@ -776,15 +781,15 @@ void ActiveGraph::SetSuperArcs(MergeTree& tree)
|
|||||||
void ActiveGraph::SetHyperArcs(MergeTree& tree)
|
void ActiveGraph::SetHyperArcs(MergeTree& tree)
|
||||||
{ // SetHyperArcs()
|
{ // SetHyperArcs()
|
||||||
// 1. Allocate memory for hypertree
|
// 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.
|
nHypernodes); // Has been allocated previously. The values are needed but the size may be too large.
|
||||||
tree.hyperarcs.ReleaseResources();
|
tree.Hyperarcs.ReleaseResources();
|
||||||
tree.hyperarcs.Allocate(nHypernodes); // Has not been allocated yet
|
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;
|
active_graph_inc_ns::SetHyperArcsWorklet setHyperArcsWorklet;
|
||||||
this->Invoke(
|
this->Invoke(
|
||||||
setHyperArcsWorklet, tree.hypernodes, tree.hyperarcs, this->hyperarcs, this->superID);
|
setHyperArcsWorklet, tree.Hypernodes, tree.Hyperarcs, this->Hyperarcs, this->superID);
|
||||||
|
|
||||||
// Debug output
|
// Debug output
|
||||||
DebugPrint("Hyperarcs Set", __FILE__, __LINE__);
|
DebugPrint("Hyperarcs Set", __FILE__, __LINE__);
|
||||||
@ -804,28 +809,28 @@ void ActiveGraph::SetArcs(MergeTree& tree, MeshExtrema& meshExtrema)
|
|||||||
active_graph_inc_ns::SetArcsSetSuperAndHypernodeArcs setSuperAndHypernodeArcsWorklet;
|
active_graph_inc_ns::SetArcsSetSuperAndHypernodeArcs setSuperAndHypernodeArcsWorklet;
|
||||||
this->Invoke(setSuperAndHypernodeArcsWorklet,
|
this->Invoke(setSuperAndHypernodeArcsWorklet,
|
||||||
this->globalIndex,
|
this->globalIndex,
|
||||||
this->hyperarcs,
|
this->Hyperarcs,
|
||||||
this->hyperID,
|
this->hyperID,
|
||||||
tree.arcs,
|
tree.Arcs,
|
||||||
tree.superparents);
|
tree.Superparents);
|
||||||
|
|
||||||
DebugPrint("Sliding Arcs Set", __FILE__, __LINE__);
|
DebugPrint("Sliding Arcs Set", __FILE__, __LINE__);
|
||||||
tree.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(
|
active_graph_inc_ns::SetArcsSlideVertices slideVerticesWorklet(
|
||||||
isJoinGraph, nSupernodes, nHypernodes);
|
isJoinGraph, nSupernodes, nHypernodes);
|
||||||
this->Invoke(slideVerticesWorklet,
|
this->Invoke(slideVerticesWorklet,
|
||||||
tree.arcs, // (input)
|
tree.Arcs, // (input)
|
||||||
extrema, // (input) i.e,. meshExtrema.Peaks or meshExtrema.Pits
|
extrema, // (input) i.e,. meshExtrema.Peaks or meshExtrema.Pits
|
||||||
tree.firstSuperchild, // (input)
|
tree.FirstSuperchild, // (input)
|
||||||
tree.supernodes, // (input)
|
tree.Supernodes, // (input)
|
||||||
tree.superparents); // (input/output)
|
tree.Superparents); // (input/output)
|
||||||
|
|
||||||
tree.DebugPrint("Sliding Finished", __FILE__, __LINE__);
|
tree.DebugPrint("Sliding Finished", __FILE__, __LINE__);
|
||||||
|
|
||||||
// 3. Now set the superparents correctly for the supernodes
|
// 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::ArrayHandleIndex supernodesIndex(nSupernodes);
|
||||||
vtkm::cont::Algorithm::Copy(supernodesIndex, permuteTreeSuperparents);
|
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
|
// 4. Finally, sort all of the vertices onto their superarcs
|
||||||
IdArrayType nodes;
|
IdArrayType nodes;
|
||||||
vtkm::cont::ArrayHandleIndex nodesIndex(tree.arcs.GetNumberOfValues());
|
vtkm::cont::ArrayHandleIndex nodesIndex(tree.Arcs.GetNumberOfValues());
|
||||||
vtkm::cont::Algorithm::Copy(nodesIndex, nodes);
|
vtkm::cont::Algorithm::Copy(nodesIndex, nodes);
|
||||||
|
|
||||||
// 5. Sort the nodes into segments according to superparent
|
// 5. Sort the nodes into segments according to superparent
|
||||||
// See comparator for details
|
// See comparator for details
|
||||||
vtkm::cont::Algorithm::Sort(
|
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
|
// 6. Connect the nodes to each other
|
||||||
active_graph_inc_ns::SetArcsConnectNodes connectNodesWorklet;
|
active_graph_inc_ns::SetArcsConnectNodes connectNodesWorklet;
|
||||||
this->Invoke(connectNodesWorklet,
|
this->Invoke(connectNodesWorklet,
|
||||||
tree.arcs, // (input/output)
|
tree.Arcs, // (input/output)
|
||||||
nodes, // (input)
|
nodes, // (input)
|
||||||
tree.superparents, // (input)
|
tree.Superparents, // (input)
|
||||||
tree.superarcs, // (input)
|
tree.Superarcs, // (input)
|
||||||
tree.supernodes); // (input)
|
tree.Supernodes); // (input)
|
||||||
|
|
||||||
tree.DebugPrint("Arcs Set", __FILE__, __LINE__);
|
tree.DebugPrint("Arcs Set", __FILE__, __LINE__);
|
||||||
} // SetArcs()
|
} // SetArcs()
|
||||||
@ -859,7 +864,7 @@ void ActiveGraph::AllocateVertexArrays(vtkm::Id nElems)
|
|||||||
{
|
{
|
||||||
globalIndex.Allocate(nElems);
|
globalIndex.Allocate(nElems);
|
||||||
outdegree.Allocate(nElems);
|
outdegree.Allocate(nElems);
|
||||||
hyperarcs.Allocate(nElems);
|
this->Hyperarcs.Allocate(nElems);
|
||||||
activeVertices.Allocate(nElems);
|
activeVertices.Allocate(nElems);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -884,7 +889,7 @@ void ActiveGraph::ReleaseTemporaryArrays()
|
|||||||
activeEdges.ReleaseResources();
|
activeEdges.ReleaseResources();
|
||||||
activeVertices.ReleaseResources();
|
activeVertices.ReleaseResources();
|
||||||
edgeSorter.ReleaseResources();
|
edgeSorter.ReleaseResources();
|
||||||
hyperarcs.ReleaseResources();
|
this->Hyperarcs.ReleaseResources();
|
||||||
hyperID.ReleaseResources();
|
hyperID.ReleaseResources();
|
||||||
superID.ReleaseResources();
|
superID.ReleaseResources();
|
||||||
}
|
}
|
||||||
@ -912,7 +917,7 @@ void ActiveGraph::DebugPrint(const char* message, const char* fileName, long lin
|
|||||||
PrintIndices("Global Index", globalIndex);
|
PrintIndices("Global Index", globalIndex);
|
||||||
PrintIndices("First Edge", firstEdge);
|
PrintIndices("First Edge", firstEdge);
|
||||||
PrintIndices("Outdegree", outdegree);
|
PrintIndices("Outdegree", outdegree);
|
||||||
PrintIndices("Hyperarc ID", hyperarcs);
|
PrintIndices("Hyperarc ID", this->Hyperarcs);
|
||||||
PrintIndices("Hypernode ID", hyperID);
|
PrintIndices("Hypernode ID", hyperID);
|
||||||
PrintIndices("Supernode ID", superID);
|
PrintIndices("Supernode ID", superID);
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
@ -925,7 +930,7 @@ void ActiveGraph::DebugPrint(const char* message, const char* fileName, long lin
|
|||||||
IdArrayType activeOutdegree;
|
IdArrayType activeOutdegree;
|
||||||
PermuteArray<vtkm::Id>(outdegree, activeVertices, activeOutdegree);
|
PermuteArray<vtkm::Id>(outdegree, activeVertices, activeOutdegree);
|
||||||
IdArrayType activeHyperarcs;
|
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;
|
std::cout << "Active Vertex Arrays - Size: " << activeVertices.GetNumberOfValues() << std::endl;
|
||||||
PrintHeader(activeVertices.GetNumberOfValues());
|
PrintHeader(activeVertices.GetNumberOfValues());
|
||||||
PrintIndices("Active Vertices", activeVertices);
|
PrintIndices("Active Vertices", activeVertices);
|
||||||
|
@ -110,28 +110,28 @@ public:
|
|||||||
IdArrayType nodes;
|
IdArrayType nodes;
|
||||||
|
|
||||||
// vector of (regular) arcs in the merge tree
|
// vector of (regular) arcs in the merge tree
|
||||||
IdArrayType arcs;
|
IdArrayType Arcs;
|
||||||
|
|
||||||
// vector storing which superarc owns each node
|
// vector storing which superarc owns each node
|
||||||
IdArrayType superparents;
|
IdArrayType Superparents;
|
||||||
|
|
||||||
// VECTORS INDEXED ON T = SIZE OF TREE
|
// VECTORS INDEXED ON T = SIZE OF TREE
|
||||||
|
|
||||||
// vector storing the list of supernodes by ID
|
// vector storing the list of supernodes by ID
|
||||||
// WARNING: THESE ARE NOT SORTED BY INDEX
|
// WARNING: THESE ARE NOT SORTED BY INDEX
|
||||||
// Instead, they are sorted by hyperarc, secondarily on index
|
// Instead, they are sorted by hyperarc, secondarily on index
|
||||||
IdArrayType supernodes;
|
IdArrayType Supernodes;
|
||||||
|
|
||||||
// vector of superarcs in the merge tree
|
// vector of superarcs in the merge tree
|
||||||
// stored as supernode indices
|
// stored as supernode indices
|
||||||
IdArrayType superarcs;
|
IdArrayType Superarcs;
|
||||||
|
|
||||||
// for boundary augmented contour tree (note: these use the same convention as supernodes/superarcs)
|
// for boundary augmented contour tree (note: these use the same convention as supernodes/superarcs)
|
||||||
IdArrayType augmentnodes;
|
IdArrayType augmentnodes;
|
||||||
IdArrayType augmentarcs;
|
IdArrayType augmentarcs;
|
||||||
|
|
||||||
// vector of hyperarcs to which each supernode/arc belongs
|
// vector of Hyperarcs to which each supernode/arc belongs
|
||||||
IdArrayType hyperparents;
|
IdArrayType Hyperparents;
|
||||||
|
|
||||||
// vector tracking which superarc was transferred on which iteration
|
// vector tracking which superarc was transferred on which iteration
|
||||||
IdArrayType whenTransferred;
|
IdArrayType whenTransferred;
|
||||||
@ -139,18 +139,18 @@ public:
|
|||||||
// VECTORS INDEXED ON H = SIZE OF HYPERTREE
|
// VECTORS INDEXED ON H = SIZE OF HYPERTREE
|
||||||
|
|
||||||
// vector of sort indices for the hypernodes
|
// 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
|
// NOTE: These are supernode IDs, not hypernode IDs
|
||||||
// because not all hyperarcs lead to hypernodes
|
// because not all Hyperarcs lead to hypernodes
|
||||||
IdArrayType hyperarcs;
|
IdArrayType Hyperarcs;
|
||||||
|
|
||||||
|
|
||||||
// THIS ONE HAS BEEN DELETED BECAUSE IT'S THE SAME AS THE HYPERNODE ID
|
// 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
|
// ALTHOUGH THIS IS NOT NECESSARY, IT'S THE RESULT OF THE CONSTRUCTION
|
||||||
// vector to find the first child superarc
|
// vector to find the first child superarc
|
||||||
// IdArrayType firstSuperchild;
|
// IdArrayType FirstSuperchild;
|
||||||
|
|
||||||
// ROUTINES
|
// ROUTINES
|
||||||
|
|
||||||
@ -176,13 +176,13 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
ContourTree::ContourTree()
|
ContourTree::ContourTree()
|
||||||
: arcs()
|
: Arcs()
|
||||||
, superparents()
|
, Superparents()
|
||||||
, supernodes()
|
, Supernodes()
|
||||||
, superarcs()
|
, Superarcs()
|
||||||
, hyperparents()
|
, Hyperparents()
|
||||||
, hypernodes()
|
, Hypernodes()
|
||||||
, hyperarcs()
|
, Hyperarcs()
|
||||||
{ // ContourTree()
|
{ // ContourTree()
|
||||||
} // ContourTree()
|
} // ContourTree()
|
||||||
|
|
||||||
@ -191,26 +191,26 @@ ContourTree::ContourTree()
|
|||||||
void ContourTree::Init(vtkm::Id dataSize)
|
void ContourTree::Init(vtkm::Id dataSize)
|
||||||
{ // Init()
|
{ // Init()
|
||||||
vtkm::cont::ArrayHandleConstant<vtkm::Id> noSuchElementArray((vtkm::Id)NO_SUCH_ELEMENT, dataSize);
|
vtkm::cont::ArrayHandleConstant<vtkm::Id> noSuchElementArray((vtkm::Id)NO_SUCH_ELEMENT, dataSize);
|
||||||
vtkm::cont::Algorithm::Copy(noSuchElementArray, arcs);
|
vtkm::cont::Algorithm::Copy(noSuchElementArray, this->Arcs);
|
||||||
vtkm::cont::Algorithm::Copy(noSuchElementArray, superparents);
|
vtkm::cont::Algorithm::Copy(noSuchElementArray, this->Superparents);
|
||||||
} // Init()
|
} // Init()
|
||||||
|
|
||||||
|
|
||||||
inline void ContourTree::PrintContent() const
|
inline void ContourTree::PrintContent() const
|
||||||
{
|
{
|
||||||
PrintHeader(arcs.GetNumberOfValues());
|
PrintHeader(this->Arcs.GetNumberOfValues());
|
||||||
PrintIndices("Arcs", arcs);
|
PrintIndices("Arcs", this->Arcs);
|
||||||
PrintIndices("Superparents", superparents);
|
PrintIndices("Superparents", this->Superparents);
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
PrintHeader(supernodes.GetNumberOfValues());
|
PrintHeader(this->Supernodes.GetNumberOfValues());
|
||||||
PrintIndices("Supernodes", supernodes);
|
PrintIndices("Supernodes", this->Supernodes);
|
||||||
PrintIndices("Superarcs", superarcs);
|
PrintIndices("Superarcs", this->Superarcs);
|
||||||
PrintIndices("Hyperparents", hyperparents);
|
PrintIndices("Hyperparents", this->Hyperparents);
|
||||||
PrintIndices("When Xferred", whenTransferred);
|
PrintIndices("When Xferred", whenTransferred);
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
PrintHeader(hypernodes.GetNumberOfValues());
|
PrintHeader(this->Hypernodes.GetNumberOfValues());
|
||||||
PrintIndices("Hypernodes", hypernodes);
|
PrintIndices("Hypernodes", this->Hypernodes);
|
||||||
PrintIndices("Hyperarcs", hyperarcs);
|
PrintIndices("Hyperarcs", this->Hyperarcs);
|
||||||
PrintHeader(augmentnodes.GetNumberOfValues());
|
PrintHeader(augmentnodes.GetNumberOfValues());
|
||||||
PrintIndices("Augmentnodes", augmentnodes);
|
PrintIndices("Augmentnodes", augmentnodes);
|
||||||
PrintIndices("Augmentarcs", augmentarcs);
|
PrintIndices("Augmentarcs", augmentarcs);
|
||||||
@ -249,14 +249,14 @@ void ContourTree::PrintDotSuperStructure()
|
|||||||
printf("\tsize=\"6.5, 9\"\n\tratio=\"fill\"\n");
|
printf("\tsize=\"6.5, 9\"\n\tratio=\"fill\"\n");
|
||||||
|
|
||||||
auto whenTransferredPortal = whenTransferred.GetPortalConstControl();
|
auto whenTransferredPortal = whenTransferred.GetPortalConstControl();
|
||||||
auto supernodesPortal = supernodes.GetPortalConstControl();
|
auto supernodesPortal = this->Supernodes.GetPortalConstControl();
|
||||||
auto superarcsPortal = superarcs.GetPortalConstControl();
|
auto superarcsPortal = this->Superarcs.GetPortalConstControl();
|
||||||
auto hypernodesPortal = hypernodes.GetPortalConstControl();
|
auto hypernodesPortal = this->Hypernodes.GetPortalConstControl();
|
||||||
auto hyperparentsPortal = hyperparents.GetPortalConstControl();
|
auto hyperparentsPortal = this->Hyperparents.GetPortalConstControl();
|
||||||
auto hyperarcsPortal = hyperarcs.GetPortalConstControl();
|
auto hyperarcsPortal = this->Hyperarcs.GetPortalConstControl();
|
||||||
|
|
||||||
// colour the nodes by the iteration they transfer (mod # of colors) - paired iterations have similar colors RGBCMY
|
// 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
|
{ // per supernode
|
||||||
vtkm::Id iteration = MaskedIndex(whenTransferredPortal.Get(supernode));
|
vtkm::Id iteration = MaskedIndex(whenTransferredPortal.Get(supernode));
|
||||||
printf("\tnode s%lli [style=filled,fillcolor=%s]\n",
|
printf("\tnode s%lli [style=filled,fillcolor=%s]\n",
|
||||||
@ -265,7 +265,7 @@ void ContourTree::PrintDotSuperStructure()
|
|||||||
} // per supernode
|
} // per supernode
|
||||||
|
|
||||||
// loop through supernodes
|
// loop through supernodes
|
||||||
for (vtkm::Id supernode = 0; supernode < supernodes.GetNumberOfValues(); supernode++)
|
for (vtkm::Id supernode = 0; supernode < this->Supernodes.GetNumberOfValues(); supernode++)
|
||||||
{ // per supernode
|
{ // per supernode
|
||||||
// skip the global root
|
// skip the global root
|
||||||
if (NoSuchElement(superarcsPortal.Get(supernode)))
|
if (NoSuchElement(superarcsPortal.Get(supernode)))
|
||||||
@ -284,7 +284,7 @@ void ContourTree::PrintDotSuperStructure()
|
|||||||
} // per supernode
|
} // per supernode
|
||||||
|
|
||||||
// now loop through hypernodes to show hyperarcs
|
// 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
|
{ // per hypernode
|
||||||
// skip the global root
|
// skip the global root
|
||||||
if (NoSuchElement(hyperarcsPortal.Get(hypernode)))
|
if (NoSuchElement(hyperarcsPortal.Get(hypernode)))
|
||||||
@ -298,7 +298,7 @@ void ContourTree::PrintDotSuperStructure()
|
|||||||
} // per hypernode
|
} // per hypernode
|
||||||
|
|
||||||
// now add the hyperparents
|
// 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
|
{ // per supernode
|
||||||
printf(
|
printf(
|
||||||
"\ts%lli -> s%lli [constraint=false][style=dotted]\n",
|
"\ts%lli -> s%lli [constraint=false][style=dotted]\n",
|
||||||
@ -307,11 +307,11 @@ void ContourTree::PrintDotSuperStructure()
|
|||||||
} // per supernode
|
} // per supernode
|
||||||
|
|
||||||
// now use the hyperstructure to define subgraphs
|
// 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
|
{ // per hypernode
|
||||||
vtkm::Id firstChild = hypernodesPortal.Get(hypernode);
|
vtkm::Id firstChild = hypernodesPortal.Get(hypernode);
|
||||||
vtkm::Id childSentinel = (hypernode == hypernodes.GetNumberOfValues() - 1)
|
vtkm::Id childSentinel = (hypernode == this->Hypernodes.GetNumberOfValues() - 1)
|
||||||
? supernodes.GetNumberOfValues()
|
? this->Supernodes.GetNumberOfValues()
|
||||||
: hypernodesPortal.Get(hypernode + 1);
|
: hypernodesPortal.Get(hypernode + 1);
|
||||||
printf("\tsubgraph H%lli{ ", (vtkm::Int64)hypernode);
|
printf("\tsubgraph H%lli{ ", (vtkm::Int64)hypernode);
|
||||||
for (vtkm::Id supernode = firstChild; supernode < childSentinel; supernode++)
|
for (vtkm::Id supernode = firstChild; supernode < childSentinel; supernode++)
|
||||||
|
@ -223,56 +223,56 @@ void ContourTreeMaker::ComputeHyperAndSuperStructure()
|
|||||||
if (activeSupernodes.GetNumberOfValues() == 1)
|
if (activeSupernodes.GetNumberOfValues() == 1)
|
||||||
{ // meet at a vertex
|
{ // meet at a vertex
|
||||||
vtkm::Id superID = activeSupernodes.GetPortalControl().Get(0);
|
vtkm::Id superID = activeSupernodes.GetPortalControl().Get(0);
|
||||||
contourTree.superarcs.GetPortalControl().Set(superID, (vtkm::Id)NO_SUCH_ELEMENT);
|
contourTree.Superarcs.GetPortalControl().Set(superID, (vtkm::Id)NO_SUCH_ELEMENT);
|
||||||
contourTree.hyperarcs.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.Hyperparents.GetPortalControl().Set(superID, superID);
|
||||||
contourTree.whenTransferred.GetPortalControl().Set(superID, nIterations | IS_HYPERNODE);
|
contourTree.whenTransferred.GetPortalControl().Set(superID, nIterations | IS_HYPERNODE);
|
||||||
} // meet at a vertex
|
} // meet at a vertex
|
||||||
DebugPrint("Contour Tree Constructed. Now Swizzling", __FILE__, __LINE__);
|
DebugPrint("Contour Tree Constructed. Now Swizzling", __FILE__, __LINE__);
|
||||||
|
|
||||||
|
|
||||||
// next, we have to set up the hyper and super structure arrays one at a time
|
// 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.
|
// but we will want to move supernodes around.
|
||||||
// the first step is therefore to find the new order of supernodes by sorting
|
// 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
|
// we will use the hypernodes array for this, as we will want a copy to end up there
|
||||||
vtkm::cont::ArrayHandleIndex initContourTreeHypernodes(
|
vtkm::cont::ArrayHandleIndex initContourTreeHypernodes(
|
||||||
contourTree.supernodes
|
contourTree.Supernodes
|
||||||
.GetNumberOfValues()); // create linear sequence of numbers 0, 1, .. nSupernodes
|
.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
|
// now we sort hypernodes array with a comparator
|
||||||
vtkm::cont::Algorithm::Sort(
|
vtkm::cont::Algorithm::Sort(
|
||||||
contourTree.hypernodes,
|
contourTree.Hypernodes,
|
||||||
contourtree_maker_inc_ns::ContourTreeSuperNodeComparator(
|
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
|
// we have to permute a bunch of arrays, so let's have some temporaries to store them
|
||||||
IdArrayType permutedHyperparents;
|
IdArrayType permutedHyperparents;
|
||||||
PermuteArray<vtkm::Id>(contourTree.hyperparents, contourTree.hypernodes, permutedHyperparents);
|
PermuteArray<vtkm::Id>(contourTree.Hyperparents, contourTree.Hypernodes, permutedHyperparents);
|
||||||
IdArrayType permutedSupernodes;
|
IdArrayType permutedSupernodes;
|
||||||
PermuteArray<vtkm::Id>(contourTree.supernodes, contourTree.hypernodes, permutedSupernodes);
|
PermuteArray<vtkm::Id>(contourTree.Supernodes, contourTree.Hypernodes, permutedSupernodes);
|
||||||
IdArrayType permutedSuperarcs;
|
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
|
// now we establish the reverse index array
|
||||||
IdArrayType superSortIndex;
|
IdArrayType superSortIndex;
|
||||||
superSortIndex.Allocate(contourTree.supernodes.GetNumberOfValues());
|
superSortIndex.Allocate(contourTree.Supernodes.GetNumberOfValues());
|
||||||
// The following copy is equivalent to
|
// The following copy is equivalent to
|
||||||
// for (vtkm::Id supernode = 0; supernode < contourTree.supernodes.size(); supernode++)
|
// for (vtkm::Id supernode = 0; supernode < contourTree.Supernodes.size(); supernode++)
|
||||||
// superSortIndex[contourTree.hypernodes[supernode]] = supernode;
|
// superSortIndex[contourTree.Hypernodes[supernode]] = supernode;
|
||||||
|
|
||||||
//typedef vtkm::cont::ArrayHandlePermutation<IdArrayType, vtkm::cont::ArrayHandleIndex> PermuteArrayHandleIndex;
|
//typedef vtkm::cont::ArrayHandlePermutation<IdArrayType, vtkm::cont::ArrayHandleIndex> PermuteArrayHandleIndex;
|
||||||
vtkm::cont::ArrayHandlePermutation<IdArrayType, IdArrayType> permutedSuperSortIndex(
|
vtkm::cont::ArrayHandlePermutation<IdArrayType, IdArrayType> permutedSuperSortIndex(
|
||||||
contourTree.hypernodes, // index array
|
contourTree.Hypernodes, // index array
|
||||||
superSortIndex); // value array
|
superSortIndex); // value array
|
||||||
vtkm::cont::Algorithm::Copy(
|
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
|
permutedSuperSortIndex); // target array
|
||||||
|
|
||||||
// we then copy the supernodes & hyperparents back to the main array
|
// we then copy the supernodes & hyperparents back to the main array
|
||||||
vtkm::cont::Algorithm::Copy(permutedSupernodes, contourTree.supernodes);
|
vtkm::cont::Algorithm::Copy(permutedSupernodes, contourTree.Supernodes);
|
||||||
vtkm::cont::Algorithm::Copy(permutedHyperparents, contourTree.hyperparents);
|
vtkm::cont::Algorithm::Copy(permutedHyperparents, contourTree.Hyperparents);
|
||||||
|
|
||||||
|
|
||||||
// we need an extra permutation to get the superarcs correct
|
// we need an extra permutation to get the superarcs correct
|
||||||
@ -280,28 +280,28 @@ void ContourTreeMaker::ComputeHyperAndSuperStructure()
|
|||||||
this->Invoke(permuteSuperarcsWorklet,
|
this->Invoke(permuteSuperarcsWorklet,
|
||||||
permutedSuperarcs, // (input)
|
permutedSuperarcs, // (input)
|
||||||
superSortIndex, // (input)
|
superSortIndex, // (input)
|
||||||
contourTree.superarcs); // (output)
|
contourTree.Superarcs); // (output)
|
||||||
|
|
||||||
// PrintIndices("Sorted", contourTree.hypernodes);
|
// PrintIndices("Sorted", contourTree.Hypernodes);
|
||||||
// PrintIndices("Hyperparents", contourTree.hyperparents);
|
// PrintIndices("Hyperparents", contourTree.Hyperparents);
|
||||||
// PrintIndices("Supernodes", contourTree.supernodes);
|
// PrintIndices("Supernodes", contourTree.Supernodes);
|
||||||
// PrintIndices("Superarcs", contourTree.superarcs);
|
// PrintIndices("Superarcs", contourTree.Superarcs);
|
||||||
// PrintIndices("Perm Superarcs", permutedSuperarcs);
|
// PrintIndices("Perm Superarcs", permutedSuperarcs);
|
||||||
// PrintIndices("SuperSortIndex", superSortIndex);
|
// PrintIndices("SuperSortIndex", superSortIndex);
|
||||||
|
|
||||||
// we will permute the hyperarcs & copy them back with the new supernode target IDs
|
// we will permute the hyperarcs & copy them back with the new supernode target IDs
|
||||||
IdArrayType permutedHyperarcs;
|
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;
|
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
|
// now swizzle the whenTransferred value
|
||||||
IdArrayType permutedWhenTransferred;
|
IdArrayType permutedWhenTransferred;
|
||||||
PermuteArray<vtkm::Id>(
|
PermuteArray<vtkm::Id>(
|
||||||
contourTree.whenTransferred, contourTree.hypernodes, permutedWhenTransferred);
|
contourTree.whenTransferred, contourTree.Hypernodes, permutedWhenTransferred);
|
||||||
vtkm::cont::Algorithm::Copy(permutedWhenTransferred, contourTree.whenTransferred);
|
vtkm::cont::Algorithm::Copy(permutedWhenTransferred, contourTree.whenTransferred);
|
||||||
|
|
||||||
// now we compress both the hypernodes & hyperarcs
|
// now we compress both the hypernodes & Hyperarcs
|
||||||
IdArrayType newHypernodePosition;
|
IdArrayType newHypernodePosition;
|
||||||
OnefIfHypernode oneIfHypernodeFunctor;
|
OnefIfHypernode oneIfHypernodeFunctor;
|
||||||
auto oneIfHypernodeArrayHandle = vtkm::cont::ArrayHandleTransform<IdArrayType, OnefIfHypernode>(
|
auto oneIfHypernodeArrayHandle = vtkm::cont::ArrayHandleTransform<IdArrayType, OnefIfHypernode>(
|
||||||
@ -328,49 +328,49 @@ void ContourTreeMaker::ComputeHyperAndSuperStructure()
|
|||||||
contourtree_maker_inc_ns::ComputeHyperAndSuperStructure_SetNewHypernodesAndArcs
|
contourtree_maker_inc_ns::ComputeHyperAndSuperStructure_SetNewHypernodesAndArcs
|
||||||
setNewHypernodesAndArcsWorklet;
|
setNewHypernodesAndArcsWorklet;
|
||||||
this->Invoke(setNewHypernodesAndArcsWorklet,
|
this->Invoke(setNewHypernodesAndArcsWorklet,
|
||||||
contourTree.supernodes,
|
contourTree.Supernodes,
|
||||||
contourTree.whenTransferred,
|
contourTree.whenTransferred,
|
||||||
contourTree.hypernodes,
|
contourTree.Hypernodes,
|
||||||
contourTree.hyperarcs,
|
contourTree.Hyperarcs,
|
||||||
newHypernodePosition,
|
newHypernodePosition,
|
||||||
newHypernodes,
|
newHypernodes,
|
||||||
newHyperarcs);
|
newHyperarcs);
|
||||||
// swap in the new computed arrays.
|
// swap in the new computed arrays.
|
||||||
// vtkm ArrayHandles are smart so we can just swap the new data in here rather than copy
|
// 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(newHypernodes, contourTree.Hypernodes);
|
||||||
//vtkm::cont::Algorithm::Copy(newHyperarcs, contourTree.hyperarcs);
|
//vtkm::cont::Algorithm::Copy(newHyperarcs, contourTree.Hyperarcs);
|
||||||
contourTree.hypernodes.ReleaseResources();
|
contourTree.Hypernodes.ReleaseResources();
|
||||||
contourTree.hypernodes = newHypernodes;
|
contourTree.Hypernodes = newHypernodes;
|
||||||
contourTree.hyperarcs.ReleaseResources();
|
contourTree.Hyperarcs.ReleaseResources();
|
||||||
contourTree.hyperarcs = newHyperarcs;
|
contourTree.Hyperarcs = newHyperarcs;
|
||||||
|
|
||||||
|
|
||||||
// now reuse the superSortIndex array for hypernode IDs
|
// now reuse the superSortIndex array for hypernode IDs
|
||||||
// The following copy is equivalent to
|
// The following copy is equivalent to
|
||||||
// for (vtkm::Id hypernode = 0; hypernode < contourTree.hypernodes.size(); hypernode++)
|
// for (vtkm::Id hypernode = 0; hypernode < contourTree.Hypernodes.size(); hypernode++)
|
||||||
// superSortIndex[contourTree.hypernodes[hypernode]] = hypernode;
|
// superSortIndex[contourTree.Hypernodes[hypernode]] = hypernode;
|
||||||
// source data array is a simple linear index from 0 to #hypernodes
|
// source data array is a simple linear index from 0 to #Hypernodes
|
||||||
vtkm::cont::ArrayHandleIndex tempHypernodeIndexArray(contourTree.hypernodes.GetNumberOfValues());
|
vtkm::cont::ArrayHandleIndex tempHypernodeIndexArray(contourTree.Hypernodes.GetNumberOfValues());
|
||||||
// target data array for the copy operation is superSortIndex permuted by contourTree.hypernodes
|
// target data array for the copy operation is superSortIndex permuted by contourTree.Hypernodes
|
||||||
permutedSuperSortIndex = vtkm::cont::ArrayHandlePermutation<IdArrayType, IdArrayType>(
|
permutedSuperSortIndex = vtkm::cont::ArrayHandlePermutation<IdArrayType, IdArrayType>(
|
||||||
contourTree.hypernodes, superSortIndex);
|
contourTree.Hypernodes, superSortIndex);
|
||||||
vtkm::cont::Algorithm::Copy(tempHypernodeIndexArray, permutedSuperSortIndex);
|
vtkm::cont::Algorithm::Copy(tempHypernodeIndexArray, permutedSuperSortIndex);
|
||||||
|
|
||||||
// loop through the hyperparents array, setting the first one for each
|
// loop through the hyperparents array, setting the first one for each
|
||||||
contourtree_maker_inc_ns::ComputeHyperAndSuperStructure_HypernodesSetFirstSuperchild
|
contourtree_maker_inc_ns::ComputeHyperAndSuperStructure_HypernodesSetFirstSuperchild
|
||||||
hypernodesSetFirstSuperchildWorklet;
|
hypernodesSetFirstSuperchildWorklet;
|
||||||
this->Invoke(hypernodesSetFirstSuperchildWorklet,
|
this->Invoke(hypernodesSetFirstSuperchildWorklet,
|
||||||
contourTree.hyperparents,
|
contourTree.Hyperparents,
|
||||||
superSortIndex,
|
superSortIndex,
|
||||||
contourTree.hypernodes);
|
contourTree.Hypernodes);
|
||||||
|
|
||||||
// do a separate loop to reset the hyperparent's ID
|
// do a separate loop to reset the hyperparent's ID
|
||||||
// This does the following
|
// This does the following
|
||||||
// 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])];
|
// contourTree.Hyperparents[supernode] = superSortIndex[MaskedIndex(contourTree.Hyperparents[supernode])];
|
||||||
contourtree_maker_inc_ns::ComputeHyperAndSuperStructure_ResetHyperparentsId
|
contourtree_maker_inc_ns::ComputeHyperAndSuperStructure_ResetHyperparentsId
|
||||||
resetHyperparentsIdWorklet;
|
resetHyperparentsIdWorklet;
|
||||||
this->Invoke(resetHyperparentsIdWorklet, superSortIndex, contourTree.hyperparents);
|
this->Invoke(resetHyperparentsIdWorklet, superSortIndex, contourTree.Hyperparents);
|
||||||
|
|
||||||
DebugPrint("Contour Tree Super Structure Constructed", __FILE__, __LINE__);
|
DebugPrint("Contour Tree Super Structure Constructed", __FILE__, __LINE__);
|
||||||
} // ComputeHyperAndSuperStructure()
|
} // ComputeHyperAndSuperStructure()
|
||||||
@ -381,45 +381,45 @@ void ContourTreeMaker::ComputeRegularStructure(MeshExtrema& meshExtrema)
|
|||||||
{ // ComputeRegularStructure()
|
{ // ComputeRegularStructure()
|
||||||
// First step - use the superstructure to set the superparent for all supernodes
|
// First step - use the superstructure to set the superparent for all supernodes
|
||||||
auto supernodesIndex = vtkm::cont::ArrayHandleIndex(
|
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(
|
auto permutedSuperparents = vtkm::cont::make_ArrayHandlePermutation(
|
||||||
contourTree.supernodes,
|
contourTree.Supernodes,
|
||||||
contourTree.superparents); // superparents array permmuted by the supernodes array
|
contourTree.Superparents); // superparents array permmuted by the supernodes array
|
||||||
vtkm::cont::Algorithm::Copy(supernodesIndex, permutedSuperparents);
|
vtkm::cont::Algorithm::Copy(supernodesIndex, permutedSuperparents);
|
||||||
// The above copy is equivlant to
|
// The above copy is equivlant to
|
||||||
// for (indexType supernode = 0; supernode < contourTree.supernodes.size(); supernode++)
|
// 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
|
// Second step - for all remaining (regular) nodes, locate the superarc to which they belong
|
||||||
contourtree_maker_inc_ns::ComputeRegularStructure_LocateSuperarcs locateSuperarcsWorklet(
|
contourtree_maker_inc_ns::ComputeRegularStructure_LocateSuperarcs locateSuperarcsWorklet(
|
||||||
contourTree.hypernodes.GetNumberOfValues(), contourTree.supernodes.GetNumberOfValues());
|
contourTree.Hypernodes.GetNumberOfValues(), contourTree.Supernodes.GetNumberOfValues());
|
||||||
this->Invoke(locateSuperarcsWorklet,
|
this->Invoke(locateSuperarcsWorklet,
|
||||||
contourTree.superparents, // (input/output)
|
contourTree.Superparents, // (input/output)
|
||||||
contourTree.whenTransferred, // (input)
|
contourTree.whenTransferred, // (input)
|
||||||
contourTree.hyperparents, // (input)
|
contourTree.Hyperparents, // (input)
|
||||||
contourTree.hyperarcs, // (input)
|
contourTree.Hyperarcs, // (input)
|
||||||
contourTree.hypernodes, // (input)
|
contourTree.Hypernodes, // (input)
|
||||||
contourTree.supernodes, // (input)
|
contourTree.Supernodes, // (input)
|
||||||
meshExtrema.Peaks, // (input)
|
meshExtrema.Peaks, // (input)
|
||||||
meshExtrema.Pits); // (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
|
// 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);
|
contourTree.nodes);
|
||||||
|
|
||||||
vtkm::cont::Algorithm::Sort(contourTree.nodes,
|
vtkm::cont::Algorithm::Sort(contourTree.nodes,
|
||||||
contourtree_maker_inc_ns::ContourTreeNodeComparator(
|
contourtree_maker_inc_ns::ContourTreeNodeComparator(
|
||||||
contourTree.superparents, contourTree.superarcs));
|
contourTree.Superparents, contourTree.Superarcs));
|
||||||
|
|
||||||
// now set the arcs based on the array
|
// now set the arcs based on the array
|
||||||
contourtree_maker_inc_ns::ComputeRegularStructure_SetArcs setArcsWorklet(
|
contourtree_maker_inc_ns::ComputeRegularStructure_SetArcs setArcsWorklet(
|
||||||
contourTree.arcs.GetNumberOfValues());
|
contourTree.Arcs.GetNumberOfValues());
|
||||||
this->Invoke(setArcsWorklet,
|
this->Invoke(setArcsWorklet,
|
||||||
contourTree.nodes, // (input) arcSorter array
|
contourTree.nodes, // (input) arcSorter array
|
||||||
contourTree.superparents, // (input)
|
contourTree.Superparents, // (input)
|
||||||
contourTree.superarcs, // (input)
|
contourTree.Superarcs, // (input)
|
||||||
contourTree.supernodes, // (input)
|
contourTree.Supernodes, // (input)
|
||||||
contourTree.arcs); // (output)
|
contourTree.Arcs); // (output)
|
||||||
|
|
||||||
DebugPrint("Regular Structure Computed", __FILE__, __LINE__);
|
DebugPrint("Regular Structure Computed", __FILE__, __LINE__);
|
||||||
} // ComputeRegularStructure()
|
} // ComputeRegularStructure()
|
||||||
@ -448,28 +448,28 @@ void ContourTreeMaker::ComputeBoundaryRegularStructure(
|
|||||||
const MeshBoundaryExecObj& meshBoundaryExecObj)
|
const MeshBoundaryExecObj& meshBoundaryExecObj)
|
||||||
{ // ComputeRegularStructure()
|
{ // ComputeRegularStructure()
|
||||||
// First step - use the superstructure to set the superparent for all supernodes
|
// 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;
|
IdArrayType superparents;
|
||||||
InitIdArrayTypeNoSuchElement(superparents, mesh.GetNumberOfVertices());
|
InitIdArrayTypeNoSuchElement(superparents, mesh.GetNumberOfVertices());
|
||||||
// superparents array permmuted by the supernodes array
|
// superparents array permmuted by the supernodes array
|
||||||
auto permutedSuperparents =
|
auto permutedSuperparents =
|
||||||
vtkm::cont::make_ArrayHandlePermutation(contourTree.supernodes, superparents);
|
vtkm::cont::make_ArrayHandlePermutation(contourTree.Supernodes, superparents);
|
||||||
vtkm::cont::Algorithm::Copy(supernodesIndex, permutedSuperparents);
|
vtkm::cont::Algorithm::Copy(supernodesIndex, permutedSuperparents);
|
||||||
// The above copy is equivlant to
|
// The above copy is equivlant to
|
||||||
// for (indexType supernode = 0; supernode < contourTree.supernodes.size(); supernode++)
|
// for (indexType supernode = 0; supernode < contourTree.Supernodes.size(); supernode++)
|
||||||
// superparents[contourTree.supernodes[supernode]] = supernode;
|
// superparents[contourTree.Supernodes[supernode]] = supernode;
|
||||||
|
|
||||||
// Second step - for all remaining (regular) nodes, locate the superarc to which they belong
|
// Second step - for all remaining (regular) nodes, locate the superarc to which they belong
|
||||||
contourtree_maker_inc_ns::ComputeRegularStructure_LocateSuperarcsOnBoundary
|
contourtree_maker_inc_ns::ComputeRegularStructure_LocateSuperarcsOnBoundary
|
||||||
locateSuperarcsOnBoundaryWorklet(contourTree.hypernodes.GetNumberOfValues(),
|
locateSuperarcsOnBoundaryWorklet(contourTree.Hypernodes.GetNumberOfValues(),
|
||||||
contourTree.supernodes.GetNumberOfValues());
|
contourTree.Supernodes.GetNumberOfValues());
|
||||||
this->Invoke(locateSuperarcsOnBoundaryWorklet,
|
this->Invoke(locateSuperarcsOnBoundaryWorklet,
|
||||||
superparents, // (input/output)
|
superparents, // (input/output)
|
||||||
contourTree.whenTransferred, // (input)
|
contourTree.whenTransferred, // (input)
|
||||||
contourTree.hyperparents, // (input)
|
contourTree.Hyperparents, // (input)
|
||||||
contourTree.hyperarcs, // (input)
|
contourTree.Hyperarcs, // (input)
|
||||||
contourTree.hypernodes, // (input)
|
contourTree.Hypernodes, // (input)
|
||||||
contourTree.supernodes, // (input)
|
contourTree.Supernodes, // (input)
|
||||||
meshExtrema.Peaks, // (input)
|
meshExtrema.Peaks, // (input)
|
||||||
meshExtrema.Pits, // (input)
|
meshExtrema.Pits, // (input)
|
||||||
meshBoundaryExecObj); // (input)
|
meshBoundaryExecObj); // (input)
|
||||||
@ -508,7 +508,7 @@ void ContourTreeMaker::ComputeBoundaryRegularStructure(
|
|||||||
// use a comparator to do the sort
|
// use a comparator to do the sort
|
||||||
vtkm::cont::Algorithm::Sort(
|
vtkm::cont::Algorithm::Sort(
|
||||||
augmentnodes_sorted,
|
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
|
// now set the arcs based on the array
|
||||||
InitIdArrayTypeNoSuchElement(contourTree.augmentarcs,
|
InitIdArrayTypeNoSuchElement(contourTree.augmentarcs,
|
||||||
contourTree.augmentnodes.GetNumberOfValues());
|
contourTree.augmentnodes.GetNumberOfValues());
|
||||||
@ -517,8 +517,8 @@ void ContourTreeMaker::ComputeBoundaryRegularStructure(
|
|||||||
this->Invoke(setAugmentArcsWorklet,
|
this->Invoke(setAugmentArcsWorklet,
|
||||||
augmentnodes_sorted, // (input) arcSorter array
|
augmentnodes_sorted, // (input) arcSorter array
|
||||||
superparents, // (input)
|
superparents, // (input)
|
||||||
contourTree.superarcs, // (input)
|
contourTree.Superarcs, // (input)
|
||||||
contourTree.supernodes, // (input)
|
contourTree.Supernodes, // (input)
|
||||||
toCompressed, // (input)
|
toCompressed, // (input)
|
||||||
contourTree.augmentarcs); // (output)
|
contourTree.augmentarcs); // (output)
|
||||||
DebugPrint("Regular Boundary Structure Computed", __FILE__, __LINE__);
|
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
|
// 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
|
// - the sum of the sizes of the trees or the total size of the data
|
||||||
vtkm::Id nJoinSupernodes = joinTree.supernodes.GetNumberOfValues();
|
vtkm::Id nJoinSupernodes = joinTree.Supernodes.GetNumberOfValues();
|
||||||
vtkm::Id nSplitSupernodes = splitTree.supernodes.GetNumberOfValues();
|
vtkm::Id nSplitSupernodes = splitTree.Supernodes.GetNumberOfValues();
|
||||||
vtkm::Id nSupernodes = nJoinSupernodes + nSplitSupernodes;
|
vtkm::Id nSupernodes = nJoinSupernodes + nSplitSupernodes;
|
||||||
if (nSupernodes > joinTree.arcs.GetNumberOfValues())
|
if (nSupernodes > joinTree.Arcs.GetNumberOfValues())
|
||||||
nSupernodes = joinTree.arcs.GetNumberOfValues();
|
nSupernodes = joinTree.Arcs.GetNumberOfValues();
|
||||||
contourTree.supernodes.Allocate(nSupernodes);
|
contourTree.Supernodes.Allocate(nSupernodes);
|
||||||
|
|
||||||
// 2. Make copies of the lists of join & split supernodes & sort them
|
// 2. Make copies of the lists of join & split supernodes & sort them
|
||||||
IdArrayType joinSort;
|
IdArrayType joinSort;
|
||||||
joinSort.Allocate(nJoinSupernodes);
|
joinSort.Allocate(nJoinSupernodes);
|
||||||
vtkm::cont::Algorithm::Copy(joinTree.supernodes, joinSort);
|
vtkm::cont::Algorithm::Copy(joinTree.Supernodes, joinSort);
|
||||||
vtkm::cont::Algorithm::Sort(joinSort);
|
vtkm::cont::Algorithm::Sort(joinSort);
|
||||||
IdArrayType splitSort;
|
IdArrayType splitSort;
|
||||||
splitSort.Allocate(nSplitSupernodes);
|
splitSort.Allocate(nSplitSupernodes);
|
||||||
vtkm::cont::Algorithm::Copy(splitTree.supernodes, splitSort);
|
vtkm::cont::Algorithm::Copy(splitTree.Supernodes, splitSort);
|
||||||
vtkm::cont::Algorithm::Sort(splitSort);
|
vtkm::cont::Algorithm::Sort(splitSort);
|
||||||
|
|
||||||
// 3. Use set_union to combine the lists
|
// 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()),
|
auto tail = std::set_union(vtkm::cont::ArrayPortalToIteratorBegin(joinSort.GetPortalControl()),
|
||||||
vtkm::cont::ArrayPortalToIteratorEnd(joinSort.GetPortalControl()),
|
vtkm::cont::ArrayPortalToIteratorEnd(joinSort.GetPortalControl()),
|
||||||
vtkm::cont::ArrayPortalToIteratorBegin(splitSort.GetPortalControl()),
|
vtkm::cont::ArrayPortalToIteratorBegin(splitSort.GetPortalControl()),
|
||||||
@ -570,27 +570,27 @@ void ContourTreeMaker::AugmentMergeTrees()
|
|||||||
splitSort.ReleaseResources();
|
splitSort.ReleaseResources();
|
||||||
|
|
||||||
// 4. Resize the supernode array accordingly
|
// 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
|
// 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
|
// - the sum of the sizes of the trees or the total size of the data
|
||||||
vtkm::Id nJoinSupernodes = joinTree.supernodes.GetNumberOfValues();
|
vtkm::Id nJoinSupernodes = joinTree.Supernodes.GetNumberOfValues();
|
||||||
vtkm::Id nSplitSupernodes = splitTree.supernodes.GetNumberOfValues();
|
vtkm::Id nSplitSupernodes = splitTree.Supernodes.GetNumberOfValues();
|
||||||
vtkm::Id nSupernodes = nJoinSupernodes + nSplitSupernodes;
|
vtkm::Id nSupernodes = nJoinSupernodes + nSplitSupernodes;
|
||||||
|
|
||||||
// TODO Check whether this replacement for Step 2 to 4 is a problem in terms of performance
|
// 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.
|
// 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(
|
vtkm::cont::Algorithm::CopySubRange(
|
||||||
joinTree.supernodes, 0, nJoinSupernodes, contourTree.supernodes, 0);
|
joinTree.Supernodes, 0, nJoinSupernodes, contourTree.Supernodes, 0);
|
||||||
vtkm::cont::Algorithm::CopySubRange(
|
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
|
// Need to sort before Unique because VTKM only guarantees to find neighboring duplicates
|
||||||
vtkm::cont::Algorithm::Sort(contourTree.supernodes);
|
vtkm::cont::Algorithm::Sort(contourTree.Supernodes);
|
||||||
vtkm::cont::Algorithm::Unique(contourTree.supernodes);
|
vtkm::cont::Algorithm::Unique(contourTree.Supernodes);
|
||||||
nSupernodes = contourTree.supernodes.GetNumberOfValues();
|
nSupernodes = contourTree.Supernodes.GetNumberOfValues();
|
||||||
|
|
||||||
// 5. Create lookup arrays for the join & split supernodes' new IDs
|
// 5. Create lookup arrays for the join & split supernodes' new IDs
|
||||||
IdArrayType newJoinID;
|
IdArrayType newJoinID;
|
||||||
@ -609,11 +609,11 @@ void ContourTreeMaker::AugmentMergeTrees()
|
|||||||
contourtree_maker_inc_ns::AugmentMergeTrees_InitNewJoinSplitIDAndSuperparents
|
contourtree_maker_inc_ns::AugmentMergeTrees_InitNewJoinSplitIDAndSuperparents
|
||||||
initNewJoinSplitIDAndSuperparentsWorklet;
|
initNewJoinSplitIDAndSuperparentsWorklet;
|
||||||
this->Invoke(initNewJoinSplitIDAndSuperparentsWorklet,
|
this->Invoke(initNewJoinSplitIDAndSuperparentsWorklet,
|
||||||
contourTree.supernodes, //input
|
contourTree.Supernodes, //input
|
||||||
joinTree.superparents, //input
|
joinTree.Superparents, //input
|
||||||
splitTree.superparents, //input
|
splitTree.Superparents, //input
|
||||||
joinTree.supernodes, //input
|
joinTree.Supernodes, //input
|
||||||
splitTree.supernodes, //input
|
splitTree.Supernodes, //input
|
||||||
joinSuperparents, //output
|
joinSuperparents, //output
|
||||||
splitSuperparents, //output
|
splitSuperparents, //output
|
||||||
newJoinID, //output
|
newJoinID, //output
|
||||||
@ -628,7 +628,7 @@ void ContourTreeMaker::AugmentMergeTrees()
|
|||||||
// the augmented superarcs. We start with the join superarcs
|
// the augmented superarcs. We start with the join superarcs
|
||||||
vtkm::cont::Algorithm::Sort(
|
vtkm::cont::Algorithm::Sort(
|
||||||
activeSupernodes,
|
activeSupernodes,
|
||||||
active_graph_inc_ns::SuperArcNodeComparator(joinSuperparents, joinTree.isJoinTree));
|
active_graph_inc_ns::SuperArcNodeComparator(joinSuperparents, joinTree.IsJoinTree));
|
||||||
|
|
||||||
// 9. Set the augmented join superarcs
|
// 9. Set the augmented join superarcs
|
||||||
augmentedJoinSuperarcs.Allocate(nSupernodes);
|
augmentedJoinSuperarcs.Allocate(nSupernodes);
|
||||||
@ -636,7 +636,7 @@ void ContourTreeMaker::AugmentMergeTrees()
|
|||||||
this->Invoke(setAugmentedJoinArcsWorklet,
|
this->Invoke(setAugmentedJoinArcsWorklet,
|
||||||
activeSupernodes, // (input domain)
|
activeSupernodes, // (input domain)
|
||||||
joinSuperparents, // (input)
|
joinSuperparents, // (input)
|
||||||
joinTree.superarcs, // (input)
|
joinTree.Superarcs, // (input)
|
||||||
newJoinID, // (input)
|
newJoinID, // (input)
|
||||||
augmentedJoinSuperarcs); // (output)
|
augmentedJoinSuperarcs); // (output)
|
||||||
|
|
||||||
@ -645,7 +645,7 @@ void ContourTreeMaker::AugmentMergeTrees()
|
|||||||
// now sort by the split superparent
|
// now sort by the split superparent
|
||||||
vtkm::cont::Algorithm::Sort(
|
vtkm::cont::Algorithm::Sort(
|
||||||
activeSupernodes,
|
activeSupernodes,
|
||||||
active_graph_inc_ns::SuperArcNodeComparator(splitSuperparents, splitTree.isJoinTree));
|
active_graph_inc_ns::SuperArcNodeComparator(splitSuperparents, splitTree.IsJoinTree));
|
||||||
|
|
||||||
// 11. Set the augmented split superarcs
|
// 11. Set the augmented split superarcs
|
||||||
augmentedSplitSuperarcs.Allocate(nSupernodes);
|
augmentedSplitSuperarcs.Allocate(nSupernodes);
|
||||||
@ -653,17 +653,17 @@ void ContourTreeMaker::AugmentMergeTrees()
|
|||||||
this->Invoke(setAugmentedSplitArcsWorklet,
|
this->Invoke(setAugmentedSplitArcsWorklet,
|
||||||
activeSupernodes, // (input domain)
|
activeSupernodes, // (input domain)
|
||||||
splitSuperparents, // (input)
|
splitSuperparents, // (input)
|
||||||
splitTree.superarcs, // (input)
|
splitTree.Superarcs, // (input)
|
||||||
newSplitID, // (input)
|
newSplitID, // (input)
|
||||||
augmentedSplitSuperarcs); // (output)
|
augmentedSplitSuperarcs); // (output)
|
||||||
|
|
||||||
// 12. Lastly, we can initialise all of the remaining arrays
|
// 12. Lastly, we can initialise all of the remaining arrays
|
||||||
vtkm::cont::ArrayHandleConstant<vtkm::Id> noSuchElementArray((vtkm::Id)NO_SUCH_ELEMENT,
|
vtkm::cont::ArrayHandleConstant<vtkm::Id> noSuchElementArray((vtkm::Id)NO_SUCH_ELEMENT,
|
||||||
nSupernodes);
|
nSupernodes);
|
||||||
vtkm::cont::Algorithm::Copy(noSuchElementArray, contourTree.superarcs);
|
vtkm::cont::Algorithm::Copy(noSuchElementArray, contourTree.Superarcs);
|
||||||
vtkm::cont::Algorithm::Copy(noSuchElementArray, contourTree.hyperparents);
|
vtkm::cont::Algorithm::Copy(noSuchElementArray, contourTree.Hyperparents);
|
||||||
vtkm::cont::Algorithm::Copy(noSuchElementArray, contourTree.hypernodes);
|
vtkm::cont::Algorithm::Copy(noSuchElementArray, contourTree.Hypernodes);
|
||||||
vtkm::cont::Algorithm::Copy(noSuchElementArray, contourTree.hyperarcs);
|
vtkm::cont::Algorithm::Copy(noSuchElementArray, contourTree.Hyperarcs);
|
||||||
vtkm::cont::Algorithm::Copy(noSuchElementArray, contourTree.whenTransferred);
|
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
|
// 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.
|
// TODO below we initialize the outbound and inbound arrays with 0 to ensure consistency of debug output. Check if this is needed.
|
||||||
IdArrayType outbound;
|
IdArrayType outbound;
|
||||||
vtkm::cont::Algorithm::Copy(
|
vtkm::cont::Algorithm::Copy(
|
||||||
vtkm::cont::ArrayHandleConstant<vtkm::Id>(0, contourTree.supernodes.GetNumberOfValues()),
|
vtkm::cont::ArrayHandleConstant<vtkm::Id>(0, contourTree.Supernodes.GetNumberOfValues()),
|
||||||
outbound);
|
outbound);
|
||||||
//outbound.Allocate(contourTree.supernodes.GetNumberOfValues());
|
//outbound.Allocate(contourTree.Supernodes.GetNumberOfValues());
|
||||||
IdArrayType inbound;
|
IdArrayType inbound;
|
||||||
//inbound.Allocate(contourTree.supernodes.GetNumberOfValues());
|
//inbound.Allocate(contourTree.Supernodes.GetNumberOfValues());
|
||||||
vtkm::cont::Algorithm::Copy(
|
vtkm::cont::Algorithm::Copy(
|
||||||
vtkm::cont::ArrayHandleConstant<vtkm::Id>(0, contourTree.supernodes.GetNumberOfValues()),
|
vtkm::cont::ArrayHandleConstant<vtkm::Id>(0, contourTree.Supernodes.GetNumberOfValues()),
|
||||||
inbound);
|
inbound);
|
||||||
|
|
||||||
|
|
||||||
@ -812,9 +812,9 @@ void ContourTreeMaker::TransferLeafChains(bool isJoin)
|
|||||||
inwards); // (input)
|
inwards); // (input)
|
||||||
vtkm::cont::TryExecute(task,
|
vtkm::cont::TryExecute(task,
|
||||||
activeSupernodes, // (input)
|
activeSupernodes, // (input)
|
||||||
contourTree.hyperparents, // (output)
|
contourTree.Hyperparents, // (output)
|
||||||
contourTree.hyperarcs, // (output)
|
contourTree.Hyperarcs, // (output)
|
||||||
contourTree.superarcs, // (output)
|
contourTree.Superarcs, // (output)
|
||||||
contourTree.whenTransferred); // (output)
|
contourTree.whenTransferred); // (output)
|
||||||
|
|
||||||
DebugPrint(isJoin ? "Upper Regular Chains Transferred" : "Lower Regular Chains Transferred",
|
DebugPrint(isJoin ? "Upper Regular Chains Transferred" : "Lower Regular Chains Transferred",
|
||||||
@ -823,7 +823,7 @@ void ContourTreeMaker::TransferLeafChains(bool isJoin)
|
|||||||
} // ContourTreeMaker::TransferLeafChains()
|
} // 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()
|
void ContourTreeMaker::CompressTrees()
|
||||||
{ // ContourTreeMaker::CompressTrees()
|
{ // ContourTreeMaker::CompressTrees()
|
||||||
|
|
||||||
@ -840,7 +840,7 @@ void ContourTreeMaker::CompressTrees()
|
|||||||
contourtree_maker_inc_ns::CompressTrees_Step compressTreesStepWorklet;
|
contourtree_maker_inc_ns::CompressTrees_Step compressTreesStepWorklet;
|
||||||
this->Invoke(compressTreesStepWorklet,
|
this->Invoke(compressTreesStepWorklet,
|
||||||
activeSupernodes, // (input)
|
activeSupernodes, // (input)
|
||||||
contourTree.superarcs, // (input)
|
contourTree.Superarcs, // (input)
|
||||||
augmentedJoinSuperarcs, // (input/output)
|
augmentedJoinSuperarcs, // (input/output)
|
||||||
augmentedSplitSuperarcs // (input/output)
|
augmentedSplitSuperarcs // (input/output)
|
||||||
);
|
);
|
||||||
|
@ -78,49 +78,49 @@ class MergeTree
|
|||||||
{ // class MergeTree
|
{ // class MergeTree
|
||||||
public:
|
public:
|
||||||
// whether it is join or split tree
|
// whether it is join or split tree
|
||||||
bool isJoinTree;
|
bool IsJoinTree;
|
||||||
|
|
||||||
// VECTORS INDEXED ON N = SIZE OF DATA
|
// VECTORS INDEXED ON N = SIZE OF DATA
|
||||||
|
|
||||||
// the list of nodes is implicit
|
// the list of nodes is implicit
|
||||||
|
|
||||||
// vector of (regular) arcs in the merge tree
|
// vector of (regular) arcs in the merge tree
|
||||||
IdArrayType arcs;
|
IdArrayType Arcs;
|
||||||
|
|
||||||
// vector storing which superarc owns each node
|
// vector storing which superarc owns each node
|
||||||
IdArrayType superparents;
|
IdArrayType Superparents;
|
||||||
|
|
||||||
// VECTORS INDEXED ON T = SIZE OF TREE
|
// VECTORS INDEXED ON T = SIZE OF TREE
|
||||||
|
|
||||||
// vector storing the list of supernodes by ID
|
// vector storing the list of supernodes by ID
|
||||||
// WARNING: THESE ARE NOT SORTED BY INDEX
|
// WARNING: THESE ARE NOT SORTED BY INDEX
|
||||||
// Instead, they are sorted by hyperarc, secondarily on index
|
// Instead, they are sorted by hyperarc, secondarily on index
|
||||||
IdArrayType supernodes;
|
IdArrayType Supernodes;
|
||||||
|
|
||||||
// vector of superarcs in the merge tree
|
// vector of superarcs in the merge tree
|
||||||
// stored as supernode indices
|
// stored as supernode indices
|
||||||
IdArrayType superarcs;
|
IdArrayType Superarcs;
|
||||||
|
|
||||||
// vector of hyperarcs to which each supernode/arc belongs
|
// vector of Hyperarcs to which each supernode/arc belongs
|
||||||
IdArrayType hyperparents;
|
IdArrayType Hyperparents;
|
||||||
|
|
||||||
// VECTORS INDEXED ON H = SIZE OF HYPERTREE
|
// VECTORS INDEXED ON H = SIZE OF HYPERTREE
|
||||||
|
|
||||||
// vector of sort indices for the hypernodes
|
// 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
|
// NOTE: These are supernode IDs, not hypernode IDs
|
||||||
// because not all hyperarcs lead to hypernodes
|
// because not all Hyperarcs lead to hypernodes
|
||||||
IdArrayType hyperarcs;
|
IdArrayType Hyperarcs;
|
||||||
|
|
||||||
// vector to find the first child superarc
|
// vector to find the first child superarc
|
||||||
IdArrayType firstSuperchild;
|
IdArrayType FirstSuperchild;
|
||||||
|
|
||||||
// ROUTINES
|
// ROUTINES
|
||||||
|
|
||||||
// creates merge tree (empty)
|
// creates merge tree (empty)
|
||||||
MergeTree(vtkm::Id meshSize, bool IsJoinTree);
|
MergeTree(vtkm::Id meshSize, bool isJoinTree);
|
||||||
|
|
||||||
// debug routine
|
// debug routine
|
||||||
void DebugPrint(const char* message, const char* fileName, long lineNum);
|
void DebugPrint(const char* message, const char* fileName, long lineNum);
|
||||||
@ -143,23 +143,23 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
// creates merge tree (empty)
|
// creates merge tree (empty)
|
||||||
inline MergeTree::MergeTree(vtkm::Id meshSize, bool IsJoinTree)
|
inline MergeTree::MergeTree(vtkm::Id meshSize, bool isJoinTree)
|
||||||
: isJoinTree(IsJoinTree)
|
: IsJoinTree(isJoinTree)
|
||||||
, supernodes()
|
, Supernodes()
|
||||||
, superarcs()
|
, Superarcs()
|
||||||
, hyperparents()
|
, Hyperparents()
|
||||||
, hypernodes()
|
, Hypernodes()
|
||||||
, hyperarcs()
|
, Hyperarcs()
|
||||||
, firstSuperchild()
|
, FirstSuperchild()
|
||||||
{ // MergeTree()
|
{ // MergeTree()
|
||||||
// Allocate the arcs array
|
// Allocate the arcs array
|
||||||
// TODO it should be sufficient to just allocate arcs without initializing it with 0s
|
// TODO it should be sufficient to just allocate arcs without initializing it with 0s
|
||||||
vtkm::cont::ArrayHandleConstant<vtkm::Id> meshSizeNullArray(0, meshSize);
|
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
|
// Initialize the superparents with NO_SUCH_ELEMENT
|
||||||
vtkm::cont::ArrayHandleConstant<vtkm::Id> noSuchElementArray((vtkm::Id)NO_SUCH_ELEMENT, meshSize);
|
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()
|
} // MergeTree()
|
||||||
|
|
||||||
@ -176,19 +176,19 @@ inline void MergeTree::DebugPrint(const char* message, const char* fileName, lon
|
|||||||
std::cout << "---------------------------" << std::endl;
|
std::cout << "---------------------------" << std::endl;
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
PrintHeader(arcs.GetNumberOfValues());
|
PrintHeader(this->Arcs.GetNumberOfValues());
|
||||||
PrintIndices("Arcs", arcs);
|
PrintIndices("Arcs", this->Arcs);
|
||||||
PrintIndices("Superparents", superparents);
|
PrintIndices("Superparents", this->Superparents);
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
PrintHeader(supernodes.GetNumberOfValues());
|
PrintHeader(this->Supernodes.GetNumberOfValues());
|
||||||
PrintIndices("Supernodes", supernodes);
|
PrintIndices("Supernodes", this->Supernodes);
|
||||||
PrintIndices("Superarcs", superarcs);
|
PrintIndices("Superarcs", this->Superarcs);
|
||||||
PrintIndices("Hyperparents", hyperparents);
|
PrintIndices("Hyperparents", this->Hyperparents);
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
PrintHeader(hypernodes.GetNumberOfValues());
|
PrintHeader(this->Hypernodes.GetNumberOfValues());
|
||||||
PrintIndices("Hypernodes", hypernodes);
|
PrintIndices("Hypernodes", this->Hypernodes);
|
||||||
PrintIndices("Hyperarcs", hyperarcs);
|
PrintIndices("Hyperarcs", this->Hyperarcs);
|
||||||
PrintIndices("First Superchild", firstSuperchild);
|
PrintIndices("First Superchild", FirstSuperchild);
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
#else
|
#else
|
||||||
// Prevent unused parameter warning
|
// 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)
|
std::cout << std::setw(30) << std::left << fileName << ":" << std::right << std::setw(4)
|
||||||
<< lineNum << std::endl;
|
<< lineNum << std::endl;
|
||||||
std::cout << std::left << std::string(message) << std::endl;
|
std::cout << std::left << std::string(message) << std::endl;
|
||||||
if (isJoinTree)
|
if (this->IsJoinTree)
|
||||||
{
|
{
|
||||||
std::cout << "Join Tree:" << std::endl;
|
std::cout << "Join Tree:" << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -115,10 +115,10 @@ public:
|
|||||||
std::vector<EdgePair> arcSorter;
|
std::vector<EdgePair> arcSorter;
|
||||||
|
|
||||||
// fill it up
|
// fill it up
|
||||||
auto arcsPortal = contourTree.arcs.GetPortalConstControl();
|
auto arcsPortal = contourTree.Arcs.GetPortalConstControl();
|
||||||
auto sortOrderPortal = sortOrder.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
|
{ // per node
|
||||||
// retrieve ID of target supernode
|
// retrieve ID of target supernode
|
||||||
vtkm::Id arcTo = arcsPortal.Get(node);
|
vtkm::Id arcTo = arcsPortal.Get(node);
|
||||||
@ -160,11 +160,11 @@ public:
|
|||||||
std::vector<EdgePair> superarcSorter;
|
std::vector<EdgePair> superarcSorter;
|
||||||
|
|
||||||
// fill it up
|
// fill it up
|
||||||
auto supernodesPortal = contourTree.supernodes.GetPortalConstControl();
|
auto supernodesPortal = contourTree.Supernodes.GetPortalConstControl();
|
||||||
auto superarcsPortal = contourTree.superarcs.GetPortalConstControl();
|
auto superarcsPortal = contourTree.Superarcs.GetPortalConstControl();
|
||||||
auto sortOrderPortal = sortOrder.GetPortalConstControl();
|
auto sortOrderPortal = sortOrder.GetPortalConstControl();
|
||||||
|
|
||||||
for (vtkm::Id supernode = 0; supernode < contourTree.supernodes.GetNumberOfValues();
|
for (vtkm::Id supernode = 0; supernode < contourTree.Supernodes.GetNumberOfValues();
|
||||||
supernode++)
|
supernode++)
|
||||||
{ // per supernode
|
{ // per supernode
|
||||||
// sort ID of the supernode
|
// sort ID of the supernode
|
||||||
@ -219,18 +219,18 @@ public:
|
|||||||
{ // ContourTreeMaker::ComputeWeights()
|
{ // ContourTreeMaker::ComputeWeights()
|
||||||
// start by storing the first sorted vertex ID for each superarc
|
// start by storing the first sorted vertex ID for each superarc
|
||||||
IdArrayType firstVertexForSuperparent;
|
IdArrayType firstVertexForSuperparent;
|
||||||
firstVertexForSuperparent.Allocate(contourTree.superarcs.GetNumberOfValues());
|
firstVertexForSuperparent.Allocate(contourTree.Superarcs.GetNumberOfValues());
|
||||||
superarcIntrinsicWeight.Allocate(contourTree.superarcs.GetNumberOfValues());
|
superarcIntrinsicWeight.Allocate(contourTree.Superarcs.GetNumberOfValues());
|
||||||
auto superarcIntrinsicWeightPortal = superarcIntrinsicWeight.GetPortalControl();
|
auto superarcIntrinsicWeightPortal = superarcIntrinsicWeight.GetPortalControl();
|
||||||
auto firstVertexForSuperparentPortal = firstVertexForSuperparent.GetPortalControl();
|
auto firstVertexForSuperparentPortal = firstVertexForSuperparent.GetPortalControl();
|
||||||
auto superparentsPortal = contourTree.superparents.GetPortalConstControl();
|
auto superparentsPortal = contourTree.Superparents.GetPortalConstControl();
|
||||||
auto hyperparentsPortal = contourTree.hyperparents.GetPortalConstControl();
|
auto hyperparentsPortal = contourTree.Hyperparents.GetPortalConstControl();
|
||||||
auto hypernodesPortal = contourTree.hypernodes.GetPortalConstControl();
|
auto hypernodesPortal = contourTree.Hypernodes.GetPortalConstControl();
|
||||||
auto hyperarcsPortal = contourTree.hyperarcs.GetPortalConstControl();
|
auto hyperarcsPortal = contourTree.Hyperarcs.GetPortalConstControl();
|
||||||
// auto superarcsPortal = contourTree.superarcs.GetPortalConstControl();
|
// auto superarcsPortal = contourTree.Superarcs.GetPortalConstControl();
|
||||||
auto nodesPortal = contourTree.nodes.GetPortalConstControl();
|
auto nodesPortal = contourTree.nodes.GetPortalConstControl();
|
||||||
auto whenTransferredPortal = contourTree.whenTransferred.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
|
{ // per node in sorted order
|
||||||
vtkm::Id sortID = nodesPortal.Get(sortedNode);
|
vtkm::Id sortID = nodesPortal.Get(sortedNode);
|
||||||
vtkm::Id superparent = superparentsPortal.Get(sortID);
|
vtkm::Id superparent = superparentsPortal.Get(sortID);
|
||||||
@ -240,10 +240,10 @@ public:
|
|||||||
firstVertexForSuperparentPortal.Set(superparent, sortedNode);
|
firstVertexForSuperparentPortal.Set(superparent, sortedNode);
|
||||||
} // per node in sorted order
|
} // per node in sorted order
|
||||||
// now we use that to compute the intrinsic weights
|
// now we use that to compute the intrinsic weights
|
||||||
for (vtkm::Id superarc = 0; superarc < contourTree.superarcs.GetNumberOfValues(); superarc++)
|
for (vtkm::Id superarc = 0; superarc < contourTree.Superarcs.GetNumberOfValues(); superarc++)
|
||||||
if (superarc == contourTree.superarcs.GetNumberOfValues() - 1)
|
if (superarc == contourTree.Superarcs.GetNumberOfValues() - 1)
|
||||||
superarcIntrinsicWeightPortal.Set(superarc,
|
superarcIntrinsicWeightPortal.Set(superarc,
|
||||||
contourTree.arcs.GetNumberOfValues() -
|
contourTree.Arcs.GetNumberOfValues() -
|
||||||
firstVertexForSuperparentPortal.Get(superarc));
|
firstVertexForSuperparentPortal.Get(superarc));
|
||||||
else
|
else
|
||||||
superarcIntrinsicWeightPortal.Set(superarc,
|
superarcIntrinsicWeightPortal.Set(superarc,
|
||||||
@ -252,13 +252,13 @@ public:
|
|||||||
|
|
||||||
// now initialise the arrays for transfer & dependent weights
|
// now initialise the arrays for transfer & dependent weights
|
||||||
vtkm::cont::ArrayCopy(
|
vtkm::cont::ArrayCopy(
|
||||||
vtkm::cont::ArrayHandleConstant<vtkm::Id>(0, contourTree.superarcs.GetNumberOfValues()),
|
vtkm::cont::ArrayHandleConstant<vtkm::Id>(0, contourTree.Superarcs.GetNumberOfValues()),
|
||||||
superarcDependentWeight);
|
superarcDependentWeight);
|
||||||
vtkm::cont::ArrayCopy(
|
vtkm::cont::ArrayCopy(
|
||||||
vtkm::cont::ArrayHandleConstant<vtkm::Id>(0, contourTree.supernodes.GetNumberOfValues()),
|
vtkm::cont::ArrayHandleConstant<vtkm::Id>(0, contourTree.Supernodes.GetNumberOfValues()),
|
||||||
supernodeTransferWeight);
|
supernodeTransferWeight);
|
||||||
vtkm::cont::ArrayCopy(
|
vtkm::cont::ArrayCopy(
|
||||||
vtkm::cont::ArrayHandleConstant<vtkm::Id>(0, contourTree.hyperarcs.GetNumberOfValues()),
|
vtkm::cont::ArrayHandleConstant<vtkm::Id>(0, contourTree.Hyperarcs.GetNumberOfValues()),
|
||||||
hyperarcDependentWeight);
|
hyperarcDependentWeight);
|
||||||
|
|
||||||
// set up the array which tracks which supernodes to deal with on which iteration
|
// 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),
|
vtkm::cont::ArrayCopy(vtkm::cont::ArrayHandleConstant<vtkm::Id>(0, nIterations + 1),
|
||||||
firstSupernodePerIteration);
|
firstSupernodePerIteration);
|
||||||
auto firstSupernodePerIterationPortal = firstSupernodePerIteration.GetPortalControl();
|
auto firstSupernodePerIterationPortal = firstSupernodePerIteration.GetPortalControl();
|
||||||
for (vtkm::Id supernode = 0; supernode < contourTree.supernodes.GetNumberOfValues();
|
for (vtkm::Id supernode = 0; supernode < contourTree.Supernodes.GetNumberOfValues();
|
||||||
supernode++)
|
supernode++)
|
||||||
{ // per supernode
|
{ // per supernode
|
||||||
vtkm::Id when = MaskedIndex(whenTransferredPortal.Get(supernode));
|
vtkm::Id when = MaskedIndex(whenTransferredPortal.Get(supernode));
|
||||||
@ -285,7 +285,7 @@ public:
|
|||||||
firstSupernodePerIterationPortal.Get(iteration + 1));
|
firstSupernodePerIterationPortal.Get(iteration + 1));
|
||||||
|
|
||||||
// set the sentinel at the end of the array
|
// 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
|
// now use that array to construct a similar array for hypernodes
|
||||||
IdArrayType firstHypernodePerIteration;
|
IdArrayType firstHypernodePerIteration;
|
||||||
@ -297,7 +297,7 @@ public:
|
|||||||
for (vtkm::Id iteration = 0; iteration < nIterations; iteration++)
|
for (vtkm::Id iteration = 0; iteration < nIterations; iteration++)
|
||||||
firstHypernodePerIterationPortal.Set(
|
firstHypernodePerIterationPortal.Set(
|
||||||
iteration, hyperparentsPortal.Get(firstSupernodePerIterationPortal.Get(iteration)));
|
iteration, hyperparentsPortal.Get(firstSupernodePerIterationPortal.Get(iteration)));
|
||||||
firstHypernodePerIterationPortal.Set(nIterations, contourTree.hypernodes.GetNumberOfValues());
|
firstHypernodePerIterationPortal.Set(nIterations, contourTree.Hypernodes.GetNumberOfValues());
|
||||||
|
|
||||||
// now iterate, propagating weights inwards
|
// now iterate, propagating weights inwards
|
||||||
for (vtkm::Id iteration = 0; iteration < nIterations; iteration++)
|
for (vtkm::Id iteration = 0; iteration < nIterations; iteration++)
|
||||||
@ -369,9 +369,9 @@ public:
|
|||||||
// last superarc for the hyperarc
|
// last superarc for the hyperarc
|
||||||
vtkm::Id lastSuperarc;
|
vtkm::Id lastSuperarc;
|
||||||
// special case for the last hyperarc
|
// 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
|
// take the last superarc in the array
|
||||||
lastSuperarc = contourTree.supernodes.GetNumberOfValues() - 1;
|
lastSuperarc = contourTree.Supernodes.GetNumberOfValues() - 1;
|
||||||
else
|
else
|
||||||
// otherwise, take the next hypernode's ID and subtract 1
|
// otherwise, take the next hypernode's ID and subtract 1
|
||||||
lastSuperarc = hypernodesPortal.Get(hypernode + 1) - 1;
|
lastSuperarc = hypernodesPortal.Get(hypernode + 1) - 1;
|
||||||
@ -399,12 +399,12 @@ public:
|
|||||||
IdArrayType& branchSaddle,
|
IdArrayType& branchSaddle,
|
||||||
IdArrayType& branchParent)
|
IdArrayType& branchParent)
|
||||||
{ // ComputeVolumeBranchDecomposition()
|
{ // ComputeVolumeBranchDecomposition()
|
||||||
auto superarcsPortal = contourTree.superarcs.GetPortalConstControl();
|
auto superarcsPortal = contourTree.Superarcs.GetPortalConstControl();
|
||||||
auto superarcDependentWeightPortal = superarcDependentWeight.GetPortalConstControl();
|
auto superarcDependentWeightPortal = superarcDependentWeight.GetPortalConstControl();
|
||||||
auto superarcIntrinsicWeightPortal = superarcIntrinsicWeight.GetPortalConstControl();
|
auto superarcIntrinsicWeightPortal = superarcIntrinsicWeight.GetPortalConstControl();
|
||||||
|
|
||||||
// cache the number of non-root supernodes & superarcs
|
// 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;
|
vtkm::Id nSuperarcs = nSupernodes - 1;
|
||||||
|
|
||||||
// STAGE I: Find the upward and downwards weight for each superarc, and set up arrays
|
// STAGE I: Find the upward and downwards weight for each superarc, and set up arrays
|
||||||
@ -555,7 +555,7 @@ public:
|
|||||||
{ // ComputeBranchData()
|
{ // ComputeBranchData()
|
||||||
|
|
||||||
// Set up constants
|
// Set up constants
|
||||||
vtkm::Id nSupernodes = contourTree.supernodes.GetNumberOfValues();
|
vtkm::Id nSupernodes = contourTree.Supernodes.GetNumberOfValues();
|
||||||
auto noSuchElementArray =
|
auto noSuchElementArray =
|
||||||
vtkm::cont::ArrayHandleConstant<vtkm::Id>((vtkm::Id)NO_SUCH_ELEMENT, nSupernodes);
|
vtkm::cont::ArrayHandleConstant<vtkm::Id>((vtkm::Id)NO_SUCH_ELEMENT, nSupernodes);
|
||||||
vtkm::cont::ArrayCopy(noSuchElementArray, whichBranch);
|
vtkm::cont::ArrayCopy(noSuchElementArray, whichBranch);
|
||||||
@ -663,14 +663,14 @@ public:
|
|||||||
|
|
||||||
vtkm::cont::Algorithm::Sort(
|
vtkm::cont::Algorithm::Sort(
|
||||||
supernodeSorter,
|
supernodeSorter,
|
||||||
process_contourtree_inc_ns::SuperNodeBranchComparator(whichBranch, contourTree.supernodes));
|
process_contourtree_inc_ns::SuperNodeBranchComparator(whichBranch, contourTree.Supernodes));
|
||||||
IdArrayType permutedBranches;
|
IdArrayType permutedBranches;
|
||||||
permutedBranches.Allocate(nSupernodes);
|
permutedBranches.Allocate(nSupernodes);
|
||||||
PermuteArray<vtkm::Id>(whichBranch, supernodeSorter, permutedBranches);
|
PermuteArray<vtkm::Id>(whichBranch, supernodeSorter, permutedBranches);
|
||||||
|
|
||||||
IdArrayType permutedRegularID;
|
IdArrayType permutedRegularID;
|
||||||
permutedRegularID.Allocate(nSupernodes);
|
permutedRegularID.Allocate(nSupernodes);
|
||||||
PermuteArray<vtkm::Id>(contourTree.supernodes, supernodeSorter, permutedRegularID);
|
PermuteArray<vtkm::Id>(contourTree.Supernodes, supernodeSorter, permutedRegularID);
|
||||||
|
|
||||||
#ifdef DEBUG_PRINT
|
#ifdef DEBUG_PRINT
|
||||||
std::cout << "VI A. Sorted into Branches" << std::endl;
|
std::cout << "VI A. Sorted into Branches" << std::endl;
|
||||||
@ -925,7 +925,7 @@ public:
|
|||||||
{ // ComputeHeightBranchDecomposition()
|
{ // ComputeHeightBranchDecomposition()
|
||||||
|
|
||||||
// Cache the number of non-root supernodes & superarcs
|
// Cache the number of non-root supernodes & superarcs
|
||||||
vtkm::Id nSupernodes = contourTree.supernodes.GetNumberOfValues();
|
vtkm::Id nSupernodes = contourTree.Supernodes.GetNumberOfValues();
|
||||||
auto noSuchElementArray =
|
auto noSuchElementArray =
|
||||||
vtkm::cont::ArrayHandleConstant<vtkm::Id>((vtkm::Id)NO_SUCH_ELEMENT, nSupernodes);
|
vtkm::cont::ArrayHandleConstant<vtkm::Id>((vtkm::Id)NO_SUCH_ELEMENT, nSupernodes);
|
||||||
|
|
||||||
@ -945,14 +945,14 @@ public:
|
|||||||
|
|
||||||
// Compute the Euler Tour
|
// Compute the Euler Tour
|
||||||
process_contourtree_inc_ns::EulerTour 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
|
// 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());
|
minTourEdges.GetPortalControl());
|
||||||
|
|
||||||
// Reroot the Euler Tour at the global max
|
// 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)),
|
contourTree.nodes.GetNumberOfValues() - 1)),
|
||||||
maxTourEdges.GetPortalControl());
|
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
|
// 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)
|
if (false == useParallelMinMaxSearch)
|
||||||
{
|
{
|
||||||
ProcessContourTree::findMinMax(contourTree.supernodes.GetPortalConstControl(),
|
ProcessContourTree::findMinMax(contourTree.Supernodes.GetPortalConstControl(),
|
||||||
minTourEdges.GetPortalConstControl(),
|
minTourEdges.GetPortalConstControl(),
|
||||||
true,
|
true,
|
||||||
minValues.GetPortalControl(),
|
minValues.GetPortalControl(),
|
||||||
minParents.GetPortalControl());
|
minParents.GetPortalControl());
|
||||||
|
|
||||||
ProcessContourTree::findMinMax(contourTree.supernodes.GetPortalConstControl(),
|
ProcessContourTree::findMinMax(contourTree.Supernodes.GetPortalConstControl(),
|
||||||
maxTourEdges.GetPortalConstControl(),
|
maxTourEdges.GetPortalConstControl(),
|
||||||
false,
|
false,
|
||||||
maxValues.GetPortalControl(),
|
maxValues.GetPortalControl(),
|
||||||
@ -985,10 +985,10 @@ public:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ProcessContourTree::findMinMaxParallel(
|
ProcessContourTree::findMinMaxParallel(
|
||||||
contourTree.supernodes, minTourEdges, true, minValues, minParents);
|
contourTree.Supernodes, minTourEdges, true, minValues, minParents);
|
||||||
|
|
||||||
ProcessContourTree::findMinMaxParallel(
|
ProcessContourTree::findMinMaxParallel(
|
||||||
contourTree.supernodes, maxTourEdges, false, maxValues, maxParents);
|
contourTree.Supernodes, maxTourEdges, false, maxValues, maxParents);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1001,7 +1001,7 @@ public:
|
|||||||
Invoke(bestUpDownWorklet,
|
Invoke(bestUpDownWorklet,
|
||||||
tour.first,
|
tour.first,
|
||||||
contourTree.nodes,
|
contourTree.nodes,
|
||||||
contourTree.supernodes,
|
contourTree.Supernodes,
|
||||||
minValues,
|
minValues,
|
||||||
minParents,
|
minParents,
|
||||||
maxValues,
|
maxValues,
|
||||||
|
@ -69,8 +69,8 @@ namespace active_graph_inc
|
|||||||
class BuildChainsWorklet : public vtkm::worklet::WorkletMapField
|
class BuildChainsWorklet : public vtkm::worklet::WorkletMapField
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef void ControlSignature(FieldIn activeVertices, // (input) activeVertices
|
typedef void ControlSignature(FieldIn activeVertices, // (input) activeVertices
|
||||||
WholeArrayInOut hyperacrcs); // (input/output) hyperarcs
|
WholeArrayInOut hyperarcs); // (input/output) hyperarcs
|
||||||
typedef void ExecutionSignature(_1, InputIndex, _2);
|
typedef void ExecutionSignature(_1, InputIndex, _2);
|
||||||
using InputDomain = _1;
|
using InputDomain = _1;
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ class BuildTrunkWorklet : public vtkm::worklet::WorkletMapField
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef void ControlSignature(FieldIn activeVertices, // (input) activeVertices
|
typedef void ControlSignature(FieldIn activeVertices, // (input) activeVertices
|
||||||
WholeArrayInOut hyperacrs); // (input/output) hyperarcs
|
WholeArrayInOut hyperarcs); // (input/output) hyperarcs
|
||||||
typedef void ExecutionSignature(_1, InputIndex, _2);
|
typedef void ExecutionSignature(_1, InputIndex, _2);
|
||||||
using InputDomain = _1;
|
using InputDomain = _1;
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ public:
|
|||||||
|
|
||||||
// In serial this worklet implements the following operation
|
// 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
|
{ // per node
|
||||||
indexType nodeID = nodes[node];
|
indexType nodeID = nodes[node];
|
||||||
// work out whether we have the first node on the superarc
|
// work out whether we have the first node on the superarc
|
||||||
@ -131,21 +131,21 @@ public:
|
|||||||
indexType superarc = tree.superarcs[superparent];
|
indexType superarc = tree.superarcs[superparent];
|
||||||
// explicit check for global minimum
|
// explicit check for global minimum
|
||||||
if (NoSuchElement(superarc))
|
if (NoSuchElement(superarc))
|
||||||
tree.arcs[nodeID] = NO_SUCH_ELEMENT;
|
tree.Arcs[nodeID] = NO_SUCH_ELEMENT;
|
||||||
else
|
else
|
||||||
tree.arcs[nodeID] = tree.supernodes[tree.superarcs[superparent]];
|
tree.Arcs[nodeID] = tree.Supernodes[tree.superarcs[superparent]];
|
||||||
} // left edge
|
} // left edge
|
||||||
else if (superparent != tree.superparents[nodes[node-1]])
|
else if (superparent != tree.Superparents[nodes[node-1]])
|
||||||
{ // any other transition
|
{ // any other transition
|
||||||
indexType superarc = tree.superarcs[superparent];
|
indexType superarc = tree.superarcs[superparent];
|
||||||
// explicit check for global minimum
|
// explicit check for global minimum
|
||||||
if (NoSuchElement(superarc))
|
if (NoSuchElement(superarc))
|
||||||
tree.arcs[nodeID] = NO_SUCH_ELEMENT;
|
tree.Arcs[nodeID] = NO_SUCH_ELEMENT;
|
||||||
else
|
else
|
||||||
tree.arcs[nodeID] = tree.supernodes[tree.superarcs[superparent]];
|
tree.Arcs[nodeID] = tree.Supernodes[tree.superarcs[superparent]];
|
||||||
} // any other transition
|
} // any other transition
|
||||||
else
|
else
|
||||||
tree.arcs[nodeID] = nodes[node-1];
|
tree.Arcs[nodeID] = nodes[node-1];
|
||||||
} // per node
|
} // per node
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
@ -129,17 +129,17 @@ public:
|
|||||||
indexType nodeID = globalIndex[graphVertex];
|
indexType nodeID = globalIndex[graphVertex];
|
||||||
if (NoSuchElement(graphTarget))
|
if (NoSuchElement(graphTarget))
|
||||||
{ // trunk hypernode
|
{ // trunk hypernode
|
||||||
tree.arcs[nodeID] = NO_SUCH_ELEMENT | IS_HYPERNODE | IS_SUPERNODE;
|
tree.Arcs[nodeID] = NO_SUCH_ELEMENT | IS_HYPERNODE | IS_SUPERNODE;
|
||||||
tree.superparents[nodeID] = hyperID[graphVertex];
|
tree.Superparents[nodeID] = hyperID[graphVertex];
|
||||||
} // trunk hypernode
|
} // trunk hypernode
|
||||||
else if (IsHypernode(graphTarget))
|
else if (IsHypernode(graphTarget))
|
||||||
{ // hypernode
|
{ // hypernode
|
||||||
tree.arcs[nodeID] = globalIndex[MaskedIndex(graphTarget)] | IS_HYPERNODE | IS_SUPERNODE;
|
tree.Arcs[nodeID] = globalIndex[MaskedIndex(graphTarget)] | IS_HYPERNODE | IS_SUPERNODE;
|
||||||
tree.superparents[nodeID] = hyperID[graphVertex];
|
tree.Superparents[nodeID] = hyperID[graphVertex];
|
||||||
} // hypernode
|
} // hypernode
|
||||||
else
|
else
|
||||||
{ // supernode
|
{ // supernode
|
||||||
tree.arcs[nodeID] = globalIndex[MaskedIndex(graphTarget)] | IS_SUPERNODE;
|
tree.Arcs[nodeID] = globalIndex[MaskedIndex(graphTarget)] | IS_SUPERNODE;
|
||||||
} // supernode
|
} // supernode
|
||||||
|
|
||||||
} // per graph vertex
|
} // per graph vertex
|
||||||
|
@ -73,7 +73,7 @@ public:
|
|||||||
WholeArrayIn treeArcs, // (input) arcs from the tree
|
WholeArrayIn treeArcs, // (input) arcs from the tree
|
||||||
WholeArrayIn
|
WholeArrayIn
|
||||||
meshExtrema, // (input) extrema from the mesh (i.e, pits or peaks depending on if we have a join or split tree)
|
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
|
WholeArrayIn treeSupernodes, // (input) supernodes from the tree
|
||||||
WholeArrayInOut treeSuperparents); // (input/output) superparents from the tree
|
WholeArrayInOut treeSuperparents); // (input/output) superparents from the tree
|
||||||
typedef void ExecutionSignature(_1, InputIndex, _2, _3, _4, _5);
|
typedef void ExecutionSignature(_1, InputIndex, _2, _3, _4, _5);
|
||||||
@ -177,31 +177,31 @@ public:
|
|||||||
|
|
||||||
// In serial this worklet implements the following operation
|
// 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
|
{ // per node
|
||||||
// ignore if the flag is already set
|
// ignore if the flag is already set
|
||||||
if (IsSupernode(tree.arcs[nodeID]))
|
if (IsSupernode(tree.Arcs[nodeID]))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// start at the "top" end, retrieved from initial extremal array
|
// start at the "top" end, retrieved from initial extremal array
|
||||||
vtkm::Id fromID = extrema[nodeID];
|
vtkm::Id fromID = extrema[nodeID];
|
||||||
|
|
||||||
// get the "bottom" end from arcs array (it's a peak, so it's set already)
|
// 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
|
// loop to bottom or until to node is "below" this node
|
||||||
while (!NoSuchElement(toID) && (IsJoinGraph ?
|
while (!NoSuchElement(toID) && (IsJoinGraph ?
|
||||||
(MaskedIndex(toID) > MaskedIndex(nodeID)): (MaskedIndex(toID) < MaskedIndex(nodeID))))
|
(MaskedIndex(toID) > MaskedIndex(nodeID)): (MaskedIndex(toID) < MaskedIndex(nodeID))))
|
||||||
{ // sliding loop
|
{ // sliding loop
|
||||||
fromID = toID;
|
fromID = toID;
|
||||||
toID = tree.arcs[MaskedIndex(fromID)];
|
toID = tree.Arcs[MaskedIndex(fromID)];
|
||||||
} // sliding loop
|
} // sliding loop
|
||||||
|
|
||||||
// now we've found a hyperarc, we need to search to place ourselves on a superarc
|
// 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.
|
// it's a binary search! first we get the hyperarc ID, which we've stored in superparents.
|
||||||
indexType hyperID = tree.superparents[MaskedIndex(fromID)];
|
indexType hyperID = tree.Superparents[MaskedIndex(fromID)];
|
||||||
indexType leftSupernodeID = tree.firstSuperchild[hyperID];
|
indexType leftSupernodeID = tree.FirstSuperchild[hyperID];
|
||||||
indexType leftNodeID = tree.supernodes[leftSupernodeID];
|
indexType leftNodeID = tree.Supernodes[leftSupernodeID];
|
||||||
|
|
||||||
// the idea here is to compare the node ID against the node IDs for supernodes along the hyperarc
|
// 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.
|
// 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
|
// special case for the left-hand edge
|
||||||
if (IsJoinGraph ? (nodeID < leftNodeID) : (nodeID > leftNodeID))
|
if (IsJoinGraph ? (nodeID < leftNodeID) : (nodeID > leftNodeID))
|
||||||
{ // below left hand end
|
{ // below left hand end
|
||||||
tree.superparents[nodeID] = leftSupernodeID;
|
tree.Superparents[nodeID] = leftSupernodeID;
|
||||||
} // below left hand ned
|
} // below left hand ned
|
||||||
else
|
else
|
||||||
{ // not below the left hand end
|
{ // not below the left hand end
|
||||||
@ -228,14 +228,14 @@ public:
|
|||||||
if (hyperID == NumHypernodes - 1)
|
if (hyperID == NumHypernodes - 1)
|
||||||
rightSupernodeID = NumSupernodes - 1;
|
rightSupernodeID = NumSupernodes - 1;
|
||||||
else
|
else
|
||||||
rightSupernodeID = tree.firstSuperchild[hyperID + 1] - 1;
|
rightSupernodeID = tree.FirstSuperchild[hyperID + 1] - 1;
|
||||||
} // join graph
|
} // join graph
|
||||||
else
|
else
|
||||||
{ // split graph
|
{ // split graph
|
||||||
if (hyperID == 0)
|
if (hyperID == 0)
|
||||||
rightSupernodeID = NumSupernodes - 1;
|
rightSupernodeID = NumSupernodes - 1;
|
||||||
else
|
else
|
||||||
rightSupernodeID = tree.firstSuperchild[hyperID - 1] - 1;
|
rightSupernodeID = tree.FirstSuperchild[hyperID - 1] - 1;
|
||||||
} // split graph
|
} // split graph
|
||||||
|
|
||||||
// the right end is guaranteed to be the hypernode at the top, which is not
|
// the right end is guaranteed to be the hypernode at the top, which is not
|
||||||
@ -245,7 +245,7 @@ public:
|
|||||||
{ // binary search
|
{ // binary search
|
||||||
vtkm::Id midSupernodeID = (leftSupernodeID + rightSupernodeID) / 2;
|
vtkm::Id midSupernodeID = (leftSupernodeID + rightSupernodeID) / 2;
|
||||||
// std::cout << "Mid Supernode ID: " << midSupernodeID << std::endl;
|
// 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;
|
// std::cout << "Mid Node ID: " << midNodeID << std::endl;
|
||||||
// this is NEVER equal, because nodeID cannot be a supernode
|
// this is NEVER equal, because nodeID cannot be a supernode
|
||||||
if (IsJoinGraph ? (midNodeID > nodeID) : (midNodeID < nodeID))
|
if (IsJoinGraph ? (midNodeID > nodeID) : (midNodeID < nodeID))
|
||||||
@ -255,7 +255,7 @@ public:
|
|||||||
} // binary search
|
} // binary search
|
||||||
|
|
||||||
// we have now found the supernode/arc to which the vertex belongs
|
// 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
|
} // not below the left hand end
|
||||||
} // per node
|
} // per node
|
||||||
*/
|
*/
|
||||||
|
@ -102,7 +102,7 @@ public:
|
|||||||
for (indexType supernode = 0; supernode < nSupernodes; supernode++)
|
for (indexType supernode = 0; supernode < nSupernodes; supernode++)
|
||||||
{ // per graph vertex
|
{ // per graph vertex
|
||||||
// retrieve the graph index
|
// retrieve the graph index
|
||||||
indexType graphVertex = tree.supernodes[supernode];
|
indexType graphVertex = tree.Supernodes[supernode];
|
||||||
|
|
||||||
// retrieve the ID stored in the hyperarcs array
|
// retrieve the ID stored in the hyperarcs array
|
||||||
indexType graphTarget = hyperarcs[graphVertex];
|
indexType graphTarget = hyperarcs[graphVertex];
|
||||||
|
@ -76,7 +76,7 @@ public:
|
|||||||
WholeArrayIn superId, // (input) superID from the active graph
|
WholeArrayIn superId, // (input) superID from the active graph
|
||||||
WholeArrayIn hyperId, // (input) hyperID from the active graph
|
WholeArrayIn hyperId, // (input) hyperID from the active graph
|
||||||
WholeArrayOut treeSuperarcs, // (output) superarcs from the tree
|
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);
|
typedef void ExecutionSignature(_1, InputIndex, _2, _3, _4, _5, _6, _7);
|
||||||
using InputDomain = _1;
|
using InputDomain = _1;
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ public:
|
|||||||
for (indexType supernode = 0; supernode < nSupernodes; supernode++)
|
for (indexType supernode = 0; supernode < nSupernodes; supernode++)
|
||||||
{ // per supernode
|
{ // per supernode
|
||||||
// retrieve the actual supernode ID in the graph
|
// 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)
|
// retrieve the hyperparent (which is still a graph index, not a hypernode index)
|
||||||
indexType hyperparent = tree.hyperparents[supernode];
|
indexType hyperparent = tree.hyperparents[supernode];
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ public:
|
|||||||
tree.superarcs[supernode] = superID[MaskedIndex(prunesTo)];
|
tree.superarcs[supernode] = superID[MaskedIndex(prunesTo)];
|
||||||
|
|
||||||
// we also need to set the first superchild for the hypergraph
|
// we also need to set the first superchild for the hypergraph
|
||||||
tree.firstSuperchild[hyperID[hyperparent]] = supernode;
|
tree.FirstSuperchild[hyperID[hyperparent]] = supernode;
|
||||||
} // first supernode
|
} // first supernode
|
||||||
// all others just point to their neighbour
|
// all others just point to their neighbour
|
||||||
else
|
else
|
||||||
|
@ -89,8 +89,8 @@ public:
|
|||||||
bool operator()(const vtkm::Id& i, const vtkm::Id& j) const
|
bool operator()(const vtkm::Id& i, const vtkm::Id& j) const
|
||||||
{ // operator()
|
{ // operator()
|
||||||
// first make sure we have the "top" end set correctly
|
// first make sure we have the "top" end set correctly
|
||||||
vtkm::Id superarcI = SuperparentsPortal.Get(i);
|
vtkm::Id superarcI = this->SuperparentsPortal.Get(i);
|
||||||
vtkm::Id superarcJ = SuperparentsPortal.Get(j);
|
vtkm::Id superarcJ = this->SuperparentsPortal.Get(j);
|
||||||
|
|
||||||
// now test on that
|
// now test on that
|
||||||
if (superarcI < superarcJ)
|
if (superarcI < superarcJ)
|
||||||
|
@ -123,7 +123,7 @@ public:
|
|||||||
{ // per supernode
|
{ // per supernode
|
||||||
|
|
||||||
// find the regular ID for the supernode
|
// find the regular ID for the supernode
|
||||||
vtkm::Id nodeID = contourTree.supernodes[supernode];
|
vtkm::Id nodeID = contourTree.Supernodes[supernode];
|
||||||
|
|
||||||
// Transfer the join information
|
// Transfer the join information
|
||||||
// look up the join superparent in the join tree
|
// look up the join superparent in the join tree
|
||||||
@ -131,7 +131,7 @@ public:
|
|||||||
// save the join superparent
|
// save the join superparent
|
||||||
joinSuperparents[supernode] = joinSuperparent;
|
joinSuperparents[supernode] = joinSuperparent;
|
||||||
// now, if the join superparent's mesh ID is the node itself, we're at a join supernode
|
// 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;
|
newJoinID[joinSuperparent] = supernode;
|
||||||
|
|
||||||
// Transfer the split information
|
// Transfer the split information
|
||||||
@ -140,7 +140,7 @@ public:
|
|||||||
// save the split superparent
|
// save the split superparent
|
||||||
splitSuperparents[supernode] = splitSuperparent;
|
splitSuperparents[supernode] = splitSuperparent;
|
||||||
// now, if the split superparent's mesh ID is the node, we're at a split supernode
|
// 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;
|
newSplitID[splitSuperparent] = supernode;
|
||||||
|
|
||||||
} // per supernode
|
} // per supernode
|
||||||
|
@ -103,7 +103,7 @@ public:
|
|||||||
|
|
||||||
// In serial this worklet implements the following operation
|
// 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
|
{ // per supernode
|
||||||
bool isFirstSuperchild = false;
|
bool isFirstSuperchild = false;
|
||||||
vtkm::Id hyperparent = contourTree.hyperparents[supernode];
|
vtkm::Id hyperparent = contourTree.hyperparents[supernode];
|
||||||
|
@ -93,7 +93,7 @@ public:
|
|||||||
|
|
||||||
// In serial this worklet implements the following operation
|
// 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
|
{ // per node
|
||||||
vtkm::Id superarc = permutedSuperarcs[supernode];
|
vtkm::Id superarc = permutedSuperarcs[supernode];
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ public:
|
|||||||
|
|
||||||
// In serial this worklet implements the following operation
|
// 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])];
|
contourTree.hyperparents[supernode] = superSortIndex[MaskedIndex(contourTree.hyperparents[supernode])];
|
||||||
} // per supernode
|
} // per supernode
|
||||||
*/
|
*/
|
||||||
|
@ -107,7 +107,7 @@ public:
|
|||||||
|
|
||||||
// In serial this worklet implements the following operation
|
// 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
|
{ // per supernode
|
||||||
bool isAHypernode = IsHypernode(contourTree.whenTransferred[supernode]);
|
bool isAHypernode = IsHypernode(contourTree.whenTransferred[supernode]);
|
||||||
|
|
||||||
|
@ -82,8 +82,8 @@ public:
|
|||||||
typedef void ExecutionSignature(_1, InputIndex, _2, _3, _4, _5, _6, _7, _8);
|
typedef void ExecutionSignature(_1, InputIndex, _2, _3, _4, _5, _6, _7, _8);
|
||||||
using InputDomain = _1;
|
using InputDomain = _1;
|
||||||
|
|
||||||
vtkm::Id NumHypernodes; // contourTree.hypernodes.GetNumberOfValues()
|
vtkm::Id NumHypernodes; // contourTree.Hypernodes.GetNumberOfValues()
|
||||||
vtkm::Id NumSupernodes; // contourTree.supernodes.GetNumberOfValues()
|
vtkm::Id NumSupernodes; // contourTree.Supernodes.GetNumberOfValues()
|
||||||
|
|
||||||
// Default Constructor
|
// Default Constructor
|
||||||
VTKM_EXEC_CONT
|
VTKM_EXEC_CONT
|
||||||
@ -247,7 +247,7 @@ public:
|
|||||||
} // regular nodes only
|
} // regular nodes only
|
||||||
/*
|
/*
|
||||||
// In serial this worklet implements the following operation
|
// 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
|
{ // per node
|
||||||
// if the superparent is already set, it's a supernode, so skip it.
|
// if the superparent is already set, it's a supernode, so skip it.
|
||||||
if (NoSuchElement(contourTree.superparents[node]))
|
if (NoSuchElement(contourTree.superparents[node]))
|
||||||
@ -256,8 +256,8 @@ public:
|
|||||||
indexType top = meshExtrema.Peaks[node];
|
indexType top = meshExtrema.Peaks[node];
|
||||||
indexType bottom = meshExtrema.Pits[node];
|
indexType bottom = meshExtrema.Pits[node];
|
||||||
// these are the regular IDs of supernodes, so their superparents are already set
|
// these are the regular IDs of supernodes, so their superparents are already set
|
||||||
indexType topSuperparent = contourTree.superparents[top];
|
indexType topSuperparent = contourTree.Superparents[top];
|
||||||
indexType bottomSuperparent = contourTree.superparents[bottom];
|
indexType bottomSuperparent = contourTree.Superparents[bottom];
|
||||||
// and we can also find out when they transferred
|
// and we can also find out when they transferred
|
||||||
indexType topWhen = contourTree.whenTransferred[topSuperparent];
|
indexType topWhen = contourTree.whenTransferred[topSuperparent];
|
||||||
indexType bottomWhen = contourTree.whenTransferred[bottomSuperparent];
|
indexType bottomWhen = contourTree.whenTransferred[bottomSuperparent];
|
||||||
@ -278,7 +278,7 @@ public:
|
|||||||
{ // top pruned first
|
{ // top pruned first
|
||||||
// we prune down to the bottom of the hyperarc in either case, by updating the top superparent
|
// we prune down to the bottom of the hyperarc in either case, by updating the top superparent
|
||||||
topSuperparent = contourTree.hyperarcs[MaskedIndex(topHyperparent)];
|
topSuperparent = contourTree.hyperarcs[MaskedIndex(topHyperparent)];
|
||||||
top = contourTree.supernodes[MaskedIndex(topSuperparent)];
|
top = contourTree.Supernodes[MaskedIndex(topSuperparent)];
|
||||||
|
|
||||||
topWhen = contourTree.whenTransferred[MaskedIndex(topSuperparent)];
|
topWhen = contourTree.whenTransferred[MaskedIndex(topSuperparent)];
|
||||||
// test to see if we've passed the node
|
// test to see if we've passed the node
|
||||||
@ -296,7 +296,7 @@ public:
|
|||||||
{ // bottom pruned first
|
{ // bottom pruned first
|
||||||
// we prune up to the top of the hyperarc in either case, by updating the bottom superparent
|
// we prune up to the top of the hyperarc in either case, by updating the bottom superparent
|
||||||
bottomSuperparent = contourTree.hyperarcs[MaskedIndex(bottomHyperparent)];
|
bottomSuperparent = contourTree.hyperarcs[MaskedIndex(bottomHyperparent)];
|
||||||
bottom = contourTree.supernodes[MaskedIndex(bottomSuperparent)];
|
bottom = contourTree.Supernodes[MaskedIndex(bottomSuperparent)];
|
||||||
bottomWhen = contourTree.whenTransferred[MaskedIndex(bottomSuperparent)];
|
bottomWhen = contourTree.whenTransferred[MaskedIndex(bottomSuperparent)];
|
||||||
// test to see if we've passed the node
|
// test to see if we've passed the node
|
||||||
if (bottom > node)
|
if (bottom > node)
|
||||||
@ -322,18 +322,18 @@ public:
|
|||||||
if (IsAscending(contourTree.hyperarcs[hyperparent]))
|
if (IsAscending(contourTree.hyperarcs[hyperparent]))
|
||||||
{ // ascending hyperarc
|
{ // ascending hyperarc
|
||||||
// the supernodes on the hyperarc are in sorted low-high order
|
// the supernodes on the hyperarc are in sorted low-high order
|
||||||
indexType lowSupernode = contourTree.hypernodes[hyperparent];
|
indexType lowSupernode = contourTree.Hypernodes[hyperparent];
|
||||||
indexType highSupernode;
|
indexType highSupernode;
|
||||||
// if it's at the right hand end, take the last supernode in the array
|
// 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)
|
||||||
highSupernode = contourTree.supernodes.size() - 1;
|
highSupernode = contourTree.Supernodes.size() - 1;
|
||||||
// otherwise, take the supernode just before the next hypernode
|
// otherwise, take the supernode just before the next hypernode
|
||||||
else
|
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
|
// now, the high supernode may be lower than the element, because the node belongs
|
||||||
// between it and the high end of the hyperarc
|
// between it and the high end of the hyperarc
|
||||||
if (contourTree.supernodes[highSupernode] < node)
|
if (contourTree.Supernodes[highSupernode] < node)
|
||||||
contourTree.superparents[node] = highSupernode;
|
contourTree.Superparents[node] = highSupernode;
|
||||||
// otherwise, we do a binary search of the superarcs
|
// otherwise, we do a binary search of the superarcs
|
||||||
else
|
else
|
||||||
{ // node between high & low
|
{ // node between high & low
|
||||||
@ -343,35 +343,35 @@ public:
|
|||||||
// find the midway supernode
|
// find the midway supernode
|
||||||
indexType midSupernode = (lowSupernode + highSupernode) / 2;
|
indexType midSupernode = (lowSupernode + highSupernode) / 2;
|
||||||
// test against the node
|
// test against the node
|
||||||
if (contourTree.supernodes[midSupernode] > node)
|
if (contourTree.Supernodes[midSupernode] > node)
|
||||||
highSupernode = midSupernode;
|
highSupernode = midSupernode;
|
||||||
// == can't happen since node is regular
|
// == can't happen since node is regular
|
||||||
else
|
else
|
||||||
lowSupernode = midSupernode;
|
lowSupernode = midSupernode;
|
||||||
} // binary search
|
} // binary search
|
||||||
// now we can use the low node as the superparent
|
// now we can use the low node as the superparent
|
||||||
contourTree.superparents[node] = lowSupernode;
|
contourTree.Superparents[node] = lowSupernode;
|
||||||
} // node between high & low
|
} // node between high & low
|
||||||
} // ascending hyperarc
|
} // ascending hyperarc
|
||||||
else
|
else
|
||||||
{ // descending hyperarc
|
{ // descending hyperarc
|
||||||
// the supernodes on the hyperarc are in sorted high-low order
|
// the supernodes on the hyperarc are in sorted high-low order
|
||||||
indexType highSupernode = contourTree.hypernodes[hyperparent];
|
indexType highSupernode = contourTree.Hypernodes[hyperparent];
|
||||||
indexType lowSupernode;
|
indexType lowSupernode;
|
||||||
// if it's at the right hand end, take the last supernode in the array
|
// 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
|
{ // last hyperarc
|
||||||
lowSupernode = contourTree.supernodes.size() - 1;
|
lowSupernode = contourTree.Supernodes.size() - 1;
|
||||||
} // last hyperarc
|
} // last hyperarc
|
||||||
// otherwise, take the supernode just before the next hypernode
|
// otherwise, take the supernode just before the next hypernode
|
||||||
else
|
else
|
||||||
{ // other hyperarc
|
{ // other hyperarc
|
||||||
lowSupernode = contourTree.hypernodes[MaskedIndex(hyperparent) + 1] - 1;
|
lowSupernode = contourTree.Hypernodes[MaskedIndex(hyperparent) + 1] - 1;
|
||||||
} // other hyperarc
|
} // other hyperarc
|
||||||
// now, the low supernode may be higher than the element, because the node belongs
|
// now, the low supernode may be higher than the element, because the node belongs
|
||||||
// between it and the low end of the hyperarc
|
// between it and the low end of the hyperarc
|
||||||
if (contourTree.supernodes[lowSupernode] > node)
|
if (contourTree.Supernodes[lowSupernode] > node)
|
||||||
contourTree.superparents[node] = lowSupernode;
|
contourTree.Superparents[node] = lowSupernode;
|
||||||
// otherwise, we do a binary search of the superarcs
|
// otherwise, we do a binary search of the superarcs
|
||||||
else
|
else
|
||||||
{ // node between low & high
|
{ // node between low & high
|
||||||
@ -381,14 +381,14 @@ public:
|
|||||||
// find the midway supernode
|
// find the midway supernode
|
||||||
indexType midSupernode = (highSupernode + lowSupernode) / 2;
|
indexType midSupernode = (highSupernode + lowSupernode) / 2;
|
||||||
// test against the node
|
// test against the node
|
||||||
if (contourTree.supernodes[midSupernode] > node)
|
if (contourTree.Supernodes[midSupernode] > node)
|
||||||
highSupernode = midSupernode;
|
highSupernode = midSupernode;
|
||||||
// == can't happen since node is regular
|
// == can't happen since node is regular
|
||||||
else
|
else
|
||||||
lowSupernode = midSupernode;
|
lowSupernode = midSupernode;
|
||||||
} // binary search
|
} // binary search
|
||||||
// now we can use the high node as the superparent
|
// now we can use the high node as the superparent
|
||||||
contourTree.superparents[node] = highSupernode;
|
contourTree.Superparents[node] = highSupernode;
|
||||||
} // node between low & high
|
} // node between low & high
|
||||||
} // descending hyperarc
|
} // descending hyperarc
|
||||||
} // regular nodes only
|
} // regular nodes only
|
||||||
@ -420,8 +420,8 @@ public:
|
|||||||
typedef void ExecutionSignature(_1, InputIndex, _2, _3, _4, _5, _6, _7, _8, _9);
|
typedef void ExecutionSignature(_1, InputIndex, _2, _3, _4, _5, _6, _7, _8, _9);
|
||||||
using InputDomain = _1;
|
using InputDomain = _1;
|
||||||
|
|
||||||
vtkm::Id NumHypernodes; // contourTree.hypernodes.GetNumberOfValues()
|
vtkm::Id NumHypernodes; // contourTree.Hypernodes.GetNumberOfValues()
|
||||||
vtkm::Id NumSupernodes; // contourTree.supernodes.GetNumberOfValues()
|
vtkm::Id NumSupernodes; // contourTree.Supernodes.GetNumberOfValues()
|
||||||
|
|
||||||
vtkm::Id NumRows, NumColumns, NumSlices; // Mesh 2D or 3D - NumRows, NumColumns, NumSlices
|
vtkm::Id NumRows, NumColumns, NumSlices; // Mesh 2D or 3D - NumRows, NumColumns, NumSlices
|
||||||
|
|
||||||
@ -588,17 +588,17 @@ public:
|
|||||||
} // regular nodes only
|
} // regular nodes only
|
||||||
/*
|
/*
|
||||||
// In serial this worklet implements the following operation
|
// 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
|
{ // per node
|
||||||
// if the superparent is already set, it's a supernode, so skip it.
|
// 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
|
{ // regular nodes only
|
||||||
// we will need to prune top and bottom until one of them prunes past the node
|
// we will need to prune top and bottom until one of them prunes past the node
|
||||||
indexType top = meshExtrema.Peaks[node];
|
indexType top = meshExtrema.Peaks[node];
|
||||||
indexType bottom = meshExtrema.Pits[node];
|
indexType bottom = meshExtrema.Pits[node];
|
||||||
// these are the regular IDs of supernodes, so their superparents are already set
|
// these are the regular IDs of supernodes, so their superparents are already set
|
||||||
indexType topSuperparent = contourTree.superparents[top];
|
indexType topSuperparent = contourTree.Superparents[top];
|
||||||
indexType bottomSuperparent = contourTree.superparents[bottom];
|
indexType bottomSuperparent = contourTree.Superparents[bottom];
|
||||||
// and we can also find out when they transferred
|
// and we can also find out when they transferred
|
||||||
indexType topWhen = contourTree.whenTransferred[topSuperparent];
|
indexType topWhen = contourTree.whenTransferred[topSuperparent];
|
||||||
indexType bottomWhen = contourTree.whenTransferred[bottomSuperparent];
|
indexType bottomWhen = contourTree.whenTransferred[bottomSuperparent];
|
||||||
@ -619,7 +619,7 @@ public:
|
|||||||
{ // top pruned first
|
{ // top pruned first
|
||||||
// we prune down to the bottom of the hyperarc in either case, by updating the top superparent
|
// we prune down to the bottom of the hyperarc in either case, by updating the top superparent
|
||||||
topSuperparent = contourTree.hyperarcs[MaskedIndex(topHyperparent)];
|
topSuperparent = contourTree.hyperarcs[MaskedIndex(topHyperparent)];
|
||||||
top = contourTree.supernodes[MaskedIndex(topSuperparent)];
|
top = contourTree.Supernodes[MaskedIndex(topSuperparent)];
|
||||||
|
|
||||||
topWhen = contourTree.whenTransferred[MaskedIndex(topSuperparent)];
|
topWhen = contourTree.whenTransferred[MaskedIndex(topSuperparent)];
|
||||||
// test to see if we've passed the node
|
// test to see if we've passed the node
|
||||||
@ -637,7 +637,7 @@ public:
|
|||||||
{ // bottom pruned first
|
{ // bottom pruned first
|
||||||
// we prune up to the top of the hyperarc in either case, by updating the bottom superparent
|
// we prune up to the top of the hyperarc in either case, by updating the bottom superparent
|
||||||
bottomSuperparent = contourTree.hyperarcs[MaskedIndex(bottomHyperparent)];
|
bottomSuperparent = contourTree.hyperarcs[MaskedIndex(bottomHyperparent)];
|
||||||
bottom = contourTree.supernodes[MaskedIndex(bottomSuperparent)];
|
bottom = contourTree.Supernodes[MaskedIndex(bottomSuperparent)];
|
||||||
bottomWhen = contourTree.whenTransferred[MaskedIndex(bottomSuperparent)];
|
bottomWhen = contourTree.whenTransferred[MaskedIndex(bottomSuperparent)];
|
||||||
// test to see if we've passed the node
|
// test to see if we've passed the node
|
||||||
if (bottom > node)
|
if (bottom > node)
|
||||||
@ -663,18 +663,18 @@ public:
|
|||||||
if (IsAscending(contourTree.hyperarcs[hyperparent]))
|
if (IsAscending(contourTree.hyperarcs[hyperparent]))
|
||||||
{ // ascending hyperarc
|
{ // ascending hyperarc
|
||||||
// the supernodes on the hyperarc are in sorted low-high order
|
// the supernodes on the hyperarc are in sorted low-high order
|
||||||
indexType lowSupernode = contourTree.hypernodes[hyperparent];
|
indexType lowSupernode = contourTree.Hypernodes[hyperparent];
|
||||||
indexType highSupernode;
|
indexType highSupernode;
|
||||||
// if it's at the right hand end, take the last supernode in the array
|
// 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)
|
||||||
highSupernode = contourTree.supernodes.size() - 1;
|
highSupernode = contourTree.Supernodes.size() - 1;
|
||||||
// otherwise, take the supernode just before the next hypernode
|
// otherwise, take the supernode just before the next hypernode
|
||||||
else
|
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
|
// now, the high supernode may be lower than the element, because the node belongs
|
||||||
// between it and the high end of the hyperarc
|
// between it and the high end of the hyperarc
|
||||||
if (contourTree.supernodes[highSupernode] < node)
|
if (contourTree.Supernodes[highSupernode] < node)
|
||||||
contourTree.superparents[node] = highSupernode;
|
contourTree.Superparents[node] = highSupernode;
|
||||||
// otherwise, we do a binary search of the superarcs
|
// otherwise, we do a binary search of the superarcs
|
||||||
else
|
else
|
||||||
{ // node between high & low
|
{ // node between high & low
|
||||||
@ -684,35 +684,35 @@ public:
|
|||||||
// find the midway supernode
|
// find the midway supernode
|
||||||
indexType midSupernode = (lowSupernode + highSupernode) / 2;
|
indexType midSupernode = (lowSupernode + highSupernode) / 2;
|
||||||
// test against the node
|
// test against the node
|
||||||
if (contourTree.supernodes[midSupernode] > node)
|
if (contourTree.Supernodes[midSupernode] > node)
|
||||||
highSupernode = midSupernode;
|
highSupernode = midSupernode;
|
||||||
// == can't happen since node is regular
|
// == can't happen since node is regular
|
||||||
else
|
else
|
||||||
lowSupernode = midSupernode;
|
lowSupernode = midSupernode;
|
||||||
} // binary search
|
} // binary search
|
||||||
// now we can use the low node as the superparent
|
// now we can use the low node as the superparent
|
||||||
contourTree.superparents[node] = lowSupernode;
|
contourTree.Superparents[node] = lowSupernode;
|
||||||
} // node between high & low
|
} // node between high & low
|
||||||
} // ascending hyperarc
|
} // ascending hyperarc
|
||||||
else
|
else
|
||||||
{ // descending hyperarc
|
{ // descending hyperarc
|
||||||
// the supernodes on the hyperarc are in sorted high-low order
|
// the Supernodes on the hyperarc are in sorted high-low order
|
||||||
indexType highSupernode = contourTree.hypernodes[hyperparent];
|
indexType highSupernode = contourTree.Hypernodes[hyperparent];
|
||||||
indexType lowSupernode;
|
indexType lowSupernode;
|
||||||
// if it's at the right hand end, take the last supernode in the array
|
// 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
|
{ // last hyperarc
|
||||||
lowSupernode = contourTree.supernodes.size() - 1;
|
lowSupernode = contourTree.Supernodes.size() - 1;
|
||||||
} // last hyperarc
|
} // last hyperarc
|
||||||
// otherwise, take the supernode just before the next hypernode
|
// otherwise, take the supernode just before the next hypernode
|
||||||
else
|
else
|
||||||
{ // other hyperarc
|
{ // other hyperarc
|
||||||
lowSupernode = contourTree.hypernodes[MaskedIndex(hyperparent) + 1] - 1;
|
lowSupernode = contourTree.Hypernodes[MaskedIndex(hyperparent) + 1] - 1;
|
||||||
} // other hyperarc
|
} // other hyperarc
|
||||||
// now, the low supernode may be higher than the element, because the node belongs
|
// now, the low supernode may be higher than the element, because the node belongs
|
||||||
// between it and the low end of the hyperarc
|
// between it and the low end of the hyperarc
|
||||||
if (contourTree.supernodes[lowSupernode] > node)
|
if (contourTree.Supernodes[lowSupernode] > node)
|
||||||
contourTree.superparents[node] = lowSupernode;
|
contourTree.Superparents[node] = lowSupernode;
|
||||||
// otherwise, we do a binary search of the superarcs
|
// otherwise, we do a binary search of the superarcs
|
||||||
else
|
else
|
||||||
{ // node between low & high
|
{ // node between low & high
|
||||||
@ -722,14 +722,14 @@ public:
|
|||||||
// find the midway supernode
|
// find the midway supernode
|
||||||
indexType midSupernode = (highSupernode + lowSupernode) / 2;
|
indexType midSupernode = (highSupernode + lowSupernode) / 2;
|
||||||
// test against the node
|
// test against the node
|
||||||
if (contourTree.supernodes[midSupernode] > node)
|
if (contourTree.Supernodes[midSupernode] > node)
|
||||||
highSupernode = midSupernode;
|
highSupernode = midSupernode;
|
||||||
// == can't happen since node is regular
|
// == can't happen since node is regular
|
||||||
else
|
else
|
||||||
lowSupernode = midSupernode;
|
lowSupernode = midSupernode;
|
||||||
} // binary search
|
} // binary search
|
||||||
// now we can use the high node as the superparent
|
// now we can use the high node as the superparent
|
||||||
contourTree.superparents[node] = highSupernode;
|
contourTree.Superparents[node] = highSupernode;
|
||||||
} // node between low & high
|
} // node between low & high
|
||||||
} // descending hyperarc
|
} // descending hyperarc
|
||||||
} // regular nodes only
|
} // regular nodes only
|
||||||
|
@ -77,7 +77,7 @@ public:
|
|||||||
typedef void ExecutionSignature(_1, InputIndex, _2, _3, _4, _5);
|
typedef void ExecutionSignature(_1, InputIndex, _2, _3, _4, _5);
|
||||||
using InputDomain = _1;
|
using InputDomain = _1;
|
||||||
|
|
||||||
vtkm::Id NumArcs; // contourTree.arcs.GetNumberOfValues()
|
vtkm::Id NumArcs; // contourTree.Arcs.GetNumberOfValues()
|
||||||
|
|
||||||
// Default Constructor
|
// Default Constructor
|
||||||
VTKM_EXEC_CONT
|
VTKM_EXEC_CONT
|
||||||
@ -138,19 +138,19 @@ public:
|
|||||||
|
|
||||||
// In serial this worklet implements the following operation
|
// 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
|
{ // per node
|
||||||
// convert arcSorter to node ID
|
// convert arcSorter to node ID
|
||||||
vtkm::Id nodeID = arcSorter[sortedNode];
|
vtkm::Id nodeID = arcSorter[sortedNode];
|
||||||
vtkm::Id superparent = contourTree.superparents[nodeID];
|
vtkm::Id superparent = contourTree.Superparents[nodeID];
|
||||||
|
|
||||||
// the end element is always the last
|
// the end element is always the last
|
||||||
bool isLastOnSuperarc = false;
|
bool isLastOnSuperarc = false;
|
||||||
if (sortedNode == contourTree.arcs.size()-1)
|
if (sortedNode == contourTree.Arcs.size()-1)
|
||||||
isLastOnSuperarc = true;
|
isLastOnSuperarc = true;
|
||||||
// otherwise look for a change in the superparent
|
// otherwise look for a change in the superparent
|
||||||
else
|
else
|
||||||
isLastOnSuperarc = (superparent != contourTree.superparents[arcSorter[sortedNode + 1]]);
|
isLastOnSuperarc = (superparent != contourTree.Superparents[arcSorter[sortedNode + 1]]);
|
||||||
|
|
||||||
// if it's the last on the superarc
|
// if it's the last on the superarc
|
||||||
if (isLastOnSuperarc)
|
if (isLastOnSuperarc)
|
||||||
@ -159,14 +159,14 @@ public:
|
|||||||
vtkm::Id superarcEnd = contourTree.superarcs[superparent];
|
vtkm::Id superarcEnd = contourTree.superarcs[superparent];
|
||||||
// this only happens for the root of the tree, but is still needed
|
// this only happens for the root of the tree, but is still needed
|
||||||
if (NoSuchElement(superarcEnd))
|
if (NoSuchElement(superarcEnd))
|
||||||
contourTree.arcs[nodeID] = NO_SUCH_ELEMENT;
|
contourTree.Arcs[nodeID] = NO_SUCH_ELEMENT;
|
||||||
else
|
else
|
||||||
contourTree.arcs[nodeID] = contourTree.supernodes[MaskedIndex(superarcEnd)] | (superarcEnd & IS_ASCENDING);
|
contourTree.Arcs[nodeID] = contourTree.Supernodes[MaskedIndex(superarcEnd)] | (superarcEnd & IS_ASCENDING);
|
||||||
} // last on superarc
|
} // last on superarc
|
||||||
else
|
else
|
||||||
{ // not last on superarc
|
{ // not last on superarc
|
||||||
vtkm::Id neighbour = arcSorter[sortedNode+1];
|
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
|
} // not last on superarc
|
||||||
|
|
||||||
} // per node
|
} // per node
|
||||||
@ -189,7 +189,7 @@ public:
|
|||||||
typedef void ExecutionSignature(_1, InputIndex, _2, _3, _4, _5, _6);
|
typedef void ExecutionSignature(_1, InputIndex, _2, _3, _4, _5, _6);
|
||||||
using InputDomain = _1;
|
using InputDomain = _1;
|
||||||
|
|
||||||
vtkm::Id NumArcs; // contourTree.arcs.GetNumberOfValues()
|
vtkm::Id NumArcs; // contourTree.Arcs.GetNumberOfValues()
|
||||||
|
|
||||||
// Default Constructor
|
// Default Constructor
|
||||||
VTKM_EXEC_CONT
|
VTKM_EXEC_CONT
|
||||||
|
@ -82,8 +82,8 @@ public:
|
|||||||
VTKM_CONT
|
VTKM_CONT
|
||||||
ContourTreeNodeComparatorImpl(const IdArrayType& superparents, const IdArrayType& superarcs)
|
ContourTreeNodeComparatorImpl(const IdArrayType& superparents, const IdArrayType& superarcs)
|
||||||
{
|
{
|
||||||
SuperparentsPortal = superparents.PrepareForInput(DeviceAdapter());
|
this->SuperparentsPortal = superparents.PrepareForInput(DeviceAdapter());
|
||||||
SuperarcsPortal = superarcs.PrepareForInput(DeviceAdapter());
|
this->SuperarcsPortal = superarcs.PrepareForInput(DeviceAdapter());
|
||||||
}
|
}
|
||||||
|
|
||||||
// () operator - gets called to do comparison
|
// () operator - gets called to do comparison
|
||||||
@ -91,8 +91,8 @@ public:
|
|||||||
bool operator()(const vtkm::Id& leftNode, const vtkm::Id& rightNode) const
|
bool operator()(const vtkm::Id& leftNode, const vtkm::Id& rightNode) const
|
||||||
{ // operator()
|
{ // operator()
|
||||||
// first compare the left & right superparents
|
// first compare the left & right superparents
|
||||||
vtkm::Id leftSuperparent = SuperparentsPortal.Get(leftNode);
|
vtkm::Id leftSuperparent = this->SuperparentsPortal.Get(leftNode);
|
||||||
vtkm::Id rightSuperparent = SuperparentsPortal.Get(rightNode);
|
vtkm::Id rightSuperparent = this->SuperparentsPortal.Get(rightNode);
|
||||||
if (leftSuperparent < rightSuperparent)
|
if (leftSuperparent < rightSuperparent)
|
||||||
return true;
|
return true;
|
||||||
else if (leftSuperparent > rightSuperparent)
|
else if (leftSuperparent > rightSuperparent)
|
||||||
@ -100,7 +100,7 @@ public:
|
|||||||
|
|
||||||
// the parents are equal, so we compare the nodes, which are sort indices & indicate value
|
// 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
|
// 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)
|
if (leftNode < rightNode)
|
||||||
return isAscendingSuperarc;
|
return isAscendingSuperarc;
|
||||||
else if (leftNode > rightNode)
|
else if (leftNode > rightNode)
|
||||||
|
@ -85,7 +85,7 @@ public:
|
|||||||
const IdArrayType& supernodes,
|
const IdArrayType& supernodes,
|
||||||
const IdArrayType& whenTransferred)
|
const IdArrayType& whenTransferred)
|
||||||
{
|
{
|
||||||
HyperparentsPortal = hyperparents.PrepareForInput(DeviceAdapter());
|
this->HyperparentsPortal = hyperparents.PrepareForInput(DeviceAdapter());
|
||||||
SupernodesPortal = supernodes.PrepareForInput(DeviceAdapter());
|
SupernodesPortal = supernodes.PrepareForInput(DeviceAdapter());
|
||||||
WhenTransferredPortal = whenTransferred.PrepareForInput(DeviceAdapter());
|
WhenTransferredPortal = whenTransferred.PrepareForInput(DeviceAdapter());
|
||||||
}
|
}
|
||||||
@ -103,8 +103,8 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// next compare the left & right hyperparents
|
// next compare the left & right hyperparents
|
||||||
vtkm::Id leftHyperparent = HyperparentsPortal.Get(MaskedIndex(leftComparand));
|
vtkm::Id leftHyperparent = this->HyperparentsPortal.Get(MaskedIndex(leftComparand));
|
||||||
vtkm::Id rightHyperparent = HyperparentsPortal.Get(MaskedIndex(rightComparand));
|
vtkm::Id rightHyperparent = this->HyperparentsPortal.Get(MaskedIndex(rightComparand));
|
||||||
if (MaskedIndex(leftHyperparent) < MaskedIndex(rightHyperparent))
|
if (MaskedIndex(leftHyperparent) < MaskedIndex(rightHyperparent))
|
||||||
return true;
|
return true;
|
||||||
if (MaskedIndex(leftHyperparent) > MaskedIndex(rightHyperparent))
|
if (MaskedIndex(leftHyperparent) > MaskedIndex(rightHyperparent))
|
||||||
|
@ -89,7 +89,7 @@ public:
|
|||||||
VTKM_CONT
|
VTKM_CONT
|
||||||
ArcComparatorImpl(const IdArrayType& ct_arcs)
|
ArcComparatorImpl(const IdArrayType& ct_arcs)
|
||||||
{ // constructor
|
{ // constructor
|
||||||
ArcsPortal = ct_arcs.PrepareForInput(DeviceAdapter());
|
this->ArcsPortal = ct_arcs.PrepareForInput(DeviceAdapter());
|
||||||
} // constructor
|
} // constructor
|
||||||
|
|
||||||
// () operator - gets called to do comparison
|
// () 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);
|
ExecutionSignature(InputIndex, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14);
|
||||||
using InputDomain = _1;
|
using InputDomain = _1;
|
||||||
|
|
||||||
vtkm::Id numHypernodes; // contourTree.hypernodes.GetNumberOfValues()
|
vtkm::Id numHypernodes; // contourTree.Hypernodes.GetNumberOfValues()
|
||||||
vtkm::Id numSupernodes; // contourTree.supernodes.GetNumberOfValues()
|
vtkm::Id numSupernodes; // contourTree.Supernodes.GetNumberOfValues()
|
||||||
|
|
||||||
// Default Constructor
|
// Default Constructor
|
||||||
VTKM_EXEC_CONT
|
VTKM_EXEC_CONT
|
||||||
|
@ -74,14 +74,14 @@ class SuperNodeBranchComparatorImpl
|
|||||||
public:
|
public:
|
||||||
using IdPortalType =
|
using IdPortalType =
|
||||||
typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<DeviceAdapter>::PortalConst;
|
typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<DeviceAdapter>::PortalConst;
|
||||||
IdPortalType whichBranchPortal;
|
IdPortalType WhichBranchPortal;
|
||||||
IdPortalType supernodesPortal;
|
IdPortalType SupernodesPortal;
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
SuperNodeBranchComparatorImpl(const IdArrayType& WhichBranch, const IdArrayType& Supernodes)
|
SuperNodeBranchComparatorImpl(const IdArrayType& WhichBranch, const IdArrayType& supernodes)
|
||||||
{ // constructor
|
{ // constructor
|
||||||
whichBranchPortal = WhichBranch.PrepareForInput(DeviceAdapter());
|
WhichBranchPortal = WhichBranch.PrepareForInput(DeviceAdapter());
|
||||||
supernodesPortal = Supernodes.PrepareForInput(DeviceAdapter());
|
SupernodesPortal = supernodes.PrepareForInput(DeviceAdapter());
|
||||||
} // constructor
|
} // constructor
|
||||||
|
|
||||||
// () operator - gets called to do comparison
|
// () operator - gets called to do comparison
|
||||||
@ -89,8 +89,8 @@ public:
|
|||||||
bool operator()(const vtkm::Id& i, const vtkm::Id& j) const
|
bool operator()(const vtkm::Id& i, const vtkm::Id& j) const
|
||||||
{ // operator()
|
{ // operator()
|
||||||
// retrieve which branch the supernodes are on
|
// retrieve which branch the supernodes are on
|
||||||
vtkm::Id branchI = MaskedIndex(whichBranchPortal.Get(i));
|
vtkm::Id branchI = MaskedIndex(WhichBranchPortal.Get(i));
|
||||||
vtkm::Id branchJ = MaskedIndex(whichBranchPortal.Get(j));
|
vtkm::Id branchJ = MaskedIndex(WhichBranchPortal.Get(j));
|
||||||
|
|
||||||
// and test them
|
// and test them
|
||||||
if (branchI < branchJ)
|
if (branchI < branchJ)
|
||||||
@ -99,8 +99,8 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// now fall back on regular ID
|
// now fall back on regular ID
|
||||||
vtkm::Id regularI = supernodesPortal.Get(i);
|
vtkm::Id regularI = this->SupernodesPortal.Get(i);
|
||||||
vtkm::Id regularJ = supernodesPortal.Get(j);
|
vtkm::Id regularJ = this->SupernodesPortal.Get(j);
|
||||||
|
|
||||||
if (regularI < regularJ)
|
if (regularI < regularJ)
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user