Make volume metric data filter output and print tree in app; general clean up

This commit is contained in:
Gunther H. Weber 2021-10-07 17:26:31 -07:00
parent 6cd7e0894d
commit 2b6fd71c5b
8 changed files with 151 additions and 129 deletions

@ -75,6 +75,7 @@
#include <vtkm/worklet/contourtree_augmented/PrintVectors.h>
#include <vtkm/worklet/contourtree_augmented/ProcessContourTree.h>
#include <vtkm/worklet/contourtree_augmented/Types.h>
#include <vtkm/worklet/contourtree_distributed/HierarchicalContourTree.h>
#include <vtkm/worklet/contourtree_distributed/TreeCompiler.h>
// clang-format off
@ -86,15 +87,17 @@ VTKM_THIRDPARTY_POST_INCLUDE
#include <mpi.h>
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <string>
#include <utility>
#include <vector>
using ValueType = vtkm::Float64;
#define SINGLE_FILE_STDOUT_STDERR
// Simple helper class for parsing the command line options
@ -228,10 +231,10 @@ int main(int argc, char* argv[])
{
saveDotFiles = true;
}
bool saveTreeCompilerData = false;
if (parser.hasOption("--saveTreeCompilerData"))
bool saveOutputData = false;
if (parser.hasOption("--saveOutputData"))
{
saveTreeCompilerData = true;
saveOutputData = true;
}
bool forwardSummary = false;
if (parser.hasOption("--forwardSummary"))
@ -284,7 +287,7 @@ int main(int argc, char* argv[])
std::cout << "--preSplitFiles Input data is already pre-split into blocks." << std::endl;
std::cout << "--saveDot Save DOT files of the distributed contour tree " << std::endl
<< " computation (Default=False). " << std::endl;
std::cout << "--saveTreeCompilerData Save data files needed for the tree compiler"
std::cout << "--saveOutputData Save data files with hierarchical tree or volume data"
<< std::endl;
std::cout << "--numBlocks Number of blocks to use during computation "
<< "(Default=number of MPI ranks.)" << std::endl;
@ -308,7 +311,7 @@ int main(int argc, char* argv[])
<< " mc=" << useMarchingCubes << std::endl
<< " useFullBoundary=" << !useBoundaryExtremaOnly << std::endl
<< " saveDot=" << saveDotFiles << std::endl
<< " saveTreeCompilerData=" << saveTreeCompilerData << std::endl
<< " saveOutputData=" << saveOutputData << std::endl
<< " forwardSummary=" << forwardSummary << std::endl
<< " nblocks=" << numBlocks << std::endl);
}
@ -540,7 +543,6 @@ int main(int argc, char* argv[])
}
// Read data
using ValueType = vtkm::Float64;
std::vector<ValueType> values(numVertices);
if (filename.compare(filename.length() - 5, 5, ".bdem") == 0)
{
@ -626,7 +628,6 @@ int main(int argc, char* argv[])
vtkm::cont::DataSet inDataSet;
// Currently FloatDefualt would be fine, but it could cause problems if we ever
// read binary files here.
using ValueType = vtkm::Float64;
std::vector<ValueType> values;
std::vector<vtkm::Id> dims;
@ -867,42 +868,63 @@ int main(int argc, char* argv[])
vtkm::Float64 postFilterSyncTime = currTime - prevTime;
prevTime = currTime;
/*
std::cout << "Result dataset has " << result.GetNumberOfPartitions() << " partitions" << std::endl;
for (vtkm::Id ds_no = 0; ds_no < result.GetNumberOfPartitions(); ++ds_no)
if (saveOutputData)
{
auto ds = result.GetPartition(ds_no);
for (vtkm::Id f_no = 0; f_no < ds.GetNumberOfFields(); ++f_no)
if (augmentHierarchicalTree)
{
auto field = ds.GetField(f_no);
std::cout << field.GetName() << ": ";
PrintArrayContents(field.GetData());
std::cout << std::endl;
for (vtkm::Id ds_no = 0; ds_no < result.GetNumberOfPartitions(); ++ds_no)
{
auto ds = result.GetPartition(ds_no);
vtkm::worklet::contourtree_augmented::IdArrayType supernodes;
ds.GetField("Supernodes").GetData().AsArrayHandle(supernodes);
vtkm::worklet::contourtree_augmented::IdArrayType superarcs;
ds.GetField("Superarcs").GetData().AsArrayHandle(superarcs);
vtkm::worklet::contourtree_augmented::IdArrayType regularNodeGlobalIds;
ds.GetField("RegularNodeGlobalIds").GetData().AsArrayHandle(regularNodeGlobalIds);
vtkm::Id totalVolume = globalSize[0] * globalSize[1] * globalSize[2];
vtkm::worklet::contourtree_augmented::IdArrayType intrinsicVolume;
ds.GetField("IntrinsicVolume").GetData().AsArrayHandle(intrinsicVolume);
vtkm::worklet::contourtree_augmented::IdArrayType dependentVolume;
ds.GetField("DependentVolume").GetData().AsArrayHandle(dependentVolume);
std::string dumpVolumesString =
vtkm::worklet::contourtree_distributed::HierarchicalContourTree<ValueType>::DumpVolumes(
supernodes,
superarcs,
regularNodeGlobalIds,
totalVolume,
intrinsicVolume,
dependentVolume);
std::string volumesFileName = std::string("TreeWithVolumes_Rank_") +
std::to_string(static_cast<int>(rank)) + std::string("_Block_") +
std::to_string(static_cast<int>(ds_no)) + std::string(".txt");
std::ofstream treeStream(volumesFileName.c_str());
treeStream << dumpVolumesString;
}
}
else
{
for (vtkm::Id ds_no = 0; ds_no < result.GetNumberOfPartitions(); ++ds_no)
{
vtkm::worklet::contourtree_distributed::TreeCompiler treeCompiler;
treeCompiler.AddHierarchicalTree(result.GetPartition(ds_no));
char fname[256];
std::snprintf(fname,
sizeof(fname),
"TreeCompilerOutput_Rank%d_Block%d.dat",
rank,
static_cast<int>(ds_no));
FILE* out_file = std::fopen(fname, "wb");
treeCompiler.WriteBinary(out_file);
std::fclose(out_file);
}
}
}
*/
if (saveTreeCompilerData)
{
for (vtkm::Id ds_no = 0; ds_no < result.GetNumberOfPartitions(); ++ds_no)
{
vtkm::worklet::contourtree_distributed::TreeCompiler treeCompiler;
treeCompiler.AddHierarchicalTree(result.GetPartition(ds_no));
char fname[256];
std::snprintf(fname,
sizeof(fname),
"TreeCompilerOutput_Rank%d_Block%d.dat",
rank,
static_cast<int>(ds_no));
FILE* out_file = std::fopen(fname, "wb");
treeCompiler.WriteBinary(out_file);
std::fclose(out_file);
}
}
currTime = totalTime.GetElapsedTime();
vtkm::Float64 saveTreeCompilerDataTime = currTime - prevTime;
vtkm::Float64 saveOutputDataTime = currTime - prevTime;
prevTime = currTime;
std::cout << std::flush;
@ -951,7 +973,7 @@ int main(int argc, char* argv[])
<< std::setw(42) << std::left << " Post filter Sync"
<< ": " << postFilterSyncTime << " seconds" << std::endl
<< std::setw(42) << std::left << " Save Tree Compiler Data"
<< ": " << saveTreeCompilerDataTime << " seconds" << std::endl
<< ": " << saveOutputDataTime << " seconds" << std::endl
<< std::setw(42) << std::left << " Total Time"
<< ": " << currTime << " seconds");

@ -24,7 +24,7 @@ rm ${filename}
echo "Running HACT"
n_parts=$(($2*$2))
mpirun -np 4 ./ContourTree_Distributed --vtkm-device Any --preSplitFiles --saveTreeCompilerData --augmentHierarchicalTree --numBlocks=${n_parts} ${fileroot}_part_%d_of_${n_parts}.txt
mpirun -np 4 ./ContourTree_Distributed --vtkm-device Any --preSplitFiles --saveOutputData --augmentHierarchicalTree --numBlocks=${n_parts} ${fileroot}_part_%d_of_${n_parts}.txt
rm ${fileroot}_part_*_of_${n_parts}.txt
echo "Compiling Outputs"

@ -998,7 +998,6 @@ VTKM_CONT void ContourTreeUniformDistributed::DoPostExecute(
}
// 4. Create output data set
// TODO: This should use the augmented tree if the tree was augmented not the unaugmented tree
std::vector<vtkm::cont::DataSet> hierarchicalTreeOutputDataSet(localDataBlocks.size());
master.foreach (
[&](
@ -1102,11 +1101,12 @@ VTKM_CONT void ContourTreeUniformDistributed::DoPostExecute(
static_cast<vtkm::Id>(blockNo));
localHyperSweeperBlocks[blockNo] =
new vtkm::worklet::contourtree_distributed::HyperSweepBlock<FieldType>(
currInBlock->GlobalBlockId, // TODO/FIXME: Check what block ID this should be
currBlockOrigin, //currInBlock->BlockOrigin,
currBlockSize, // currInBlock->BlockSize,
blockNo,
currInBlock->GlobalBlockId,
currBlockOrigin,
currBlockSize,
spatialDecomp.GlobalSize,
*currInBlock->HierarchicalAugmenter.AugmentedTree); // currInBlock->HierarchicalTree);
*currInBlock->HierarchicalAugmenter.AugmentedTree);
hierarchical_hyper_sweep_master.add(
vtkmdiyLocalBlockGids[blockNo], localHyperSweeperBlocks[blockNo], new vtkmdiy::Link());
}
@ -1118,20 +1118,16 @@ VTKM_CONT void ContourTreeUniformDistributed::DoPostExecute(
const vtkmdiy::Master::ProxyWithLink&) {
// Create HyperSweeper
#ifdef DEBUG_PRINT
VTKM_LOG_S(vtkm::cont::LogLevel::Info, "Block " << b->BlockNo);
VTKM_LOG_S(vtkm::cont::LogLevel::Info, "Block " << b->GlobalBlockId);
VTKM_LOG_S(vtkm::cont::LogLevel::Info,
b->HierarchicalContourTree.DebugPrint(
"Before initializing HierarchicalHyperSweeper", __FILE__, __LINE__));
#endif
vtkm::worklet::contourtree_distributed::HierarchicalHyperSweeper<vtkm::Id, FieldType>
hyperSweeper(
b->BlockNo, b->HierarchicalContourTree, b->IntrinsicVolume, b->DependentVolume);
b->GlobalBlockId, b->HierarchicalContourTree, b->IntrinsicVolume, b->DependentVolume);
// Create mesh and initialize vertex counts
#ifdef DEBUG_PRINT
std::cout << "idRelabeler parameters: origin: " << b->Origin << " size: " << b->Size
<< " global size: " << b->GlobalSize;
#endif
// Create mesh and initialize vertex counts
vtkm::worklet::contourtree_augmented::mesh_dem::IdRelabeler idRelabeler{ b->Origin,
b->Size,
b->GlobalSize };
@ -1153,19 +1149,19 @@ VTKM_CONT void ContourTreeUniformDistributed::DoPostExecute(
}
#ifdef DEBUG_PRINT
std::cout << "Block " << b->BlockNo << std::endl;
std::cout << "=========" << std::endl;
vtkm::worklet::contourtree_augmented::PrintHeader(b->IntrinsicVolume.GetNumberOfValues(),
std::cout);
vtkm::worklet::contourtree_augmented::PrintIndices(
"Intrinsic Volume", b->IntrinsicVolume, -1, std::cout);
vtkm::worklet::contourtree_augmented::PrintIndices(
"Dependent Volume", b->DependentVolume, -1, std::cout);
VTKM_LOG_S(vtkm::cont::LogLevel::Info, "Block " << b->BlockNo);
VTKM_LOG_S(vtkm::cont::LogLevel::Info, "Block " << b->GlobalBlockId);
VTKM_LOG_S(vtkm::cont::LogLevel::Info,
b->HierarchicalContourTree.DebugPrint(
"After initializing intrinsic vertex count", __FILE__, __LINE__));
std::ostringstream volumeStream;
vtkm::worklet::contourtree_augmented::PrintHeader(b->IntrinsicVolume.GetNumberOfValues(),
volumeStream);
vtkm::worklet::contourtree_augmented::PrintIndices(
"Intrinsic Volume", b->IntrinsicVolume, -1, volumeStream);
vtkm::worklet::contourtree_augmented::PrintIndices(
"Dependent Volume", b->DependentVolume, -1, volumeStream);
VTKM_LOG_S(vtkm::cont::LogLevel::Info, volumeStream.str());
VTKM_LOG_S(vtkm::cont::LogLevel::Info, "FLUSH" << std::endl << std::flush);
#endif
// Initialize dependentVolume by copy from intrinsicVolume
vtkm::cont::Algorithm::Copy(b->IntrinsicVolume, b->DependentVolume);
@ -1174,7 +1170,7 @@ VTKM_CONT void ContourTreeUniformDistributed::DoPostExecute(
hyperSweeper.LocalHyperSweep();
#ifdef DEBUG_PRINT
VTKM_LOG_S(vtkm::cont::LogLevel::Info, "Block " << b->BlockNo);
VTKM_LOG_S(vtkm::cont::LogLevel::Info, "Block " << b->GlobalBlockId);
VTKM_LOG_S(
vtkm::cont::LogLevel::Info,
b->HierarchicalContourTree.DebugPrint("After local hypersweep", __FILE__, __LINE__));
@ -1189,35 +1185,31 @@ VTKM_CONT void ContourTreeUniformDistributed::DoPostExecute(
partners,
vtkm::worklet::contourtree_distributed::CobmineHyperSweepBlockFunctor<FieldType>{});
// Print
vtkm::Id totalVolume =
spatialDecomp.GlobalSize[0] * spatialDecomp.GlobalSize[1] * spatialDecomp.GlobalSize[2];
// Print & add to output data set
//std::vector<vtkm::cont::DataSet> hierarchicalTreeAndVolumeOutputDataSet(localDataBlocks.size());
hierarchical_hyper_sweep_master.foreach (
[&totalVolume, &rank](vtkm::worklet::contourtree_distributed::HyperSweepBlock<FieldType>* b,
const vtkmdiy::Master::ProxyWithLink&) {
[&](vtkm::worklet::contourtree_distributed::HyperSweepBlock<FieldType>* b,
const vtkmdiy::Master::ProxyWithLink&) {
vtkm::cont::Field intrinsicVolumeField(
"IntrinsicVolume", vtkm::cont::Field::Association::WHOLE_MESH, b->IntrinsicVolume);
hierarchicalTreeOutputDataSet[b->LocalBlockNo].AddField(intrinsicVolumeField);
vtkm::cont::Field dependentVolumeField(
"DependentVolume", vtkm::cont::Field::Association::WHOLE_MESH, b->DependentVolume);
hierarchicalTreeOutputDataSet[b->LocalBlockNo].AddField(dependentVolumeField);
#ifdef DEBUG_PRINT
std::cout << "Block " << b->BlockNo << std::endl;
std::cout << "=========" << std::endl;
vtkm::worklet::contourtree_augmented::PrintHeader(b->IntrinsicVolume.GetNumberOfValues(),
std::cout);
vtkm::worklet::contourtree_augmented::PrintIndices(
"Intrinsic Volume", b->IntrinsicVolume, -1, std::cout);
vtkm::worklet::contourtree_augmented::PrintIndices(
"Dependent Volume", b->DependentVolume, -1, std::cout);
VTKM_LOG_S(vtkm::cont::LogLevel::Info, "Block " << b->BlockNo);
VTKM_LOG_S(vtkm::cont::LogLevel::Info, "Block " << b->GlobalBlockId);
VTKM_LOG_S(
vtkm::cont::LogLevel::Info,
b->HierarchicalContourTree.DebugPrint("Called from DumpVolumes", __FILE__, __LINE__));
std::ostringstream volumeStream;
vtkm::worklet::contourtree_augmented::PrintHeader(b->IntrinsicVolume.GetNumberOfValues(),
volumeStream);
vtkm::worklet::contourtree_augmented::PrintIndices(
"Intrinsic Volume", b->IntrinsicVolume, -1, volumeStream);
vtkm::worklet::contourtree_augmented::PrintIndices(
"Dependent Volume", b->DependentVolume, -1, volumeStream);
VTKM_LOG_S(vtkm::cont::LogLevel::Info, volumeStream.str());
#endif
std::string dumpVolumesString = b->HierarchicalContourTree.DumpVolumes(
totalVolume, b->IntrinsicVolume, b->DependentVolume);
VTKM_LOG_S(vtkm::cont::LogLevel::Info, dumpVolumesString);
std::string volumesFileName = std::string("TreeWithVolumes_Rank_") +
std::to_string(static_cast<int>(rank)) + std::string("_Block_") +
std::to_string(static_cast<int>(b->BlockNo)) + std::string(".txt");
std::ofstream treeStream(volumesFileName.c_str());
treeStream << dumpVolumesString;
});
// Clean-up

@ -54,6 +54,7 @@
#define vtk_m_worklet_contourtree_distributed_combinehypersweepblockfunctor_h
#include <vtkm/Types.h>
#include <vtkm/cont/ArrayGetValues.h>
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/worklet/contourtree_distributed/HyperSweepBlock.h>
@ -63,6 +64,7 @@ VTKM_THIRDPARTY_PRE_INCLUDE
VTKM_THIRDPARTY_POST_INCLUDE
// clang-format on
#define DEBUG_PRINT_COMBINED_BLOCK_IDS
namespace vtkm
{
@ -89,7 +91,6 @@ struct CobmineHyperSweepBlockFunctor
for (const int ingid : incoming)
{
std::cout << rp.round() << std::endl;
auto roundNo = rp.round() - 1;
// NOTE/IMPORTANT: In each round we should have only one swap partner (despite for-loop here).
// If that assumption does not hold, it will break things.
@ -97,26 +98,21 @@ struct CobmineHyperSweepBlockFunctor
// Otherwise, we may need to process more than one incoming block
if (ingid != selfid)
{
vtkm::Id incomingBlockNo;
rp.dequeue(ingid, incomingBlockNo);
// std::cout << "Combining block " << b->BlockNo << " with " << incomingBlockNo << std::endl;
#ifdef DEBUG_PRINT_COMBINED_BLOCK_IDS
vtkm::Id incomingGlobalBlockId;
rp.dequeue(ingid, incomingGlobalBlockId);
VTKM_LOG_S(vtkm::cont::LogLevel::Info,
"Combining local block " << b->GlobalBlockId << " with incomoing block "
<< incomingGlobalBlockId);
#endif
vtkm::cont::ArrayHandle<vtkm::Id> incomingIntrinsicVolume;
rp.dequeue(ingid, incomingIntrinsicVolume);
vtkm::cont::ArrayHandle<vtkm::Id> incomingDependentVolume;
rp.dequeue(ingid, incomingDependentVolume);
// TODO/FIXME: Replace with something more efficient
vtkm::Id numSupernodesToProcess =
b->HierarchicalContourTree.FirstSupernodePerIteration[roundNo].ReadPortal().Get(0);
vtkm::Id numSupernodesToProcess = vtkm::cont::ArrayGetValue(
vtkm::Id{ 0 }, b->HierarchicalContourTree.FirstSupernodePerIteration[roundNo]);
/*
std::cout << "Block " << b->BlockNo << " Round " << roundNo << ": " << numSupernodesToProcess << " entries to process" << std::endl;
vtkm::worklet::contourtree_augmented::PrintIndices(
"Intrinsic Volume (B)", b->IntrinsicVolume, -1, std::cout);
vtkm::worklet::contourtree_augmented::PrintIndices(
"Dependent Volume (B)", b->DependentVolume, -1, std::cout);
*/
auto intrinsicVolumeView =
make_ArrayHandleView(b->IntrinsicVolume, 0, numSupernodesToProcess);
auto incomingIntrinsicVolumeView =
@ -133,13 +129,6 @@ struct CobmineHyperSweepBlockFunctor
vtkm::cont::Algorithm::Transform(
dependentVolumeView, incomingDependentVolumeView, tempSum, vtkm::Sum());
vtkm::cont::Algorithm::Copy(tempSum, dependentVolumeView);
/*
vtkm::worklet::contourtree_augmented::PrintIndices(
"Intrinsic Volume (A)", b->IntrinsicVolume, -1, std::cout);
vtkm::worklet::contourtree_augmented::PrintIndices(
"Dependent Volume (A)", b->DependentVolume, -1, std::cout);
*/
}
}
@ -148,7 +137,9 @@ struct CobmineHyperSweepBlockFunctor
auto target = rp.out_link().target(cc);
if (target.gid != selfid)
{
rp.enqueue(target, b->BlockNo);
#ifdef DEBUG_PRINT_COMBINED_BLOCK_IDS
rp.enqueue(target, b->GlobalBlockId);
#endif
rp.enqueue(target, b->IntrinsicVolume);
rp.enqueue(target, b->DependentVolume);
}

@ -231,10 +231,13 @@ public:
// modified version of dumpSuper() that also gives volume counts
VTKM_CONT
std::string DumpVolumes(
static std::string DumpVolumes(
const vtkm::worklet::contourtree_augmented::IdArrayType& supernodes,
const vtkm::worklet::contourtree_augmented::IdArrayType& superarcs,
const vtkm::worklet::contourtree_augmented::IdArrayType& regularNodeGlobalIds,
vtkm::Id totalVolume,
const vtkm::worklet::contourtree_augmented::IdArrayType& intrinsicVolume,
const vtkm::worklet::contourtree_augmented::IdArrayType& dependentVolume) const;
const vtkm::worklet::contourtree_augmented::IdArrayType& dependentVolume);
private:
/// Used internally to Invoke worklets
@ -898,9 +901,12 @@ std::string HierarchicalContourTree<FieldType>::PrintTreeStats() const
// modified version of dumpSuper() that also gives volume counts
template <typename FieldType>
std::string HierarchicalContourTree<FieldType>::DumpVolumes(
const vtkm::worklet::contourtree_augmented::IdArrayType& supernodes,
const vtkm::worklet::contourtree_augmented::IdArrayType& superarcs,
const vtkm::worklet::contourtree_augmented::IdArrayType& regularNodeGlobalIds,
vtkm::Id totalVolume,
const vtkm::worklet::contourtree_augmented::IdArrayType& intrinsicVolume,
const vtkm::worklet::contourtree_augmented::IdArrayType& dependentVolume) const
const vtkm::worklet::contourtree_augmented::IdArrayType& dependentVolume)
{ // DumpVolumes()
// a local string stream to build the output
std::stringstream outStream;
@ -911,12 +917,12 @@ std::string HierarchicalContourTree<FieldType>::DumpVolumes(
// loop through all superarcs.
// We use regular ReadPortals here since this requires access to many values anyways
auto supernodesPortal = this->Supernodes.ReadPortal();
auto regularNodeGlobalIdsPortal = this->RegularNodeGlobalIds.ReadPortal();
auto superarcsPortal = this->Superarcs.ReadPortal();
auto supernodesPortal = supernodes.ReadPortal();
auto regularNodeGlobalIdsPortal = regularNodeGlobalIds.ReadPortal();
auto superarcsPortal = superarcs.ReadPortal();
auto intrinsicVolumePortal = intrinsicVolume.ReadPortal();
auto dependentVolumePortal = dependentVolume.ReadPortal();
for (vtkm::Id supernode = 0; supernode < this->Supernodes.GetNumberOfValues(); supernode++)
for (vtkm::Id supernode = 0; supernode < supernodes.GetNumberOfValues(); supernode++)
{ // per supernode
// convert all the way down to global regular IDs
vtkm::Id fromRegular = supernodesPortal.Get(supernode);

@ -265,7 +265,6 @@ void HierarchicalHyperSweeper<SweepValueType, ContourTreeFieldType>::InitializeI
auto findRegularByGlobal = hierarchicalTree.GetFindRegularByGlobal();
auto computeSuperparentIdsWorklet = vtkm::worklet::contourtree_distributed::
hierarchical_hyper_sweeper::InitializeIntrinsicVertexCountComputeSuperparentIdsWorklet();
std::cout << "Invoking computeSuperparentIdsWorklet" << std::endl;
Invoke(computeSuperparentIdsWorklet, // worklet to run
globalIds, // input
findRegularByGlobal, // input

@ -68,13 +68,15 @@ template <typename ContourTreeDataFieldType>
struct HyperSweepBlock
{
HyperSweepBlock(
const vtkm::Id& blockNo,
const vtkm::Id& localBlockNo,
const vtkm::Id& globalBlockId,
const vtkm::Id3& origin,
const vtkm::Id3& size,
const vtkm::Id3& globalSize,
const vtkm::worklet::contourtree_distributed::HierarchicalContourTree<ContourTreeDataFieldType>&
hierarchicalContourTree)
: BlockNo(blockNo)
: LocalBlockNo(localBlockNo)
, GlobalBlockId(globalBlockId)
, Origin(origin)
, Size(size)
, GlobalSize(globalSize)
@ -83,7 +85,8 @@ struct HyperSweepBlock
}
// Mesh information
vtkm::Id BlockNo;
vtkm::Id LocalBlockNo;
vtkm::Id GlobalBlockId;
vtkm::Id3 Origin;
vtkm::Id3 Size;
vtkm::Id3 GlobalSize;

@ -212,8 +212,12 @@ void TestHierarchicalHyperSweeper()
{
localHyperSweeperBlocks[blockNo] =
new vtkm::worklet::contourtree_distributed::HyperSweepBlock<ContourTreeDataFieldType>(
blockNo, origins[blockNo], sizes[blockNo], globalSize, hct[blockNo]);
std::cout << blockNo << " -> " << vtkmdiyLocalBlockGids[blockNo] << std::endl;
blockNo,
vtkmdiyLocalBlockGids[blockNo],
origins[blockNo],
sizes[blockNo],
globalSize,
hct[blockNo]);
master.add(
vtkmdiyLocalBlockGids[blockNo], localHyperSweeperBlocks[blockNo], new vtkmdiy::Link());
}
@ -222,15 +226,15 @@ void TestHierarchicalHyperSweeper()
[](vtkm::worklet::contourtree_distributed::HyperSweepBlock<ContourTreeDataFieldType>* b,
const vtkmdiy::Master::ProxyWithLink&) {
// Create HyperSweeper
std::cout << "Block " << b->BlockNo << std::endl;
std::cout << "Block " << b->GlobalBlockId << std::endl;
std::cout << b->HierarchicalContourTree.DebugPrint(
"Before initializing HyperSweeper", __FILE__, __LINE__);
vtkm::worklet::contourtree_distributed::HierarchicalHyperSweeper<vtkm::Id,
ContourTreeDataFieldType>
hyperSweeper(
b->BlockNo, b->HierarchicalContourTree, b->IntrinsicVolume, b->DependentVolume);
b->GlobalBlockId, b->HierarchicalContourTree, b->IntrinsicVolume, b->DependentVolume);
std::cout << "Block " << b->BlockNo << std::endl;
std::cout << "Block " << b->GlobalBlockId << std::endl;
std::cout << b->HierarchicalContourTree.DebugPrint(
"After initializing HyperSweeper", __FILE__, __LINE__);
// Create mesh and initialize vertex counts
@ -254,7 +258,7 @@ void TestHierarchicalHyperSweeper()
b->HierarchicalContourTree, mesh, idRelabeler, b->IntrinsicVolume);
}
std::cout << "Block " << b->BlockNo << std::endl;
std::cout << "Block " << b->GlobalBlockId << std::endl;
std::cout << b->HierarchicalContourTree.DebugPrint(
"After initializing intrinsic vertex count", __FILE__, __LINE__);
// Initialize dependentVolume by copy from intrinsicVolume
@ -262,7 +266,7 @@ void TestHierarchicalHyperSweeper()
// Perform the local hypersweep
hyperSweeper.LocalHyperSweep();
std::cout << "Block " << b->BlockNo << std::endl;
std::cout << "Block " << b->GlobalBlockId << std::endl;
std::cout << b->HierarchicalContourTree.DebugPrint(
"After local hypersweep", __FILE__, __LINE__);
});
@ -286,7 +290,7 @@ void TestHierarchicalHyperSweeper()
[&totalVolume](
vtkm::worklet::contourtree_distributed::HyperSweepBlock<ContourTreeDataFieldType>* b,
const vtkmdiy::Master::ProxyWithLink&) {
std::cout << "Block " << b->BlockNo << std::endl;
std::cout << "Block " << b->GlobalBlockId << std::endl;
std::cout << "=========" << std::endl;
vtkm::worklet::contourtree_augmented::PrintHeader(b->IntrinsicVolume.GetNumberOfValues(),
std::cout);
@ -297,8 +301,13 @@ void TestHierarchicalHyperSweeper()
std::cout << b->HierarchicalContourTree.DebugPrint(
"Called from DumpVolumes", __FILE__, __LINE__);
std::cout << b->HierarchicalContourTree.DumpVolumes(
totalVolume, b->IntrinsicVolume, b->DependentVolume);
std::cout << vtkm::worklet::contourtree_distributed::HierarchicalContourTree<
ContourTreeDataFieldType>::DumpVolumes(b->HierarchicalContourTree.Supernodes,
b->HierarchicalContourTree.Superarcs,
b->HierarchicalContourTree.RegularNodeGlobalIds,
totalVolume,
b->IntrinsicVolume,
b->DependentVolume);
});
// Clean-up