Go to the documentation of this file.
53 #ifndef vtk_m_worklet_contourtree_augmented_activegraph_h
54 #define vtk_m_worklet_contourtree_augmented_activegraph_h
112 namespace contourtree_augmented
119 template <
typename T,
typename S>
175 template <
class Mesh>
225 void DebugPrint(
const char* message,
const char* fileName,
long lineNum);
233 , IsJoinGraph(isJoinGraph)
243 template <
class Mesh>
258 neighbourhoodMasks.
Allocate(mesh.NumVertices);
260 outDegrees.
Allocate(mesh.NumVertices);
263 mesh.SetPrepareForExecutionBehavior(this->
IsJoinGraph);
268 this->
Invoke(initNeighMasksAndOutDegWorklet,
292 auto oneIfCriticalArrayHandle =
310 activeIndices.
Allocate(mesh.NumVertices);
316 this->
Invoke(initActiveGraphVerticesWorklet,
344 this->
Invoke(initActiveEdgesWorklet,
358 this->
Invoke(initEdgeFarWorklet, this->
EdgeFar, extrema, activeIndices);
360 DebugPrint(
"Active Graph Started", __FILE__, __LINE__);
378 DebugPrint(
"Active Graph Computation Starting", __FILE__, __LINE__);
430 DebugPrint(
"Merge Tree Computed", __FILE__, __LINE__);
448 this->
Invoke(transferOutDegree,
477 this->
Invoke(updateEdgeSorterWorklet,
485 DebugPrint(
"Saddle Starts Transferred", __FILE__, __LINE__);
503 this->
Invoke(findGovSaddlesWorklet,
511 DebugPrint(
"Governing Saddles Set", __FILE__, __LINE__);
522 DebugPrint(
"Regular Points Should Now Be Labelled", __FILE__, __LINE__);
545 DebugPrint(
"Active Vertex List Compacted", __FILE__, __LINE__);
558 newOutdegree.
Allocate(nActiveVertices);
562 this->
Invoke(computeNewOutdegreeWorklet,
594 this->
Invoke(transferActiveEdgesWorklet,
615 DebugPrint(
"Active Edges Now Compacted", __FILE__, __LINE__);
630 for (
vtkm::Id logStep = 0; logStep < numLogSteps; logStep++)
635 DebugPrint(
"Chains Built", __FILE__, __LINE__);
646 DebugPrint(
"Trunk Built", __FILE__, __LINE__);
707 this->
Invoke(findSuperAndHyperNodesWorklet,
710 newHypernodePosition,
711 newSupernodePosition,
716 DebugPrint(
"Super/Hypernodes Found", __FILE__, __LINE__);
717 tree.
DebugPrint(
"Super/Hypernodes Found", __FILE__, __LINE__);
735 tree.
DebugPrint(
"Hyperparents Set", __FILE__, __LINE__);
742 PermutedIdArrayType permutedSuperID(tree.
Supernodes, this->SuperID);
763 DebugPrint(
"Supernodes Sorted", __FILE__, __LINE__);
764 tree.
DebugPrint(
"Supernodes Sorted", __FILE__, __LINE__);
775 this->
Invoke(setTreeSuperarcsWorklet,
786 PermutedIdArrayType permuteGlobalIndex(tree.
Supernodes, this->GlobalIndex);
790 PermutedIdArrayType permuteHyperID(tree.
Hyperparents, this->HyperID);
793 tree.
DebugPrint(
"Superarcs Set", __FILE__, __LINE__);
813 DebugPrint(
"Hyperarcs Set", __FILE__, __LINE__);
814 tree.
DebugPrint(
"Hyperarcs Set", __FILE__, __LINE__);
828 this->
Invoke(setSuperAndHypernodeArcsWorklet,
835 DebugPrint(
"Sliding Arcs Set", __FILE__, __LINE__);
836 tree.
DebugPrint(
"Sliding Arcs Set", __FILE__, __LINE__);
841 this->
Invoke(slideVerticesWorklet,
848 tree.
DebugPrint(
"Sliding Finished", __FILE__, __LINE__);
855 tree.
DebugPrint(
"Superparents Set", __FILE__, __LINE__);
869 this->
Invoke(connectNodesWorklet,
876 tree.
DebugPrint(
"Arcs Set", __FILE__, __LINE__);
920 std::cout <<
"------------------------------------------------------" << std::endl;
921 std::cout << std::setw(30) << std::left << fileName <<
":" << std::right << std::setw(4)
922 << lineNum << std::endl;
923 std::cout << std::left << std::string(message) << std::endl;
924 std::cout <<
"Active Graph Contains: " << std::endl;
925 std::cout <<
"------------------------------------------------------" << std::endl;
927 std::cout <<
"Is Join Graph? " << (this->
IsJoinGraph ?
"T" :
"F") << std::endl;
928 std::cout <<
"NumIterations " << this->
NumIterations << std::endl;
929 std::cout <<
"nSupernodes " << this->
NumSupernodes << std::endl;
930 std::cout <<
"nHypernodes " << this->
NumHypernodes << std::endl;
941 std::cout << std::endl;
960 std::cout << std::endl;
973 std::cout << std::endl;
986 std::cout << std::endl;
998 std::cout << std::endl;
1000 std::cout <<
"---------------------------" << std::endl;
1001 std::cout << std::endl;
void FindGoverningSaddles()
Definition: ActiveGraph.h:490
bool IsJoinGraph
Definition: ActiveGraph.h:129
Definition: ArrayTransforms.h:144
void AllocateEdgeArrays(vtkm::Id nElems)
Definition: ActiveGraph.h:891
VTKM_CONT vtkm::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:448
IdArrayType EdgeSorter
Definition: ActiveGraph.h:159
void ReleaseTemporaryArrays()
Definition: ActiveGraph.h:900
Groups connected points that have the same field value.
Definition: Atomic.h:19
IdArrayType SuperID
Definition: ActiveGraph.h:162
IdArrayType Arcs
Definition: augmented/MergeTree.h:88
IdArrayType ActiveVertices
Definition: ActiveGraph.h:155
Definition: FindGoverningSaddlesWorklet.h:72
IdArrayType Outdegree
Definition: ActiveGraph.h:146
VTKM_CONT void Allocate(vtkm::Id numberOfValues, vtkm::CopyFlag preserve, vtkm::cont::Token &token) const
Allocates an array large enough to hold the given number of values.
Definition: ArrayHandle.h:465
void CompactActiveVertices()
Definition: ActiveGraph.h:527
IdArrayType Hyperarcs
Definition: ActiveGraph.h:140
Definition: FindSuperAndHyperNodesWorklet.h:69
void AllocateVertexArrays(vtkm::Id nElems)
Definition: ActiveGraph.h:881
IdArrayType Pits
Definition: MeshExtrema.h:85
static VTKM_CONT void Sort(vtkm::cont::DeviceAdapterId devId, vtkm::cont::ArrayHandle< T, Storage > &values)
Definition: Algorithm.h:965
Definition: SetHyperArcsWorklet.h:69
vtkm::cont::ArrayHandleConstant< T > make_ArrayHandleConstant(T value, vtkm::Id numberOfValues)
make_ArrayHandleConstant is convenience function to generate an ArrayHandleImplicit.
Definition: ArrayHandleConstant.h:89
Definition: MeshExtrema.h:79
void SetSuperArcs(MergeTree &tree)
Definition: ActiveGraph.h:722
Definition: SetArcsConnectNodes.h:69
VTKM_CONT T ArrayGetValue(vtkm::Id id, const vtkm::cont::ArrayHandle< T, S > &data)
Obtain a small set of values from an ArrayHandle with minimal device transfers.
Definition: ArrayGetValues.h:264
void BuildTrunk()
Definition: ActiveGraph.h:640
Definition: InitializeActiveGraphVertices.h:70
static VTKM_CONT bool Copy(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< U, COut > &output)
Definition: Algorithm.h:410
IdArrayType HyperID
Definition: ActiveGraph.h:163
IdArrayType Supernodes
Definition: augmented/MergeTree.h:98
static T GetLastValue(const vtkm::cont::ArrayHandle< T, S > &ah)
Definition: ActiveGraph.h:120
void DebugPrint(const char *message, const char *fileName, long lineNum)
Definition: ActiveGraph.h:917
void TransferRegularPoints()
Definition: ActiveGraph.h:516
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
Definition: SetSuperArcsSetTreeSuperarcs.h:69
Definition: BuildChainsWorklet.h:65
IdArrayType EdgeNear
Definition: ActiveGraph.h:152
IdArrayType GlobalIndex
Definition: ActiveGraph.h:137
void FindSuperAndHyperNodes(MergeTree &tree)
Definition: ActiveGraph.h:651
bool IsJoinTree
Definition: augmented/MergeTree.h:81
This class is thrown when VTKm detects an internal state that should never be reached.
Definition: ErrorInternal.h:26
Definition: TransferSaddleStartsSetNewOutdegreeForSaddles.h:72
ActiveGraph(bool IsJoinGraph)
Definition: ActiveGraph.h:231
Definition: SetSuperArcsSetTreeHyperparents.h:69
Definition: TransferSaddleStartsResetEdgeFar.h:71
IdArrayType Hyperarcs
Definition: augmented/MergeTree.h:115
Definition: SuperArcNodeComparator.h:119
IdArrayType ActiveEdges
Definition: ActiveGraph.h:156
void DebugPrint(const char *message, const char *fileName, long lineNum)
Definition: augmented/MergeTree.h:168
IdArrayType Hypernodes
Definition: augmented/MergeTree.h:110
static VTKM_CONT T ScanExclusive(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:816
Implicitly permutes the values in an array.
Definition: ArrayHandlePermutation.h:227
Allows launching any worklet without a dispatcher.
Definition: Invoker.h:41
static VTKM_CONT void CopyIf(vtkm::cont::DeviceAdapterId devId, const vtkm::cont::ArrayHandle< T, CIn > &input, const vtkm::cont::ArrayHandle< U, CStencil > &stencil, vtkm::cont::ArrayHandle< T, COut > &output)
Definition: Algorithm.h:435
void SetArcs(MergeTree &tree, MeshExtrema &meshExtrema)
Definition: ActiveGraph.h:819
Definition: HyperArcSuperNodeComparator.h:119
IdArrayType FirstEdge
Definition: ActiveGraph.h:143
Definition: CompactActiveEdgesTransferActiveEdges.h:70
An array handle with a constant value.
Definition: ArrayHandleConstant.h:63
void SetHyperArcs(MergeTree &tree)
Definition: ActiveGraph.h:798
IdArrayType Superarcs
Definition: augmented/MergeTree.h:102
Definition: ArrayTransforms.h:134
Definition: TransferRegularPointsWorklet.h:72
void CompactActiveEdges()
Definition: ActiveGraph.h:550
Definition: TransferSaddleStartsUpdateEdgeSorter.h:71
IdArrayType Superparents
Definition: augmented/MergeTree.h:91
VTKM_CONT vtkm::cont::ArrayHandlePermutation< IndexArrayHandleType, ValueArrayHandleType > make_ArrayHandlePermutation(IndexArrayHandleType indexArray, ValueArrayHandleType valueArray)
make_ArrayHandleTransform is convenience function to generate an ArrayHandleTransform.
Definition: ArrayHandlePermutation.h:279
Definition: augmented/MergeTree.h:77
vtkm::cont::Invoker Invoke
Definition: ActiveGraph.h:126
Definition: CompactActiveEdgesComputeNewVertexOutdegree.h:71
void TransferSaddleStarts()
Definition: ActiveGraph.h:435
Definition: BuildChainsWorklet.h:69
IdArrayType EdgeFar
Definition: ActiveGraph.h:151
void PrintIndices(std::string label, const vtkm::cont::ArrayHandle< T > &iVec, vtkm::Id nIndices=-1, std::ostream &outStream=std::cout)
Definition: augmented/PrintVectors.h:253
void PrintHeader(vtkm::Id howMany, std::ostream &outStream=std::cout)
Definition: augmented/PrintVectors.h:151
Definition: InitializeActiveEdges.h:72
void Initialise(Mesh &mesh, const MeshExtrema &meshExtrema)
Definition: ActiveGraph.h:244
vtkm::Id NumSupernodes
Definition: ActiveGraph.h:166
vtkm::Id NumIterations
Definition: ActiveGraph.h:132
vtkm::Id NumHypernodes
Definition: ActiveGraph.h:167
Definition: ActiveGraph.h:116
void MakeMergeTree(MergeTree &tree, MeshExtrema &meshExtrema)
Definition: ActiveGraph.h:376
Definition: BuildTrunkWorklet.h:70
IdArrayType Hyperparents
Definition: augmented/MergeTree.h:105
Definition: InitializeNeighbourhoodMasksAndOutDegrees.h:69
void BuildChains()
Definition: ActiveGraph.h:621
Definition: InitializeEdgeFarFromActiveIndices.h:72
IdArrayType FirstSuperchild
Definition: augmented/MergeTree.h:118
Definition: ArrayTransforms.h:124
VTKM_CONT void ReleaseResources() const
Releases all resources in both the control and execution environments.
Definition: ArrayHandle.h:559
constexpr vtkm::Id NO_SUCH_ELEMENT
Definition: filter/scalar_topology/worklet/contourtree_augmented/Types.h:73
IdArrayType Peaks
Definition: MeshExtrema.h:84
Definition: augmented/activegraph/EdgePeakComparator.h:141
Definition: SetArcsSlideVertices.h:69
Definition: SetArcsSetSuperAndHypernodeArcs.h:69
Definition: InitializeHyperarcsFromActiveIndices.h:71
An implicit array handle containing the its own indices.
Definition: ArrayHandleIndex.h:54