53 #ifndef vtk_m_worklet_contourtree_augmented_contourtree_h
54 #define vtk_m_worklet_contourtree_augmented_contourtree_h
77 namespace contourtree_augmented
82 "red",
"red4",
"green",
"green4",
"royalblue",
"royalblue4",
83 "cyan",
"cyan4",
"magenta",
"magenta4",
"yellow",
"yellow4"
169 inline std::string
DebugPrint(
const char* message,
const char* fileName,
long lineNum)
const;
172 inline void PrintContent(std::ostream& outStream = std::cout)
const;
210 outStream << std::endl;
216 outStream << std::endl;
223 outStream << std::endl;
224 outStream <<
"NumIterations: " << this->
NumIterations << std::endl;
231 const char* fileName,
234 std::stringstream resultStream;
235 resultStream << std::endl;
236 resultStream <<
"---------------------------" << std::endl;
237 resultStream << std::setw(30) << std::left << fileName <<
":" << std::right << std::setw(4)
238 << lineNum << std::endl;
239 resultStream << std::left << std::string(message) << std::endl;
240 resultStream <<
"Contour Tree Contains: " << std::endl;
241 resultStream <<
"---------------------------" << std::endl;
242 resultStream << std::endl;
246 return resultStream.str();
253 printf(
"digraph G\n\t{\n");
254 printf(
"\tsize=\"6.5, 9\"\n\tratio=\"fill\"\n");
268 printf(
"\tnode s%lli [style=filled,fillcolor=%s]\n",
269 static_cast<vtkm::Int64
>(supernodesPortal.Get(supernode)),
282 "\tedge s%lli -> s%lli[label=S%lli,dir=back]\n",
283 static_cast<vtkm::Int64
>(supernodesPortal.Get(
MaskedIndex(superarcsPortal.Get(supernode)))),
284 static_cast<vtkm::Int64
>(supernodesPortal.Get(supernode)),
285 static_cast<vtkm::Int64
>(supernode));
288 "\tedge s%lli -> s%lli[label=S%lli]\n",
289 static_cast<vtkm::Int64
>(supernodesPortal.Get(supernode)),
290 static_cast<vtkm::Int64
>(supernodesPortal.Get(
MaskedIndex(superarcsPortal.Get(supernode)))),
291 static_cast<vtkm::Int64
>(supernode));
302 "\ts%lli -> s%lli [constraint=false][width=5.0][label=\"H%lli\\nW%lli\"]\n",
303 static_cast<vtkm::Int64
>(supernodesPortal.Get(hypernodesPortal.Get(hypernode))),
304 static_cast<vtkm::Int64
>(supernodesPortal.Get(
MaskedIndex(hyperarcsPortal.Get(hypernode)))),
305 static_cast<vtkm::Int64
>(hypernode),
306 static_cast<vtkm::Int64
>(
307 MaskedIndex(whenTransferredPortal.Get(hypernodesPortal.Get(hypernode)))));
313 printf(
"\ts%lli -> s%lli [constraint=false][style=dotted]\n",
314 static_cast<vtkm::Int64
>(supernodesPortal.Get(supernode)),
315 static_cast<vtkm::Int64
>(
316 supernodesPortal.Get(hypernodesPortal.Get(hyperparentsPortal.Get(supernode)))));
322 vtkm::Id firstChild = hypernodesPortal.Get(hypernode);
325 : hypernodesPortal.Get(hypernode + 1);
326 printf(
"\tsubgraph H%lli{ ",
static_cast<vtkm::Int64
>(hypernode));
327 for (
vtkm::Id supernode = firstChild; supernode < childSentinel; supernode++)
329 printf(
"s%lli ",
static_cast<vtkm::Int64
>(supernodesPortal.Get(supernode)));
341 std::vector<vtkm::Id> minPath;
342 std::vector<vtkm::Id> maxPath;
343 std::vector<vtkm::Id> supernodeCount;
344 std::vector<vtkm::Id> hypernodeCount;
350 long whichIteration = -1;
356 vtkm::Id supernodeID = hypernodesPortal.Get(hypernode);
361 if (whichIteration != iterationNo)
366 maxPath.push_back(0);
367 supernodeCount.push_back(0);
368 hypernodeCount.push_back(0);
378 pathLength = hypernodesPortal.Get(hypernode + 1) - supernodeID;
381 if (pathLength < minPath[
static_cast<std::size_t
>(whichIteration)])
383 minPath[
static_cast<std::size_t
>(whichIteration)] = pathLength;
385 if (pathLength > maxPath[
static_cast<std::size_t
>(whichIteration)])
387 maxPath[
static_cast<std::size_t
>(whichIteration)] = pathLength;
389 supernodeCount[
static_cast<std::size_t
>(whichIteration)] += pathLength;
390 hypernodeCount[
static_cast<std::size_t
>(whichIteration)]++;
394 std::stringstream resultString;
395 for (std::size_t iteration = 0; iteration < minPath.size(); iteration++)
397 double averagePath =
static_cast<double>(supernodeCount[iteration]) /
398 static_cast<double>(hypernodeCount[iteration]);
399 resultString <<
"Iteration: " << iteration <<
" Hyper: " << hypernodeCount[iteration]
400 <<
" Super: " << supernodeCount[iteration] <<
" Min: " << minPath[iteration]
401 <<
" Avg: " << averagePath <<
" Max: " << maxPath[iteration] << std::endl;
407 std::cout << resultString.str() << std::endl;
410 return resultString.str();
415 std::stringstream arraySizeLog;
416 arraySizeLog << std::setw(42) << std::left <<
" #Nodes"
418 << std::setw(42) << std::left <<
" #Arcs"
420 << std::setw(42) << std::left <<
" #Superparents"
422 << std::setw(42) << std::left <<
" #Superarcs"
424 << std::setw(42) << std::left <<
" #Supernodes"
426 << std::setw(42) << std::left <<
" #Hyperparents"
428 << std::setw(42) << std::left <<
" #WhenTransferred"
430 << std::setw(42) << std::left <<
" #Hypernodes"
432 << std::setw(42) << std::left <<
" #Hyperarcs"
434 return arraySizeLog.str();