VTK-m  2.0
PrintGraph.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 // Copyright (c) 2018, The Regents of the University of California, through
11 // Lawrence Berkeley National Laboratory (subject to receipt of any required approvals
12 // from the U.S. Dept. of Energy). All rights reserved.
13 //
14 // Redistribution and use in source and binary forms, with or without modification,
15 // are permitted provided that the following conditions are met:
16 //
17 // (1) Redistributions of source code must retain the above copyright notice, this
18 // list of conditions and the following disclaimer.
19 //
20 // (2) Redistributions in binary form must reproduce the above copyright notice,
21 // this list of conditions and the following disclaimer in the documentation
22 // and/or other materials provided with the distribution.
23 //
24 // (3) Neither the name of the University of California, Lawrence Berkeley National
25 // Laboratory, U.S. Dept. of Energy nor the names of its contributors may be
26 // used to endorse or promote products derived from this software without
27 // specific prior written permission.
28 //
29 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
30 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
31 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
32 // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
33 // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34 // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
36 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
37 // OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
38 // OF THE POSSIBILITY OF SUCH DAMAGE.
39 //
40 //=======================================================================================
41 //
42 // Parallel Peak Pruning v. 2.0
43 //
44 // Started June 15, 2017
45 //
46 // Copyright Hamish Carr, University of Leeds
47 //
48 // PrintGraph.h - routines for outputting dot files for debug purposes
49 //
50 //=======================================================================================
51 //
52 // COMMENTS: We have dot output scattered among multiple files, when it is primarily
53 // used for debug. Moreover, our principal data classes are public so that
54 // the algorithmic construction can be separated into factory classes.
55 // So we can collect all of the code for dot output into one place and be
56 // consistent about how we implement it
57 //
58 // We will want dot output for the following classes:
59 // BoundaryTree
60 // ContourTree
61 // ContourTreeMesh
62 // HierarchicalContourTree
63 // InteriorForest / InteriorForest
64 //
65 // In addition, it may be useful to be able to print out:
66 // MergeTree
67 //
68 // but as of the time of writing (30/07/2020) it is not priority for debug
69 //
70 // Factory classes will typically have multiple temporary arrays
71 // and will therefore primarily be debugged by printing the arrays
72 //
73 // However, since these classes are often indexed on our the main data classes
74 // we should also have a version of the graph output that shows a designated
75 // piece of text on each node
76 //
77 // The general design (initially) will be to produce all-purpose illustrations
78 // While these will probably be overkill, experience shows that confusion between
79 // the different indices is common, so it is better to be absolutely explicit
80 // and print out every piece of information possible in the graph.
81 // However, for the ContourTree and HierarchicalContourTree, we also want to have
82 // the option to show regular / super / hyper structure separately.
83 //
84 // NOTE ON CONST USAGE:
85 // I had originally planned to use NULL vectors for parameters not being passed
86 // but the compiler doesn't like the possibility of non-const temporary parameters
87 // so the flags arrays must be const.
88 // If I do the same with Mesh & ContourTree, I need to set functions elsewhere to
89 // be const. I will not do that unilaterally.
90 // All parameters of these print functions should on principal be const, except
91 // the stream parameter
92 //
93 //=======================================================================================
94 
95 #ifndef vtk_m_worklet_contourtree_distributed_print_graph_h
96 #define vtk_m_worklet_contourtree_distributed_print_graph_h
97 
98 #include <vtkm/Types.h>
99 #include <vtkm/cont/Algorithm.h>
106 
107 namespace vtkm
108 {
109 namespace worklet
110 {
111 namespace contourtree_distributed
112 {
113 
119 
120 // Routines to print out a contour tree in regular and super/hyper format
121 // The older code ended up with separate versions depending on mesh type, but there are now
122 // accessor functions, and I will try to avoid this. However, this means templating everything
123 // to do with contour trees
124 
125 // Routines for contour trees:
126 // 1. Routine to print super structure
127 // generic, with colour set according to iteration
128 // with option to print grey / white for boundary / interior nodes (regular tree only)
129 // with option to show BoundaryTree / Forest as different styles (super tree only)
130 // with option to show an arbitrary additional value passed as an array
131 
132 // Routines for ContourTreeMesh:
133 // 2. Simple routine to dump out nodes / edges for cross-checking
134 // no options should be needed
135 
136 // Routines for BoundaryTree:
137 // 3. All purpose routine to dump out the contents for comparison with contour tree
138 // Includes option to show how the InteriorForest connects to it
139 
140 // Routines for HierarchicalContourTree:
141 // 4. Routine to print regular/super/hyper structure with similar options to contour tree
142 
143 // Routines for contour trees:
144 // 1. Routine to print super structure
145 // generic, with colour set according to iteration
146 // with option to print grey / white for boundary / interior nodes (regular tree only)
147 // with option to show BoundaryTree / Forest as different styles (super tree only)
148 // with option to show an arbitrary additional value passed as an array
149 
150 constexpr vtkm::Id INDEX_WIDTH = 6;
151 
159 
161 constexpr vtkm::Id NODE_TYPE_SUPER = 1;
162 constexpr vtkm::Id NODE_TYPE_HYPER = 2;
163 
164 // bitflags for various components
165 constexpr vtkm::Id SHOW_REGULAR_STRUCTURE = 0x00000001;
166 constexpr vtkm::Id SHOW_SUPER_STRUCTURE = 0x00000002;
167 constexpr vtkm::Id SHOW_HYPER_STRUCTURE = 0x00000004;
168 
169 constexpr vtkm::Id SHOW_BOUNDARY_NODES = 0x00000010;
170 constexpr vtkm::Id SHOW_CRITICAL_BOUNDARY_NODES = 0x00000020;
171 constexpr vtkm::Id SHOW_NECESSARY_SUPERNODES = 0x00000040;
172 
173 constexpr vtkm::Id SHOW_GLOBAL_ID = 0x00000100;
174 constexpr vtkm::Id SHOW_DATA_VALUE = 0x00000200;
175 constexpr vtkm::Id SHOW_MESH_REGULAR_ID = 0x00000400;
176 constexpr vtkm::Id SHOW_MESH_SORT_ID = 0x00000800;
177 
178 constexpr vtkm::Id SHOW_NODE_ID = 0x00001000;
179 constexpr vtkm::Id SHOW_SUPERPARENT = 0x00002000;
180 constexpr vtkm::Id SHOW_ARC_ID = 0x00004000;
181 constexpr vtkm::Id SHOW_EXTRA_DATA = 0x00008000;
182 
183 constexpr vtkm::Id SHOW_SUPERNODE_ID = 0x00010000;
184 constexpr vtkm::Id SHOW_HYPERPARENT = 0x00020000;
185 constexpr vtkm::Id SHOW_SUPERARC_ID = 0x0004000;
186 constexpr vtkm::Id SHOW_ITERATION = 0x00080000;
187 
188 constexpr vtkm::Id SHOW_HYPERNODE_ID = 0x00100000;
189 constexpr vtkm::Id SHOW_HYPERARC_ID = 0x00200000;
190 
191 // bit flags used for structures other than the contour tree
192 // the BoundaryTree has a vertex index, but doesn't have the contour tree's nodes, so we will reuse that bit flag
194 // others are just relabelling the same ID flag
204 
205 // Similarly, relabel the IDs for use with contour tree meshes
207 // others are just relabelling the same ID flag
213 
214 // InteriorForest is slightly tricky, but wants to be use the same set as BoundaryTree
224 
236 
242 
247 
250 
253 
257 
258 // 1. Routine for printing dot for contour tree regular / super / hyper structure
259 VTKM_CONT
260 template <typename T, typename StorageType, typename MeshType, typename VectorType>
262  const std::string& label, // the label to use as title for the graph
263  MeshType& mesh, // the underlying mesh for the contour tree
265  localToGlobalIdRelabeler, // relabler needed to compute global ids
267  vtkm::worklet::contourtree_augmented::ContourTree& contourTree, // the contour tree itself
268  const vtkm::Id showMask = SHOW_ALL_STANDARD, // mask with flags for what elements to show
269  // const vtkm::worklet::contourtree_augmented::IdArrayType &necessaryFlags = vtkm::worklet::contourtree_augmented::IdArrayType(),
270  // array with flags for "necessary"
271  const VectorType& perNodeValues = VectorType()) // an arbitrary vector of values
272 { // ContourTreeSuperDotGraphPrint()
273  // initialise a string stream to capture the output
274  std::stringstream outStream;
275 
276  // now grab portals to all the variables we will need
277  auto nodesPortal = contourTree.Nodes.ReadPortal();
278  auto arcsPortal = contourTree.Arcs.ReadPortal();
279  auto superparentsPortal = contourTree.Superparents.ReadPortal();
280  auto supernodesPortal = contourTree.Supernodes.ReadPortal();
281  auto superarcsPortal = contourTree.Superarcs.ReadPortal();
282  auto hyperparentsPortal = contourTree.Hyperparents.ReadPortal();
283  auto whenTransferredPortal = contourTree.WhenTransferred.ReadPortal();
284  auto hypernodesPortal = contourTree.Hypernodes.ReadPortal();
285  auto hyperarcsPortal = contourTree.Hyperarcs.ReadPortal();
286  // auto necessaryFlagsPortal = necessaryFlags.ReadPortal();
287  auto perNodeValuesPortal = perNodeValues.ReadPortal();
288 
289  // work out how long the computed value is
291  vtkm::Id perNodeSize = perNodeValues.GetNumberOfValues();
292  if (perNodeSize == 0)
294  else if (perNodeSize == contourTree.Nodes.GetNumberOfValues())
296  else if (perNodeSize == contourTree.Supernodes.GetNumberOfValues())
298  else if (perNodeSize == contourTree.Hypernodes.GetNumberOfValues())
300  else
301  { // error message
302  outStream << "ERROR in ContourTreeDotGraphPrint().\n";
303  outStream << "Per node values array must be empty, or\n";
304  outStream << "Same length as regular nodes ("
306  << contourTree.Nodes.GetNumberOfValues() << "), or\n";
307  outStream << "Same length as super nodes ("
309  << contourTree.Supernodes.GetNumberOfValues() << "), or\n";
310  outStream << "Same length as hyper nodes ("
312  << contourTree.Hypernodes.GetNumberOfValues() << ")\n";
313  outStream << "Actual length was ("
315  << perNodeValues.GetNumberOfValues() << ")\n";
316  } // error message
317 
318  // print the header information
319  outStream << "digraph ContourTree\n\t{\n";
320  outStream << "\tlabel=\"" << std::setw(1) << label << "\"\n\tlabelloc=t\n\tfontsize=30\n";
321  outStream << "\t// Nodes" << std::endl;
322 
323  auto meshSortOrderPortal = mesh.SortOrder.ReadPortal();
324  auto globalIds = mesh.GetGlobalIdsFromSortIndices(contourTree.Nodes, localToGlobalIdRelabeler);
325  auto globalIdsPortal = globalIds.ReadPortal();
326  auto dataValuesPortal = field.ReadPortal();
327 
328  // loop through all of the nodes in the regular list
329  for (vtkm::Id node = 0; node < contourTree.Nodes.GetNumberOfValues(); node++)
330  { // per node
331  // the nodes array is actually sorted by superarc, but the superarcs array is not
332  // so we ignore the nodes array and work directly with the node #
333  vtkm::Id sortID = nodesPortal.Get(node);
334 
335  // retrieve the regular ID
336  vtkm::Id regularID = meshSortOrderPortal.Get(sortID);
337 
338  // retrieve the global ID
339  vtkm::Id globalID = globalIdsPortal.Get(sortID);
340 
341  // retrieve the values
342  auto dataValue = dataValuesPortal.Get(regularID);
343 
344  // retrieve the superparent
345  vtkm::Id superparent = superparentsPortal.Get(sortID);
346 
347  // and retrieve the iteration #
348  vtkm::Id iteration =
349  vtkm::worklet::contourtree_augmented::MaskedIndex(whenTransferredPortal.Get(superparent));
350 
351  // work out the super ID & hyper ID
356 
357  // test for super
358  if (supernodesPortal.Get(superparent) == sortID)
359  { // at least super
360  // set super ID
361  superID = superparent;
362  // set hyperparent
363  hyperparent = hyperparentsPortal.Get(superID);
364  // set nodetype
365  nodeType = NODE_TYPE_SUPER;
366  // test for hyper
367  if (hypernodesPortal.Get(hyperparent) == superID)
368  { // hyper node
369  nodeType = NODE_TYPE_HYPER;
370  hyperID = hyperparent;
371  } // hyper node
372  } // at least super
373 
374  // now, if we don't want the regular nodes, we want to skip them entirely, so
375  bool showNode = false;
376  // regular structure always shows all nodes
378  showNode = true;
379  // super structure shows super & hyper nodes only
384 
385  // if we didn't set the flag, skip the node
386  if (!showNode)
387  continue;
388 
389  // print the vertex ID, which should be the sort ID & needs to be left-justified to work
390  outStream << "\ts" << std::setw(1) << sortID;
391 
392  // print the style characteristics - node is filled and fixed size
393  outStream << " [style=filled,fixedsize=true,fontname=\"Courier\",margin=\"0.02,0.02\"";
394  // specify the style based on the type of node
396  outStream << ",height=\"1.7in\",width=\"1.7in\",penwidth=5";
398  outStream << ",height=\"2.5in\",width=\"2.5in\",penwidth=10";
400  outStream << ",height=\"2.5in\",width=\"2.5in\",penwidth=15";
401 
402  // shape should always be circular.
403  outStream << ",shape=circle";
404 
405  // fill colour is grey for boundary or necessary, if these are passed in
406  bool isGrey = false;
407  // TODO: Add liesOnBoundary and isNecessary so we can define the gray value
408  /*
409  if (showMask & vtkm::worklet::contourtree_distributed::SHOW_BOUNDARY_NODES)
410  isGrey = (showMask & vtkm::worklet::contourtree_distributed::SHOW_REGULAR_STRUCTURE) && mesh.liesOnBoundary(regularID);
411  else if (showMask & vtkm::worklet::contourtree_distributed::SHOW_CRITICAL_BOUNDARY_NODES)
412  isGrey = (showMask & vtkm::worklet::contourtree_distributed::SHOW_REGULAR_STRUCTURE) && mesh.isNecessary(regularID);
413  else if (showMask & vtkm::worklet::contourtree_distributed::SHOW_NECESSARY_SUPERNODES)
414  isGrey = (showMask & vtkm::worklet::contourtree_distributed::SHOW_SUPER_STRUCTURE) // skip if superstructure not shown
415  && !vtkm::worklet::contourtree_augmented::NoSuchElement(superID) // ignore non-super nodes
416  && (necessaryFlags.GetNumberOfValues() == contourTree.Supernodes.GetNumberOfValues()) // skip if necessary flags array is wrong size
417  && necessaryFlagsPortal.Get(superID);
418  */
419  // after setting the flag, its easy
420  outStream << (isGrey ? ",fillcolor=grey" : ",fillcolor=white");
421 
422  // stroke colour depends on iteration
423  outStream << ",color="
426 
427  // start printing the label
428  outStream << ",label=\"";
429  // print the global ID
431  outStream << "g " << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH)
432  << globalID << "\\n";
433  // print the value
435  outStream << "v " << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH)
436  << dataValue << "\\n";
437  // print the regular & sort IDs
439  outStream << "r " << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH)
440  << regularID << "\\n";
442  outStream << "s " << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH) << sortID
443  << "\\n";
444  // and the node ID
446  outStream << "n " << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH) << node
447  << "\\n";
448  // print the superparent
450  outStream << "sp" << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH)
451  << superparent << "\\n";
452 
453  // add arbitrary per node value if it is regular in nature
456  outStream << "x " << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH)
457  << perNodeValuesPortal.Get(regularID) << "\\n";
458 
459  // we now want to add labelling information specific to supernodes, but also present in hypernodes
461  { // at least super
462 
463  // print the super node ID
465  outStream << "SN" << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH)
466  << superID << "\\n";
467 
468  // print the hyperparent as well
470  outStream << "HP" << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH)
471  << hyperparent << "\\n";
473  outStream << "IT" << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH)
474  << iteration << "\\n";
475 
476  // add arbitrary per node value if it is super in nature
479  outStream << "X " << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH)
480  << perNodeValuesPortal.Get(superID) << "\\n";
481  } // at least super
482 
483  // now add even more for hypernodes
485  { // hyper node
487  outStream << "HN" << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH)
488  << hyperID << "\\n";
489 
490  // add arbitrary per node value if it is hyper in nature
493  outStream << "X " << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH)
494  << perNodeValuesPortal.Get(hyperID) << "\\n";
495  } // hyper node
496 
497  outStream << "\"]" << std::endl;
498  } // per node
499 
500  // always show the null node
501  outStream << "\t// Null Node" << std::endl;
502  outStream
503  << "\tNULL "
504  "[style=filled,fixedsize=true,fontname=\"Courier\",margin=\"0.02,0.02\",height=\"0.5in\","
505  "width=\"0.5in\",penwidth=1,shape=circle,fillcolor=white,color=black,label=\"NULL\"]"
506  << std::endl;
507 
508  // start the arcs
509  outStream << "\t// Arcs" << std::endl;
510 
511  // now add regular arcs (if requested)
513  for (vtkm::Id node = 0; node < contourTree.Nodes.GetNumberOfValues(); node++)
514  { // per node
515  // retrieve the "to" end
516  vtkm::Id to = arcsPortal.Get(node);
517 
518  // if "to" is NSE, it's the root node
520  outStream << "\ts" << std::setw(1) << node << " -> NULL [penwidth=2";
521  else
522  { // actual node
523  // mask out the flags to get the target node
525 
526  // since we're using sort IDs, we compare them
527  if (node < to)
528  outStream << "\ts" << std::setw(1) << to << " -> s" << std::setw(1) << node
529  << " [dir=back,penwidth=3";
530  else
531  outStream << "\ts" << std::setw(1) << node << " -> s" << std::setw(1) << to
532  << " [penwidth=3";
533  } // actual node
534 
535  // set the color based on the from vertex
536  // retrieve the superparent
537  vtkm::Id superparent = superparentsPortal.Get(node);
538  vtkm::Id iteration =
539  vtkm::worklet::contourtree_augmented::MaskedIndex(whenTransferredPortal.Get(superparent));
540  outStream << ",color="
543  if (showMask & SHOW_ARC_ID)
544  outStream << ",label=\"A" << node << "\"";
545  outStream << "]" << std::endl;
546  } // per node
547 
548  // show superarcs if requested
550  for (vtkm::Id supernode = 0; supernode < contourTree.Supernodes.GetNumberOfValues();
551  supernode++)
552  { // per supernode
553  // retrieve the sort ID
554  vtkm::Id from = supernodesPortal.Get(supernode);
555 
556  // retrieve the "to" end
557  vtkm::Id toSuper = superarcsPortal.Get(supernode);
558 
559  // test for "NSE"
561  outStream << "\ts" << std::setw(1) << from << " -> NULL [penwidth=4";
562  else
563  { // supernode
564  // mask out the ascending flag & convert to sort ID
565  vtkm::Id to =
566  supernodesPortal.Get(vtkm::worklet::contourtree_augmented::MaskedIndex(toSuper));
567 
568  // now test for ascending with sort IDs as before
569  if (from < to)
570  outStream << "\ts" << std::setw(1) << to << " -> s" << std::setw(1) << from
571  << " [dir=back,penwidth=7";
572  else
573  outStream << "\ts" << std::setw(1) << from << " -> s" << std::setw(1) << to
574  << " [penwidth=7";
575  } // supernode
576 
577  // set the color based on the from vertex
578  vtkm::Id iteration =
579  vtkm::worklet::contourtree_augmented::MaskedIndex(whenTransferredPortal.Get(supernode));
580  outStream << ",color="
584  outStream << ",label=\"SA" << supernode << "\"";
585  outStream << "]" << std::endl;
586  } // per supernode
587 
588  // add hyper arcs if requested
590  for (vtkm::Id hypernode = 0; hypernode < contourTree.Hypernodes.GetNumberOfValues();
591  hypernode++)
592  { // per hypernode
593  // retrieve the sort ID
594  vtkm::Id fromSuper = hypernodesPortal.Get(hypernode);
595  vtkm::Id from = supernodesPortal.Get(fromSuper);
596 
597  // retrieve the "to" end
598  vtkm::Id toSuper = hyperarcsPortal.Get(hypernode);
599 
600  // test for "NSE"
602  outStream << "\ts" << std::setw(1) << from << " -> NULL [penwidth=6";
603  else
604  { // hypernode
605  // mask out the ascending flag & convert to sort ID
606  vtkm::Id to =
607  supernodesPortal.Get(vtkm::worklet::contourtree_augmented::MaskedIndex(toSuper));
608 
609  // now test for ascending with sort IDs as before
610  if (from < to)
611  outStream << "\ts" << std::setw(1) << to << " -> s" << std::setw(1) << from
612  << " [dir=back,penwidth=12";
613  else
614  outStream << "\ts" << std::setw(1) << from << " -> s" << std::setw(1) << to
615  << " [penwidth=12";
616  } // hypernode
617 
618  // set the color based on the from vertex
619  vtkm::Id iteration =
620  vtkm::worklet::contourtree_augmented::MaskedIndex(whenTransferredPortal.Get(fromSuper));
621  outStream << ",color="
625  outStream << ",label=\"HA" << hypernode << "\"";
626  outStream << "]" << std::endl;
627  } // per hypernode
628 
629  // print the footer information
630  outStream << "\t}\n";
631 
632  // now return the string
633  return outStream.str();
634 } // ContourTreeSuperDotGraphPrint()
635 
636 
637 // 2. Simple routine to dump out nodes / edges for cross-checking
638 VTKM_CONT
639 template <typename FieldType>
641  const std::string& label, // the label to use as title for the graph
643  const vtkm::Id showMask = SHOW_CONTOUR_TREE_MESH_ALL) // mask with flags for what elements to show
644 { // ContourTreeMeshDotGraphPrint()
645  // initialise a string stream to capture the output
646  std::stringstream outStream;
647 
648  // now grab portals to all the variables we will need
649  auto globalMeshIndexPortal = mesh.GlobalMeshIndex.ReadPortal();
650  auto meshSortedValuesPortal = mesh.SortedValues.ReadPortal();
651  auto meshNeighborConnectivityPortal = mesh.NeighborConnectivity.ReadPortal();
652  auto meshNeighborOffsetsPortal = mesh.NeighborOffsets.ReadPortal();
653 
654  // print the header information
655  outStream << "digraph ContourTreeMesh\n\t{\n";
656  outStream << "\tlabel=\"" << std::setw(1) << label << "\"\n\tlabelloc=t\n\tfontsize=30\n";
657  outStream << "\t// Nodes" << std::endl;
658 
659  // loop through all vertices
660  for (vtkm::Id vertex = 0; vertex < mesh.GetNumberOfVertices(); vertex++)
661  { // per vertex
662  // work out the various ID's
663  vtkm::Id globalID = globalMeshIndexPortal.Get(vertex);
664  auto dataValue = meshSortedValuesPortal.Get(vertex);
665 
666  // print the vertex
667  outStream << "\tr" << std::setw(1) << vertex;
668  outStream << "[style=filled,fixedsize=true,fontname=\"Courier\",margin=\"0.02,0.02\",height="
669  "\"1.7in\",width=\"1.7in\",penwidth=5,shape=circle";
670  outStream << ",fillcolor=white";
671  outStream << ",label=\"";
673  outStream << "r " << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH) << vertex
674  << "\\n";
676  outStream << "g " << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH)
677  << globalID << "\\n";
679  outStream << "v " << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH)
680  << dataValue << "\\n";
681  outStream << "\"];\n";
682  } // per vertex
683 
684  // now print out the edges
685  for (vtkm::Id vertex = 0; vertex < mesh.NeighborOffsets.GetNumberOfValues(); vertex++)
686  { // per vertex
687  // find iterators for the block of edges for this vertex
688  vtkm::Id neighboursBegin = meshNeighborOffsetsPortal.Get(vertex);
689  vtkm::Id neighboursEnd = (vertex < mesh.GetNumberOfVertices() - 1)
690  ? meshNeighborOffsetsPortal.Get(vertex + 1)
691  : mesh.NeighborConnectivity.GetNumberOfValues();
692 
693  // now loop through the neighbours
694  for (vtkm::Id whichNbr = neighboursBegin; whichNbr != neighboursEnd; ++whichNbr)
695  { // per neighbour
696  vtkm::Id nbrID = meshNeighborConnectivityPortal.Get(whichNbr);
697  // skip if the neighbour is higher (use sim. of simp.)
698  if ((meshSortedValuesPortal.Get(nbrID) > meshSortedValuesPortal.Get(vertex)) ||
699  ((meshSortedValuesPortal.Get(nbrID) == meshSortedValuesPortal.Get(vertex)) &&
700  (nbrID > vertex)))
701  // output the edge
702  outStream << "\tr" << std::setw(1) << nbrID << " -> r" << std::setw(1) << vertex
703  << " [penwidth=3]" << std::endl;
704  else
705  outStream << "\tr" << std::setw(1) << vertex << " -> r" << std::setw(1) << nbrID
706  << " [dir=back,penwidth=3]" << std::endl;
707  } // per neighbour
708 
709  } // per vertex
710 
711  // close the graph
712  outStream << "\t}" << std::endl;
713 
714  // now return the string
715  return outStream.str();
716 } // ContourTreeMeshDotGraphPrint()
717 
718 
719 // 3. All purpose routine to dump out the contents for comparison with contour tree
720 VTKM_CONT
721 template <typename T, typename StorageType, typename MeshType, typename MeshBoundaryExecObjType>
723  const std::string& label, // the label to use as title for the graph
724  MeshType& mesh, // the underlying mesh for the contour tree
725  MeshBoundaryExecObjType&
726  meshBoundaryExecutionObject, // the boundary description need to determin if a vertex is on the boundary
727  vtkm::worklet::contourtree_distributed::BoundaryTree& boundaryTree, // the boundary tree itself
729  localToGlobalIdRelabeler, // relabler needed to compute global ids
732  SHOW_BOUNDARY_TREE_ALL, // mask with flags for what elements to show
733  const bool printHeaderAndFooter = true)
734 { // BoundaryTreeDotGraphPrint()
735  // initialise a string stream to capture the output
736  std::stringstream outStream;
737 
738  // now grab portals to all the variables we will need
739  auto vertexIndexPortal = boundaryTree.VertexIndex.ReadPortal();
740  auto superarcsPortal = boundaryTree.Superarcs.ReadPortal();
741 
742  // if requested
743  if (printHeaderAndFooter)
744  { // print header
745  // print the header information
746  outStream << "digraph BoundaryTree\n\t{\n";
747  outStream << "\tlabel=\"" << std::setw(1) << label << "\"\n\tlabelloc=t\n\tfontsize=30\n";
748  outStream << "\t// Nodes" << std::endl;
749  } // print header
750 
751  // prercompute the mesh boundary
752  // TODO: This should be done in parallel. We have the basic code but for printing this is fine for now
753  vtkm::cont::ArrayHandle<bool> liesOnBoundary;
754  {
756  vtkm::worklet::contourtree_augmented::IdArrayType boundaryVertexSortIndexArray;
757  mesh.GetBoundaryVertices(boundaryVertexArray, // output
758  boundaryVertexSortIndexArray, // output
759  &meshBoundaryExecutionObject //input
760  );
761  // TODO Add option for boundary critical only
762 
763  auto boundaryVertexArrayPortal = boundaryVertexArray.ReadPortal();
764  // vtkm::cont::ArrayHandle<vtkm::Range> rangeArray = vtkm::cont::ArrayRangeCompute(mesh.SortOrder);
765  // vtkm::Id maxId = static_cast<vtkm::Id>(rangeArray.ReadPortal().Get(0).Max) + 1;
766  liesOnBoundary.Allocate(mesh.SortOrder.GetNumberOfValues());
767  auto liesOnBoundaryWritePortal = liesOnBoundary.WritePortal();
770  liesOnBoundary);
771  for (vtkm::Id i = 0; i < boundaryVertexArray.GetNumberOfValues(); ++i)
772  {
773  liesOnBoundaryWritePortal.Set(boundaryVertexArrayPortal.Get(i), true);
774  }
775  }
776  auto liesOnBoundaryPortal = liesOnBoundary.ReadPortal();
777 
778  // loop through all nodes
779  auto meshSortOrderPortal = mesh.SortOrder.ReadPortal();
780  auto globalIds = mesh.GetGlobalIdsFromSortIndices(mesh.SortOrder, localToGlobalIdRelabeler);
781  auto globalIdsPortal = globalIds.ReadPortal();
782  auto dataValuesPortal = field.ReadPortal();
783  for (vtkm::Id node = 0; node < boundaryTree.VertexIndex.GetNumberOfValues(); node++)
784  { // per node
785  // work out the node and it's value
786  vtkm::Id sortID = vertexIndexPortal.Get(node);
787  vtkm::Id regularID = meshSortOrderPortal.Get(sortID);
788  // NOTE: globalIdsPortal already looked up by meshSortOrder so we need to
789  // look up globalID now by node not sortID
790  vtkm::Id globalID = globalIdsPortal.Get(node);
791  auto dataValue = dataValuesPortal.Get(regularID);
792 
793  // print the vertex (using global ID to simplify things for the residue)
794  outStream << "\tg" << std::setw(1) << globalID;
795  outStream << "[style=filled,fixedsize=true,fontname=\"Courier\",margin=\"0.02,0.02\",height="
796  "\"1.7in\",width=\"1.7in\",penwidth=5,shape=circle";
797  outStream << ",fillcolor=" << (liesOnBoundaryPortal.Get(regularID) ? "grey" : "white");
798  outStream << ",label=\"";
800  outStream << "b " << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH) << node
801  << "\\n";
803  outStream << "g " << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH)
804  << globalID << "\\n";
806  outStream << "v " << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH)
807  << dataValue << "\\n";
809  outStream << "r " << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH)
810  << regularID << "\\n";
812  outStream << "s " << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH) << sortID
813  << "\\n";
814  outStream << "\"];\n";
815  } // per vertex
816  // always show the null node
817  outStream << "\t// Null Node" << std::endl;
818  outStream
819  << "\tNULL "
820  "[style=filled,fixedsize=true,fontname=\"Courier\",margin=\"0.02,0.02\",height=\"0.5in\","
821  "width=\"0.5in\",penwidth=1,shape=circle,fillcolor=white,color=black,label=\"NULL\"]"
822  << std::endl;
823 
824  // now print out the edges
825  for (vtkm::Id node = 0; node < boundaryTree.Superarcs.GetNumberOfValues(); node++)
826  { // per node
827  // retrieve global ID of node
828  vtkm::Id sortID = vertexIndexPortal.Get(node);
829  vtkm::Id globalID = globalIdsPortal.Get(sortID);
830 
831  // retrieve ID of target supernode
832  vtkm::Id to = superarcsPortal.Get(node);
833 
834  // if this is true, it is the last pruned vertex & is omitted
836  outStream << "\tg" << std::setw(1) << globalID << " -> NULL [penwidth=2";
837  else
838  { // actual superarc
839  vtkm::Id toSort = vertexIndexPortal.Get(to);
840  vtkm::Id toGlobal = globalIdsPortal.Get(toSort);
841  if (node < to)
842  outStream << "\tg" << std::setw(1) << toGlobal << " -> g" << std::setw(1) << globalID
843  << " [dir=back,penwidth=3";
844  else
845  outStream << "\tg" << std::setw(1) << globalID << " -> g" << std::setw(1) << toGlobal
846  << " [penwidth=3";
847  } // actual superarc
848 
849  // now tidy up
851  outStream << ",label=\"BA" << node << "\"";
852  outStream << "]" << std::endl;
853  } // per node
854 
855  if (printHeaderAndFooter)
856  { // print footer
857  outStream << "\t}" << std::endl;
858  } // print footer
859  // now return the string
860  return outStream.str();
861 } // BoundaryTreeDotGraphPrint()
862 
863 
864 // Routines for InteriorForest:
865 // 4. All purpose routine to dump out the contents for comparison with contour tree
866 VTKM_CONT
867 template <typename T, typename StorageType, typename MeshType, typename MeshBoundaryExecObjType>
869  const std::string& label, // the label to use as title for the graph
870  vtkm::worklet::contourtree_distributed::InteriorForest& forest, // the forest in question
872  contourTree, // the contour tree to which it belongs
873  vtkm::worklet::contourtree_distributed::BoundaryTree& boundaryTree, // the boundary tree
874  MeshType& mesh, // the underlying mesh for the contour tree
875  MeshBoundaryExecObjType&
876  meshBoundaryExecutionObject, // the boundary description need to determin if a vertex is on the boundary
878  localToGlobalIdRelabeler, // relabler needed to compute global ids
880  const vtkm::Id& showMask =
882 { // InteriorForestDotGraphPrint()
883  // initialise a string stream to capture the output
884  std::stringstream outStream;
885 
886  // now grab portals to all the variables we will need
887  auto supernodesPortal = contourTree.Supernodes.ReadPortal();
888  auto superarcsPortal = contourTree.Superarcs.ReadPortal();
889  auto forestAbovePortal = forest.Above.ReadPortal();
890  auto forestBelowPortal = forest.Below.ReadPortal();
891  auto forestIsNecessaryPortal = forest.IsNecessary.ReadPortal();
892 
893  // print the header information
894  outStream << "digraph InteriorForest\n\t{\n";
895  outStream << "\tlabel=\"" << std::setw(1) << label << "\"\n\tlabelloc=t\n\tfontsize=30\n";
896  outStream << "\t// Nodes" << std::endl;
897 
898  // call the boundary tree routine first, telling it to omit the header and footer
899  // note that since we define our mask in the same bits as BRACT, we can pass through the mask
900  outStream << BoundaryTreeDotGraphPrint(
901  label,
902  mesh,
903  meshBoundaryExecutionObject,
904  boundaryTree,
905  localToGlobalIdRelabeler,
906  field,
908  false);
909 
910  // now we need to show the forest and how it relates to the boundary tree
911  // note - we will ignore the boundary tree Mesh Indices array for now
912  auto meshSortOrderPortal = mesh.SortOrder.ReadPortal();
913  auto globalIds = mesh.GetGlobalIdsFromSortIndices(mesh.SortOrder, localToGlobalIdRelabeler);
914  auto globalIdsPortal = globalIds.ReadPortal();
915  auto dataValuesPortal = field.ReadPortal();
916 
917  // loop through all of the supernodes in the contour tree
918  for (vtkm::Id supernode = 0; supernode < contourTree.Supernodes.GetNumberOfValues(); supernode++)
919  { // per supernode
920  // retrieve the various IDs for the supernode
921  vtkm::Id sortID = supernodesPortal.Get(supernode);
922  vtkm::Id regularID = meshSortOrderPortal.Get(sortID);
923  // NOTE: globalIdsPortal already looked up by meshSortOrder so we need to
924  // look up globalID now by supernode not sortID
925  vtkm::Id globalID = globalIdsPortal.Get(supernode);
926  auto dataValue = dataValuesPortal.Get(regularID);
927 
928  // vertices marked "necessary" are in the interior of the BRACT, but not all are in the BRACT
929  // but the ones in the BRACT always have above/below pointing to themselves, so we test that
930  if (forestIsNecessaryPortal.Get(supernode) && (forestAbovePortal.Get(supernode) == globalID) &&
931  (forestBelowPortal.Get(supernode) == globalID))
932  continue;
933 
934  // now print out the node
935  // print the vertex
936  outStream << "\tg" << std::setw(1) << globalID;
937  outStream << "[style=filled,fixedsize=true,fontname=\"Courier\",margin=\"0.02,0.02\",height="
938  "\"1.7in\",width=\"1.7in\",penwidth=5,shape=circle";
939  outStream << ",fillcolor=white";
940  outStream << ",label=\"";
942  outStream << "SN" << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH)
943  << supernode << "\\n";
945  outStream << "g " << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH)
946  << globalID << "\\n";
948  outStream << "v " << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH)
949  << dataValue << "\\n";
951  outStream << "r " << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH)
952  << regularID << "\\n";
954  outStream << "s " << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH) << sortID
955  << "\\n";
956  outStream << "\"];\n";
957  } // per supernode
958 
959  // now loop through the superarcs in the contour tree
960  for (vtkm::Id supernode = 0; supernode < contourTree.Supernodes.GetNumberOfValues(); supernode++)
961  { // per supernode / superarc
962  // retrieve the various IDs for the supernode
963  vtkm::Id sortID = supernodesPortal.Get(supernode);
964  vtkm::Id globalID = globalIdsPortal.Get(sortID);
965 
966  // for nodes not necessary, show their superarc
967  if (!forestIsNecessaryPortal.Get(supernode))
968  { // not necessary
969  // retrieve the target of its superarc
970  vtkm::Id superarc = superarcsPortal.Get(supernode);
971 
972  // check to see if it exists
974  continue;
975 
976  // separate out the ID
978  vtkm::Id toSort = supernodesPortal.Get(superTo);
979  vtkm::Id toGlobal = globalIdsPortal.Get(toSort);
980 
981  // then print out the edge
983  outStream << "\tg" << std::setw(1) << toGlobal << " -> g" << globalID
984  << "[dir=back,penwidth=3]" << std::endl;
985  else
986  outStream << "\tg" << std::setw(1) << globalID << " -> g" << toGlobal << "[penwidth=3]"
987  << std::endl;
988  } // not necessary
989  else if ((forestAbovePortal.Get(supernode) != globalID) ||
990  (forestBelowPortal.Get(supernode) != globalID))
991  { // attachment point
992  // all others are attachment points and have a valid above / below
993  outStream << "\tg" << std::setw(1) << forestAbovePortal.Get(supernode) << " -> g"
994  << std::setw(1) << globalID << "[penwidth=1,style=dotted,label=above,dir=back]"
995  << std::endl;
996  outStream << "\tg" << std::setw(1) << globalID << " -> g" << forestBelowPortal.Get(supernode)
997  << "[penwidth=1,style=dotted,label=below]" << std::endl;
998  } // attachment point
999 
1000  } // per supernode / superarc
1001 
1002  // print the footer
1003  outStream << "\t}" << std::endl;
1004 
1005  // now return the string
1006  return outStream.str();
1007 } // InteriorForestDotGraphPrint()
1008 
1009 
1010 // 5. Routine to print regular/super/hyper structure with similar options to contour tree
1011 VTKM_CONT
1012 template <typename FieldType>
1013 // template <typename FieldType, typename VectorType>
1015  const std::string& label, // the label to use as title for the graph
1017  hierarchicalTree, // the hierarchical contour tree itself
1019  SHOW_HIERARCHICAL_STANDARD) // mask with flags for what elements to show
1020 // const unsigned long showMask = vtkm::worklet::contourtree_distributed::SHOW_HIERARCHICAL_STANDARD, // mask with flags for what elements to show
1021 // const VectorType &perNodeValues = VectorType(0)) // an arbitrary vector of values
1022 { // HierarchicalContourTreeDotGraphPrint()
1023  // initialise a string stream to capture the output
1024  std::stringstream outStream;
1025 
1026  // now grab portals to all the variables we will need
1027  auto regularNodeGlobalIdsPortal = hierarchicalTree.RegularNodeGlobalIds.ReadPortal();
1028  auto dataValuesPortal = hierarchicalTree.DataValues.ReadPortal();
1029  auto regularNodeSortOrderPortal = hierarchicalTree.RegularNodeSortOrder.ReadPortal();
1030  auto regular2supernodePortal = hierarchicalTree.Regular2Supernode.ReadPortal();
1031  auto superparentsPortal = hierarchicalTree.Superparents.ReadPortal();
1032  auto supernodesPortal = hierarchicalTree.Supernodes.ReadPortal();
1033  auto superarcsPortal = hierarchicalTree.Superarcs.ReadPortal();
1034  auto hyperparentsPortal = hierarchicalTree.Hyperparents.ReadPortal();
1035  auto super2hypernodePortal = hierarchicalTree.Super2Hypernode.ReadPortal();
1036  auto whichRoundPortal = hierarchicalTree.WhichRound.ReadPortal();
1037  auto whichIterationPortal = hierarchicalTree.WhichIteration.ReadPortal();
1038  auto hypernodesPortal = hierarchicalTree.Hypernodes.ReadPortal();
1039  auto hyperarcsPortal = hierarchicalTree.Hyperarcs.ReadPortal();
1040 
1041  // TODO: Resolve passing conventions for per node values
1042  // auto perNodeValuesPortal = perNodeValues.ReadPortal();
1043 
1044  // work out how long the computed value is
1045  // int nodeValueType = vtkm::worklet::contourtree_distributed::BAD_PER_NODE_VALUES;
1046  // vtkm::Id perNodeSize = perNodeValues.GetNumberOfValues();
1047  // if (perNodeSize == 0)
1048  // nodeValueType = vtkm::worklet::contourtree_distributed::NO_PER_NODE_VALUES;
1049  // else if (perNodeSize == hierarchicalTree.Nodes.GetNumberOfValues())
1050  // nodeValueType = vtkm::worklet::contourtree_distributed::PER_REGULAR_NODE_VALUES;
1051  // else if (perNodeSize == hierarchicalTree.Supernodes.GetNumberOfValues())
1052  // nodeValueType = vtkm::worklet::contourtree_distributed::PER_SUPER_NODE_VALUES;
1053  // else if (perNodeSize == hierarchicalTree.Hypernodes.GetNumberOfValues())
1054  // nodeValueType = vtkm::worklet::contourtree_distributed::PER_HYPER_NODE_VALUES;
1055  // else
1056  // { // error message
1057  // outStream << "ERROR in HierarchicalContourTreeDotGraphPrint().\n";
1058  // outStream << "Per node values array must be empty, or\n";
1059  // outStream << "Same length as regular nodes (" << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH) << hierarchicalTree.Nodes.GetNumberOfValues() << "), or\n";
1060  // outStream << "Same length as super nodes (" << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH) << hierarchicalTree.Supernodes.GetNumberOfValues() << "), or\n";
1061  // outStream << "Same length as hyper nodes (" << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH) << hierarchicalTree.Hypernodes.GetNumberOfValues() << ")\n";
1062  // outStream << "Actual length was (" << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH) << perNodeValues.GetNumberOfValues() << ")\n";
1063  // } // error message
1064 
1065  // print the header information
1066  outStream << "digraph HierarchicalContourTree\n\t{\n";
1067  outStream << "\tlabel=\"" << std::setw(1) << label << "\"\n\tlabelloc=t\n\tfontsize=30\n";
1068  outStream << "\t// Nodes" << std::endl;
1069 
1070  // loop through all of the nodes in the regular list
1071  for (vtkm::Id node = 0; node < hierarchicalTree.RegularNodeGlobalIds.GetNumberOfValues(); node++)
1072  { // per node
1073  // Since the superparent for an attachment point is set to another supernode, reset the calculation here
1074  //vtkm::Id whichRound = maskedIndex(hierarchicalTree.WhichRound[superID]);
1075  //vtkm::Id whichIteration = maskedIndex(hierarchicalTree.WhichIteration[superID]);
1076 
1077  // the regular ID in this case is the node itself
1078  vtkm::Id regularID = node;
1079 
1080  // for a sort ID, we will take the sort order vector
1081  vtkm::Id sortID = regularNodeSortOrderPortal.Get(node);
1082 
1083  // retrieve the global ID
1084  vtkm::Id globalID = regularNodeGlobalIdsPortal.Get(node);
1085 
1086  // retrieve the values
1087  auto dataValue = dataValuesPortal.Get(node);
1088 
1089  // retrieve the superparent
1090  vtkm::Id superparent = superparentsPortal.Get(node);
1091 
1092  // and retrieve the iteration #
1093  vtkm::Id whichRound =
1094  vtkm::worklet::contourtree_augmented::MaskedIndex(whichRoundPortal.Get(superparent));
1095  vtkm::Id whichIteration =
1096  vtkm::worklet::contourtree_augmented::MaskedIndex(whichIterationPortal.Get(superparent));
1097 
1098  // work out the super ID & hyper ID
1099  vtkm::Id superID = regular2supernodePortal.Get(node);
1103 
1104  // test for super
1106  { // at least super
1107  // set hyperparent
1108  hyperparent = hyperparentsPortal.Get(superID);
1109  // set nodetype
1111  // retrieve hyper ID
1112  hyperID = super2hypernodePortal.Get(superparent);
1113  // test it
1115  { // hyper node
1117  } // hyper node
1118  } // at least super
1119 
1120  // now, if we don't want the regular nodes, we want to skip them entirely, so
1121  bool showNode = false;
1122  // regular structure always shows all nodes
1124  showNode = true;
1125  // super structure shows super & hyper nodes only
1130 
1131  // if we didn't set the flag, skip the node
1132  if (!showNode)
1133  continue;
1134 
1135  // print the vertex ID, which should be the sort ID & needs to be left-justified to work
1136  outStream << "\ts" << std::setw(1) << sortID;
1137 
1138  // print the style characteristics - node is filled and fixed size
1139  outStream << " [style=filled,fixedsize=true,fontname=\"Courier\",margin=\"0.02,0.02\"";
1140  // specify the style based on the type of node
1142  outStream << ",height=\"1.7in\",width=\"1.7in\",penwidth=5";
1144  outStream << ",height=\"2.5in\",width=\"2.5in\",penwidth=10";
1146  outStream << ",height=\"2.5in\",width=\"2.5in\",penwidth=15";
1147 
1148  // shape should always be circular.
1149  outStream << ",shape=circle";
1150 
1151  // after setting the flag, its easy
1152  outStream << ",fillcolor=white";
1153 
1154  // stroke colour depends on which round
1155  outStream << ",color="
1158 
1159  // start printing the label
1160  outStream << ",label=\"";
1161  // print the global ID
1163  outStream << "g " << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH)
1164  << globalID << "\\n";
1165  // print the value
1167  outStream << "v " << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH)
1168  << dataValue << "\\n";
1169  // print the regular & sort IDs
1171  outStream << "r " << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH)
1172  << regularID << "\\n";
1174  outStream << "s " << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH) << sortID
1175  << "\\n";
1176  // print the superparent
1178  outStream << "sp" << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH)
1179  << superparent << "\\n";
1180 
1181  // add arbitrary per node value if it is regular in nature
1182  // if ((showMask & vtkm::worklet::contourtree_distributed::SHOW_EXTRA_DATA) && (nodeValueType == vtkm::worklet::contourtree_distributed::PER_REGULAR_NODE_VALUES))
1183  // outStream << "x " << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH) << perNodeValues[regularID] << "\\n";
1184 
1185  // we now want to add labelling information specific to supernodes, but also present in hypernodes
1187  { // at least super
1188 
1189  // print the super node ID
1191  outStream << "SN" << std::setw(INDEX_WIDTH) << superID << "\\n";
1192 
1193  // print the hyperparent as well
1195  outStream << "HP" << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH)
1196  << hyperparent << "\\n";
1198  outStream << "IT" << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH)
1199  << whichRound << "." << whichIteration << "\\n";
1200 
1201  // add arbitrary per node value if it is super in nature
1202  // if ((showMask & vtkm::worklet::contourtree_distributed::SHOW_EXTRA_DATA) && (nodeValueType == PER_SUPER_NODE_VALUES))
1203  // outStream << "X " << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH) << perNodeValues[superID] << "\\n";
1204  } // at least super
1205 
1206  // now add even more for hypernodes
1208  { // hyper node
1210  outStream << "HN" << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH)
1211  << hyperID << "\\n";
1212 
1213  // add arbitrary per node value if it is hyper in nature
1214  // if ((showMask & vtkm::worklet::contourtree_distributed::SHOW_EXTRA_DATA) && (nodeValueType == vtkm::worklet::contourtree_distributed::PER_HYPER_NODE_VALUES))
1215  // outStream << "X " << std::setw(vtkm::worklet::contourtree_distributed::INDEX_WIDTH) << perNodeValues[hyperID] << "\\n";
1216  } // hyper node
1217 
1218  outStream << "\"]" << std::endl;
1219  } // per node
1220 
1221  // always show the null node
1222  outStream << "\t// Null Node" << std::endl;
1223  outStream
1224  << "\tNULL "
1225  "[style=filled,fixedsize=true,fontname=\"Courier\",margin=\"0.02,0.02\",height=\"0.5in\","
1226  "width=\"0.5in\",penwidth=1,shape=circle,fillcolor=white,color=black,label=\"NULL\"]"
1227  << std::endl;
1228 
1229  // now show superarc nodes
1230  outStream << "\t// Superarc nodes\n";
1231  // now repeat to create nodes for the middle of each superarc (to represent the superarcs themselves)
1232  for (vtkm::Id superarc = 0; superarc < hierarchicalTree.Superarcs.GetNumberOfValues(); superarc++)
1233  { // per superarc
1234  // retrieve ID of target superarc
1235  vtkm::Id superarcFrom = superarc;
1236  vtkm::Id superarcTo = superarcsPortal.Get(superarcFrom);
1237 
1238  // and retrieve the iteration #
1239  vtkm::Id whichRound =
1240  vtkm::worklet::contourtree_augmented::MaskedIndex(whichRoundPortal.Get(superarcFrom));
1241 
1242  // if this is true, it is the last pruned vertex (attachment point or root) and has no superarc vertex
1244  continue;
1245 
1246  // print the superarc vertex
1247  outStream << "\tSA" << std::setw(1) << superarc;
1248  outStream << "[shape=circle,color="
1251  outStream << ",fillcolor=white";
1252  outStream << ",fixedsize=true";
1253  outStream << ",height=0.8,width=0.8";
1254  outStream << ",label=\"";
1256  outStream << "SA" << std::setw(1) << superarc;
1257  outStream << "\"];" << std::endl;
1258  } // per superarc
1259 
1260  // now show regular arcs - since we do not maintain a sort, they will all attach to the parent superarc
1262  { // showing regular nodes
1263  outStream << "\t// Superarc nodes\n";
1264  for (vtkm::Id regularID = 0;
1265  regularID < hierarchicalTree.RegularNodeGlobalIds.GetNumberOfValues();
1266  regularID++)
1267  { // per regular node
1268  // if it has a superID, then we don't want to attach it to a superarc
1270  regular2supernodePortal.Get(regularID)))
1271  continue;
1272 
1273  // retrieve the sort ID
1274  vtkm::Id sortID = regularNodeSortOrderPortal.Get(regularID);
1275  // retrieve the superparent
1276  vtkm::Id superparent = superparentsPortal.Get(regularID);
1277 
1278  // and connect to the superarc
1279  outStream << "\ts" << sortID << " -> SA" << superparent << "[style=dotted]" << std::endl;
1280 
1281  } // per regular node
1282  } // showing regular nodes
1283 
1285  { // showing superstructure
1286  outStream << "\t// Superarc edges\n";
1287  // loop through all superarcs to draw them
1288  for (vtkm::Id superarc = 0; superarc < hierarchicalTree.Superarcs.GetNumberOfValues();
1289  superarc++)
1290  { // per superarc
1291  // retrieve ID of target supernode
1292  vtkm::Id superarcFrom = superarc;
1293  // retrieve the sort ID
1294  vtkm::Id fromRegular = supernodesPortal.Get(superarcFrom);
1295  vtkm::Id fromSort = regularNodeSortOrderPortal.Get(fromRegular);
1296 
1297  // and retrieve the destination
1298  vtkm::Id superarcTo = superarcsPortal.Get(superarcFrom);
1299 
1300  // and retrieve the iteration #
1301  vtkm::Id whichRound =
1302  vtkm::worklet::contourtree_augmented::MaskedIndex(whichRoundPortal.Get(superarcFrom));
1303 
1304  // if this is true, it may be the last pruned vertex
1306  { // no superarc
1307  // if it occurred on the final round, it's the global root and is shown as the NULL node
1308  if (whichRound == hierarchicalTree.NumRounds)
1309  outStream << "\ts" << fromSort << " -> NULL[label=\"SA" << superarc << "\",style=dotted]"
1310  << std::endl;
1311  else
1312  { // attachment point
1313  // otherwise, the target is actually a superarc vertex not a supernode vertex
1314  // so we use the regular ID to retrieve the superparent which tells us which superarc we insert into
1315  vtkm::Id regularFrom = supernodesPortal.Get(superarcFrom);
1316  superarcTo = superparentsPortal.Get(regularFrom);
1317 
1318  // output a suitable edge
1319  outStream << "\ts" << fromSort << " -> SA" << superarcTo << "[label=\"S" << superarc
1320  << "\",style=dotted,color="
1323  << "]" << std::endl;
1324  } // attachment point
1325  } // no superarc
1326  else
1327  { // there is a superarc
1328  // retrieve the ascending flag
1329  bool ascendingSuperarc = vtkm::worklet::contourtree_augmented::IsAscending(superarcTo);
1330 
1331  // strip out the flags
1332  superarcTo = vtkm::worklet::contourtree_augmented::MaskedIndex(superarcTo);
1333 
1334  // retrieve the sort ID for the to end
1335  vtkm::Id toRegular = supernodesPortal.Get(superarcTo);
1336  vtkm::Id toSort = regularNodeSortOrderPortal.Get(toRegular);
1337 
1338  // how we print depends on whether the superarc ascends
1339  if (ascendingSuperarc)
1340  { // ascending arc
1341  outStream << "\ts" << toSort << " -> SA" << superarc << "[label=\"SA" << superarc
1342  << "\",dir=back";
1343  outStream << ",penwidth=3,color="
1346  << "]" << std::endl;
1347  outStream << "\tSA" << superarc << " -> s" << fromSort << "[label=\"SA" << superarc
1348  << "\",dir=back";
1349  outStream << ",penwidth=3,color="
1352  << "]" << std::endl;
1353  } // ascending arc
1354  else
1355  { // descending arc
1356  outStream << "\ts" << fromSort << " -> SA" << superarc << "[label=\"SA" << superarc
1357  << "\"";
1358  outStream << ",penwidth=3,color="
1361  << "]" << std::endl;
1362  outStream << "\tSA" << superarc << " -> s" << toSort << "[label=\"SA" << superarc << "\"";
1363  outStream << ",penwidth=3,color="
1366  << "]" << std::endl;
1367  } // descending arc
1368  } // there is a superarc
1369  } // per superarc
1370  } // showing superstructure
1371 
1373  { // show hyperstructure
1374  outStream << "\t// Hyperarcs\n";
1375  // now loop through the hyperarcs to draw them
1376  for (vtkm::Id hyperarc = 0; hyperarc < hierarchicalTree.Hyperarcs.GetNumberOfValues();
1377  hyperarc++)
1378  { // per hyperarc
1379  // down convert to a sort ID
1380  vtkm::Id fromSuper = hypernodesPortal.Get(hyperarc);
1381  vtkm::Id fromRegular = supernodesPortal.Get(fromSuper);
1382  vtkm::Id fromSort = regularNodeSortOrderPortal.Get(fromRegular);
1383 
1384  // and retrieve the iteration #
1385  vtkm::Id whichRound =
1386  vtkm::worklet::contourtree_augmented::MaskedIndex(whichRoundPortal.Get(fromSuper));
1387 
1388  // and do the same with the to end
1389  vtkm::Id toSuper = hyperarcsPortal.Get(hyperarc);
1390 
1391  // if this is true, it is the last pruned vertex & connects to NULL
1393  outStream << "\ts" << fromSort << " -> NULL[label=\"HA" << hyperarc
1394  << "\",penwidth=3.0,style=dotted]" << std::endl;
1395  else
1396  { // not the last one
1397  // otherwise, retrieve the ascending flag
1398  bool ascendingHyperarc = vtkm::worklet::contourtree_augmented::IsAscending(toSuper);
1399 
1400  // strip out the flags
1402 
1403  // retrieve the sort index
1404  vtkm::Id toRegular = supernodesPortal.Get(toSuper);
1405  vtkm::Id toSort = regularNodeSortOrderPortal.Get(toRegular);
1406 
1407  // how we print depends on whether the hyperarc ascends
1408  if (ascendingHyperarc)
1409  { // ascending arc
1410  outStream << "\ts" << toSort << " -> s" << fromSort << "[label=\"HA" << hyperarc
1411  << "\",dir=back";
1412  outStream << ",penwidth=5.0,color="
1415  << "]" << std::endl;
1416  } // ascending arc
1417  else
1418  { // descending arc
1419  outStream << "\ts" << fromSort << " -> s" << toSort << "[label=\"HA" << hyperarc << "\"";
1420  outStream << ",penwidth=5.0,color="
1423  << "]" << std::endl;
1424  } // descending arc
1425  } // not the last one
1426  } // per hyperarc
1427  } // show hyperstructure
1428 
1429  // print the footer information
1430  outStream << "\t}\n";
1431 
1432  // now return the string
1433  return outStream.str();
1434 } // HierarchicalContourTreeDotGraphPrint()
1435 
1436 
1437 } // namespace contourtree_distributed
1438 } // namespace worklet
1439 } // namespace vtkm
1440 
1441 #endif
vtkm::worklet::contourtree_distributed::HierarchicalContourTreeDotGraphPrint
VTKM_CONT std::string HierarchicalContourTreeDotGraphPrint(const std::string &label, const vtkm::worklet::contourtree_distributed::HierarchicalContourTree< FieldType > &hierarchicalTree, const vtkm::Id showMask=vtkm::worklet::contourtree_distributed::SHOW_HIERARCHICAL_STANDARD)
Definition: PrintGraph.h:1014
vtkm::worklet::contourtree_distributed::SHOW_HYPERNODE_ID
constexpr vtkm::Id SHOW_HYPERNODE_ID
Definition: PrintGraph.h:188
vtkm::worklet::contourtree_distributed::PER_REGULAR_NODE_VALUES
constexpr vtkm::Id PER_REGULAR_NODE_VALUES
Definition: PrintGraph.h:153
vtkm::worklet::contourtree_distributed::HierarchicalContourTree::Supernodes
vtkm::worklet::contourtree_augmented::IdArrayType Supernodes
Definition: HierarchicalContourTree.h:124
vtkm::worklet::contourtree_augmented::ContourTreeMesh::GlobalMeshIndex
IdArrayType GlobalMeshIndex
Definition: ContourTreeMesh.h:200
vtkm::worklet::contourtree_distributed::HierarchicalContourTree::Superparents
vtkm::worklet::contourtree_augmented::IdArrayType Superparents
Definition: HierarchicalContourTree.h:120
vtkm::worklet::contourtree_distributed::InteriorForest::Below
vtkm::worklet::contourtree_augmented::IdArrayType Below
Definition: InteriorForest.h:96
vtkm::worklet::contourtree_distributed::SHOW_BOUNDARY_TREE_MESH_REGULAR_ID
constexpr vtkm::Id SHOW_BOUNDARY_TREE_MESH_REGULAR_ID
Definition: PrintGraph.h:197
vtkm::worklet::contourtree_distributed::SHOW_INTERIOR_FOREST_VERTEX_ID
constexpr vtkm::Id SHOW_INTERIOR_FOREST_VERTEX_ID
Definition: PrintGraph.h:215
vtkm::cont::ArrayHandle::GetNumberOfValues
VTKM_CONT vtkm::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:448
vtkm::worklet::contourtree_augmented::ContourTree::Hyperparents
IdArrayType Hyperparents
Definition: augmented/ContourTree.h:136
vtkm::worklet::contourtree_distributed::HierarchicalContourTree
Hierarchical Contour Tree data structure.
Definition: HierarchicalContourTree.h:100
vtkm::worklet::contourtree_distributed::PER_SUPER_NODE_BOUNDARY_FLAGS
constexpr vtkm::Id PER_SUPER_NODE_BOUNDARY_FLAGS
Definition: PrintGraph.h:156
vtkm::worklet::contourtree_distributed::SHOW_MESH_SORT_ID
constexpr vtkm::Id SHOW_MESH_SORT_ID
Definition: PrintGraph.h:176
vtkm::worklet::contourtree_distributed::HierarchicalContourTree::Superarcs
vtkm::worklet::contourtree_augmented::IdArrayType Superarcs
Definition: HierarchicalContourTree.h:126
vtkm::cont::ArrayHandle< T, StorageType >
vtkm::worklet::contourtree_distributed::ContourTreeMeshDotGraphPrint
VTKM_CONT std::string ContourTreeMeshDotGraphPrint(const std::string &label, vtkm::worklet::contourtree_augmented::ContourTreeMesh< FieldType > &mesh, const vtkm::Id showMask=SHOW_CONTOUR_TREE_MESH_ALL)
Definition: PrintGraph.h:640
vtkm::worklet::contourtree_augmented::IsAscending
VTKM_EXEC_CONT bool IsAscending(vtkm::Id flaggedIndex)
Definition: filter/scalar_topology/worklet/contourtree_augmented/Types.h:121
vtkm::worklet::contourtree_augmented::ContourTree::Hyperarcs
IdArrayType Hyperarcs
Definition: augmented/ContourTree.h:149
vtkm::worklet::contourtree_distributed::PER_SUPER_NODE_VALUES
constexpr vtkm::Id PER_SUPER_NODE_VALUES
Definition: PrintGraph.h:155
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::worklet::contourtree_distributed::SHOW_BOUNDARY_TREE_DATA_VALUE
constexpr vtkm::Id SHOW_BOUNDARY_TREE_DATA_VALUE
Definition: PrintGraph.h:196
vtkm::worklet::contourtree_distributed::HierarchicalContourTree::WhichRound
vtkm::worklet::contourtree_augmented::IdArrayType WhichRound
Definition: HierarchicalContourTree.h:135
HierarchicalContourTree.h
vtkm::worklet::contourtree_distributed::SHOW_CONTOUR_TREE_MESH_DATA_VALUE
constexpr vtkm::Id SHOW_CONTOUR_TREE_MESH_DATA_VALUE
Definition: PrintGraph.h:209
vtkm::worklet::contourtree_distributed::BAD_PER_NODE_VALUES
constexpr vtkm::Id BAD_PER_NODE_VALUES
Definition: PrintGraph.h:158
vtkm::worklet::contourtree_distributed::SHOW_CONTOUR_TREE_MESH_GLOBAL_ID
constexpr vtkm::Id SHOW_CONTOUR_TREE_MESH_GLOBAL_ID
Definition: PrintGraph.h:208
vtkm::worklet::contourtree_distributed::SHOW_ALL_HYPERIDS
constexpr vtkm::Id SHOW_ALL_HYPERIDS
Definition: PrintGraph.h:235
vtkm::worklet::contourtree_augmented::ContourTree::Supernodes
IdArrayType Supernodes
Definition: augmented/ContourTree.h:125
Types.h
vtkm::worklet::contourtree_augmented::NODE_COLORS
constexpr const char * NODE_COLORS[N_NODE_COLORS]
Definition: augmented/ContourTree.h:81
vtkm::worklet::contourtree_augmented::N_NODE_COLORS
constexpr int N_NODE_COLORS
Definition: augmented/ContourTree.h:80
vtkm::worklet::contourtree_distributed::SHOW_BASIC_IDS
constexpr vtkm::Id SHOW_BASIC_IDS
Definition: PrintGraph.h:227
vtkm::worklet::contourtree_distributed::ContourTreeDotGraphPrint
VTKM_CONT std::string ContourTreeDotGraphPrint(const std::string &label, MeshType &mesh, const vtkm::worklet::contourtree_augmented::mesh_dem::IdRelabeler *localToGlobalIdRelabeler, const vtkm::cont::ArrayHandle< T, StorageType > &field, vtkm::worklet::contourtree_augmented::ContourTree &contourTree, const vtkm::Id showMask=SHOW_ALL_STANDARD, const VectorType &perNodeValues=VectorType())
Definition: PrintGraph.h:261
vtkm::worklet::contourtree_augmented::ContourTree
Definition: augmented/ContourTree.h:106
vtkm::cont::ArrayHandle::Allocate
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
vtkm::worklet::contourtree_distributed::SHOW_SUPERPARENT
constexpr vtkm::Id SHOW_SUPERPARENT
Definition: PrintGraph.h:179
vtkm::worklet::contourtree_augmented::ContourTree::Superparents
IdArrayType Superparents
Definition: augmented/ContourTree.h:118
vtkm::worklet::contourtree_distributed::SHOW_CRITICAL_BOUNDARY_NODES
constexpr vtkm::Id SHOW_CRITICAL_BOUNDARY_NODES
Definition: PrintGraph.h:170
vtkm::worklet::contourtree_augmented::ContourTree::Hypernodes
IdArrayType Hypernodes
Definition: augmented/ContourTree.h:144
vtkm::worklet::contourtree_distributed::SHOW_BOUNDARY_TREE_GLOBAL_ID
constexpr vtkm::Id SHOW_BOUNDARY_TREE_GLOBAL_ID
Definition: PrintGraph.h:195
BoundaryTree.h
vtkm::worklet::contourtree_distributed::InteriorForest
The contour tree of a data block restricted to the interior of a data block.
Definition: InteriorForest.h:84
vtkm::worklet::contourtree_distributed::SHOW_INTERIOR_FOREST_MESH_SORT_ID
constexpr vtkm::Id SHOW_INTERIOR_FOREST_MESH_SORT_ID
Definition: PrintGraph.h:219
vtkm::worklet::contourtree_augmented::ContourTree::Nodes
IdArrayType Nodes
Definition: augmented/ContourTree.h:112
vtkm::worklet::contourtree_distributed::SHOW_SUPER_SIMPLE
constexpr vtkm::Id SHOW_SUPER_SIMPLE
Definition: PrintGraph.h:243
vtkm::worklet::contourtree_distributed::SHOW_REGULAR_SIMPLE
constexpr vtkm::Id SHOW_REGULAR_SIMPLE
Definition: PrintGraph.h:237
vtkm::cont::Algorithm::Copy
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
vtkm::worklet::contourtree_distributed::InteriorForest::Above
vtkm::worklet::contourtree_augmented::IdArrayType Above
Definition: InteriorForest.h:95
vtkm::worklet::contourtree_distributed::NODE_TYPE_HYPER
constexpr vtkm::Id NODE_TYPE_HYPER
Definition: PrintGraph.h:162
vtkm::worklet::contourtree_distributed::InteriorForest::IsNecessary
vtkm::worklet::contourtree_augmented::IdArrayType IsNecessary
Definition: InteriorForest.h:91
vtkm::worklet::contourtree_augmented::MaskedIndex
VTKM_EXEC_CONT vtkm::Id MaskedIndex(vtkm::Id flaggedIndex)
Definition: filter/scalar_topology/worklet/contourtree_augmented/Types.h:127
vtkm::worklet::contourtree_augmented::ContourTreeMesh
Definition: ContourTreeMesh.h:129
vtkm::worklet::contourtree_distributed::SHOW_EXTRA_DATA
constexpr vtkm::Id SHOW_EXTRA_DATA
Definition: PrintGraph.h:181
vtkm::worklet::contourtree_distributed::SHOW_BASIC_SUPERIDS
constexpr vtkm::Id SHOW_BASIC_SUPERIDS
Definition: PrintGraph.h:231
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
vtkm::worklet::contourtree_augmented::ContourTreeMesh::NeighborConnectivity
IdArrayType NeighborConnectivity
Definition: ContourTreeMesh.h:207
vtkm::worklet::contourtree_distributed::INDEX_WIDTH
constexpr vtkm::Id INDEX_WIDTH
Routines for printing various tree data structures in graphviz .dot format.
Definition: PrintGraph.h:150
vtkm::worklet::contourtree_distributed::SHOW_INTERIOR_FOREST_DATA_VALUE
constexpr vtkm::Id SHOW_INTERIOR_FOREST_DATA_VALUE
Definition: PrintGraph.h:217
vtkm::worklet::contourtree_distributed::SHOW_INTERIOR_FOREST_GLOBAL_ID
constexpr vtkm::Id SHOW_INTERIOR_FOREST_GLOBAL_ID
Definition: PrintGraph.h:216
vtkm::worklet::contourtree_distributed::SHOW_SUPERARC_ID
constexpr vtkm::Id SHOW_SUPERARC_ID
Definition: PrintGraph.h:185
vtkm::worklet::contourtree_distributed::SHOW_BOUNDARY_TREE_MESH_SORT_ID
constexpr vtkm::Id SHOW_BOUNDARY_TREE_MESH_SORT_ID
Definition: PrintGraph.h:198
vtkm::worklet::contourtree_distributed::BoundaryTree::VertexIndex
vtkm::worklet::contourtree_augmented::IdArrayType VertexIndex
Definition: BoundaryTree.h:85
vtkm::worklet::contourtree_distributed::SHOW_ALL_SUPERIDS
constexpr vtkm::Id SHOW_ALL_SUPERIDS
Definition: PrintGraph.h:232
vtkm::worklet::contourtree_distributed::SHOW_ITERATION
constexpr vtkm::Id SHOW_ITERATION
Definition: PrintGraph.h:186
vtkm::worklet::contourtree_augmented::ContourTree::Superarcs
IdArrayType Superarcs
Definition: augmented/ContourTree.h:129
vtkm::worklet::contourtree_distributed::NODE_TYPE_SUPER
constexpr vtkm::Id NODE_TYPE_SUPER
Definition: PrintGraph.h:161
vtkm::worklet::contourtree_distributed::HierarchicalContourTree::RegularNodeGlobalIds
vtkm::worklet::contourtree_augmented::IdArrayType RegularNodeGlobalIds
Definition: HierarchicalContourTree.h:108
vtkm::worklet::contourtree_distributed::HierarchicalContourTree::NumRounds
vtkm::Id NumRounds
Definition: HierarchicalContourTree.h:148
vtkm::worklet::contourtree_distributed::SHOW_INTERIOR_FOREST_ALL
constexpr vtkm::Id SHOW_INTERIOR_FOREST_ALL
Definition: PrintGraph.h:220
vtkm::worklet::contourtree_distributed::SHOW_NECESSARY_SUPERNODES
constexpr vtkm::Id SHOW_NECESSARY_SUPERNODES
Definition: PrintGraph.h:171
vtkm::worklet::contourtree_distributed::InteriorForestDotGraphPrint
VTKM_CONT std::string InteriorForestDotGraphPrint(const std::string &label, vtkm::worklet::contourtree_distributed::InteriorForest &forest, vtkm::worklet::contourtree_augmented::ContourTree &contourTree, vtkm::worklet::contourtree_distributed::BoundaryTree &boundaryTree, MeshType &mesh, MeshBoundaryExecObjType &meshBoundaryExecutionObject, const vtkm::worklet::contourtree_augmented::mesh_dem::IdRelabeler *localToGlobalIdRelabeler, const vtkm::cont::ArrayHandle< T, StorageType > &field, const vtkm::Id &showMask=vtkm::worklet::contourtree_distributed::SHOW_INTERIOR_FOREST_ALL)
Definition: PrintGraph.h:868
vtkm::worklet::contourtree_augmented::NoSuchElement
VTKM_EXEC_CONT bool NoSuchElement(vtkm::Id flaggedIndex)
Definition: filter/scalar_topology/worklet/contourtree_augmented/Types.h:97
vtkm::worklet::contourtree_distributed::HierarchicalContourTree::Hyperparents
vtkm::worklet::contourtree_augmented::IdArrayType Hyperparents
Definition: HierarchicalContourTree.h:128
vtkm::worklet::contourtree_distributed::SHOW_BASIC_HYPERIDS
constexpr vtkm::Id SHOW_BASIC_HYPERIDS
Definition: PrintGraph.h:234
vtkm::worklet::contourtree_distributed::NODE_TYPE_REGULAR
constexpr vtkm::Id NODE_TYPE_REGULAR
Definition: PrintGraph.h:160
vtkm::worklet::contourtree_distributed::SHOW_BOUNDARY_TREE_ALL
constexpr vtkm::Id SHOW_BOUNDARY_TREE_ALL
Definition: PrintGraph.h:200
vtkm::worklet::contourtree_distributed::SHOW_BOUNDARY_TREE_ARC_ID
constexpr vtkm::Id SHOW_BOUNDARY_TREE_ARC_ID
Definition: PrintGraph.h:199
ContourTreeMesh.h
vtkm::worklet::contourtree_distributed::SHOW_BOUNDARY_NODES
constexpr vtkm::Id SHOW_BOUNDARY_NODES
Definition: PrintGraph.h:169
vtkm::worklet::contourtree_augmented::ContourTreeMesh::GetNumberOfVertices
vtkm::Id GetNumberOfVertices() const
Definition: ContourTreeMesh.h:173
Algorithm.h
vtkm::worklet::contourtree_distributed::SHOW_ALL_STANDARD
constexpr vtkm::Id SHOW_ALL_STANDARD
Definition: PrintGraph.h:251
vtkm::worklet::contourtree_distributed::SHOW_MESH_REGULAR_ID
constexpr vtkm::Id SHOW_MESH_REGULAR_ID
Definition: PrintGraph.h:175
vtkm::worklet::contourtree_distributed::NO_PER_NODE_VALUES
constexpr vtkm::Id NO_PER_NODE_VALUES
Definition: PrintGraph.h:152
vtkm::worklet::contourtree_distributed::SHOW_ALL_STRUCTURE
constexpr vtkm::Id SHOW_ALL_STRUCTURE
Definition: PrintGraph.h:225
vtkm::worklet::contourtree_distributed::SHOW_REGULAR_CRITICAL_BOUNDARY
constexpr vtkm::Id SHOW_REGULAR_CRITICAL_BOUNDARY
Definition: PrintGraph.h:240
vtkm::worklet::contourtree_distributed::SHOW_REGULAR_BOUNDARY
constexpr vtkm::Id SHOW_REGULAR_BOUNDARY
Definition: PrintGraph.h:238
InteriorForest.h
vtkm::worklet::contourtree_distributed::PER_REGULAR_NODE_BOUNDARY_FLAGS
constexpr vtkm::Id PER_REGULAR_NODE_BOUNDARY_FLAGS
Definition: PrintGraph.h:154
vtkm::worklet::contourtree_distributed::SHOW_HIERARCHICAL_STANDARD
constexpr vtkm::Id SHOW_HIERARCHICAL_STANDARD
Definition: PrintGraph.h:254
vtkm::worklet::contourtree_distributed::BoundaryTreeDotGraphPrint
VTKM_CONT std::string BoundaryTreeDotGraphPrint(const std::string &label, MeshType &mesh, MeshBoundaryExecObjType &meshBoundaryExecutionObject, vtkm::worklet::contourtree_distributed::BoundaryTree &boundaryTree, const vtkm::worklet::contourtree_augmented::mesh_dem::IdRelabeler *localToGlobalIdRelabeler, const vtkm::cont::ArrayHandle< T, StorageType > &field, const vtkm::Id showMask=vtkm::worklet::contourtree_distributed::SHOW_BOUNDARY_TREE_ALL, const bool printHeaderAndFooter=true)
Definition: PrintGraph.h:722
vtkm::worklet::contourtree_augmented::ContourTreeMesh::SortedValues
vtkm::cont::ArrayHandle< FieldType > SortedValues
Definition: ContourTreeMesh.h:199
Types.h
vtkm::worklet::contourtree_distributed::HierarchicalContourTree::WhichIteration
vtkm::worklet::contourtree_augmented::IdArrayType WhichIteration
Definition: HierarchicalContourTree.h:136
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
vtkm::worklet::contourtree_distributed::HierarchicalContourTree::Hypernodes
vtkm::worklet::contourtree_augmented::IdArrayType Hypernodes
Definition: HierarchicalContourTree.h:140
vtkm::worklet::contourtree_distributed::SHOW_REGULAR_STRUCTURE
constexpr vtkm::Id SHOW_REGULAR_STRUCTURE
Definition: PrintGraph.h:165
vtkm::cont::ArrayHandle::WritePortal
VTKM_CONT WritePortalType WritePortal() const
Get an array portal that can be used in the control environment.
Definition: ArrayHandle.h:435
vtkm::worklet::contourtree_distributed::SHOW_HYPERARC_ID
constexpr vtkm::Id SHOW_HYPERARC_ID
Definition: PrintGraph.h:189
vtkm::worklet::contourtree_distributed::PER_HYPER_NODE_VALUES
constexpr vtkm::Id PER_HYPER_NODE_VALUES
Definition: PrintGraph.h:157
vtkm::cont::ArrayHandleConstant
An array handle with a constant value.
Definition: ArrayHandleConstant.h:63
vtkm::worklet::contourtree_distributed::SHOW_SUPER_STRUCTURE
constexpr vtkm::Id SHOW_SUPER_STRUCTURE
Definition: PrintGraph.h:166
vtkm::worklet::contourtree_augmented::mesh_dem::IdRelabeler
A utility class that converts Ids from local to global given a mesh.
Definition: IdRelabeler.h:79
vtkm::worklet::contourtree_distributed::SHOW_SUPERNODE_ID
constexpr vtkm::Id SHOW_SUPERNODE_ID
Definition: PrintGraph.h:183
vtkm::worklet::contourtree_distributed::SHOW_SUPER_AND_HYPER_SIMPLE
constexpr vtkm::Id SHOW_SUPER_AND_HYPER_SIMPLE
Definition: PrintGraph.h:248
vtkm::worklet::contourtree_distributed::HierarchicalContourTree::Hyperarcs
vtkm::worklet::contourtree_augmented::IdArrayType Hyperarcs
Definition: HierarchicalContourTree.h:142
vtkm::worklet::contourtree_distributed::HierarchicalContourTree::DataValues
vtkm::cont::ArrayHandle< FieldType > DataValues
Definition: HierarchicalContourTree.h:110
vtkm::worklet::contourtree_distributed::BoundaryTree
Boundary Restricted Augmented Contour Tree (BRACT)
Definition: BoundaryTree.h:81
vtkm::worklet::contourtree_distributed::SHOW_BOUNDARY_TREE_VERTEX_ID
constexpr vtkm::Id SHOW_BOUNDARY_TREE_VERTEX_ID
Definition: PrintGraph.h:193
vtkm::worklet::contourtree_distributed::SHOW_BOUNDARY_INTERIOR_DIVISION
constexpr vtkm::Id SHOW_BOUNDARY_INTERIOR_DIVISION
Definition: PrintGraph.h:245
vtkm::worklet::contourtree_distributed::SHOW_CONTOUR_TREE_MESH_VERTEX_ID
constexpr vtkm::Id SHOW_CONTOUR_TREE_MESH_VERTEX_ID
Definition: PrintGraph.h:206
vtkm::worklet::contourtree_distributed::HierarchicalContourTree::Super2Hypernode
vtkm::worklet::contourtree_augmented::IdArrayType Super2Hypernode
Definition: HierarchicalContourTree.h:131
vtkm::worklet::contourtree_distributed::SHOW_NODE_ID
constexpr vtkm::Id SHOW_NODE_ID
Definition: PrintGraph.h:178
vtkm::cont::ArrayHandle::ReadPortal
VTKM_CONT ReadPortalType ReadPortal() const
Get an array portal that can be used in the control environment.
Definition: ArrayHandle.h:414
vtkm::worklet::contourtree_distributed::HierarchicalContourTree::Regular2Supernode
vtkm::worklet::contourtree_augmented::IdArrayType Regular2Supernode
Definition: HierarchicalContourTree.h:118
vtkm::worklet::contourtree_distributed::SHOW_HYPER_STRUCTURE
constexpr vtkm::Id SHOW_HYPER_STRUCTURE
Definition: PrintGraph.h:167
vtkm::worklet::contourtree_augmented::ContourTree::Arcs
IdArrayType Arcs
Definition: augmented/ContourTree.h:115
vtkm::worklet::contourtree_distributed::SHOW_CONTOUR_TREE_MESH_ALL
constexpr vtkm::Id SHOW_CONTOUR_TREE_MESH_ALL
Definition: PrintGraph.h:210
vtkm::worklet::contourtree_distributed
Definition: AddTerminalFlagsToUpDownNeighboursWorklet.h:63
vtkm::worklet::contourtree_distributed::SHOW_INTERIOR_FOREST_MESH_REGULAR_ID
constexpr vtkm::Id SHOW_INTERIOR_FOREST_MESH_REGULAR_ID
Definition: PrintGraph.h:218
ContourTree.h
vtkm::worklet::contourtree_distributed::BoundaryTree::Superarcs
vtkm::worklet::contourtree_augmented::IdArrayType Superarcs
Definition: BoundaryTree.h:88
vtkm::worklet::contourtree_distributed::SHOW_DATA_VALUE
constexpr vtkm::Id SHOW_DATA_VALUE
Definition: PrintGraph.h:174
vtkm::worklet::contourtree_augmented::ContourTreeMesh::NeighborOffsets
IdArrayType NeighborOffsets
Definition: ContourTreeMesh.h:210
vtkm::worklet::contourtree_augmented::NO_SUCH_ELEMENT
constexpr vtkm::Id NO_SUCH_ELEMENT
Definition: filter/scalar_topology/worklet/contourtree_augmented/Types.h:73
vtkm::worklet::contourtree_distributed::SHOW_HYPERPARENT
constexpr vtkm::Id SHOW_HYPERPARENT
Definition: PrintGraph.h:184
vtkm::worklet::contourtree_distributed::SHOW_ALL_IDS
constexpr vtkm::Id SHOW_ALL_IDS
Definition: PrintGraph.h:228
vtkm::worklet::contourtree_augmented::ContourTree::WhenTransferred
IdArrayType WhenTransferred
Definition: augmented/ContourTree.h:139
vtkm::worklet::contourtree_distributed::HierarchicalContourTree::RegularNodeSortOrder
vtkm::worklet::contourtree_augmented::IdArrayType RegularNodeSortOrder
Definition: HierarchicalContourTree.h:115
vtkm::worklet::contourtree_distributed::SHOW_ARC_ID
constexpr vtkm::Id SHOW_ARC_ID
Definition: PrintGraph.h:180
vtkm::worklet::contourtree_distributed::SHOW_GLOBAL_ID
constexpr vtkm::Id SHOW_GLOBAL_ID
Definition: PrintGraph.h:173