mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-19 18:45:43 +00:00
Execute HyperSweeper only if tree is augmented
This commit is contained in:
parent
b2d43aadc6
commit
d23560edd2
@ -1084,112 +1084,116 @@ VTKM_CONT void ContourTreeUniformDistributed::DoPostExecute(
|
|||||||
timer.Start();
|
timer.Start();
|
||||||
|
|
||||||
// BEGIN: THIS SHOULD GO INTO A SEPARATE FILTER
|
// BEGIN: THIS SHOULD GO INTO A SEPARATE FILTER
|
||||||
vtkmdiy::Master hierarchical_hyper_sweep_master(comm,
|
if (this->AugmentHierarchicalTree)
|
||||||
1, // Use 1 thread, VTK-M will do the treading
|
|
||||||
-1 // All block in memory
|
|
||||||
);
|
|
||||||
|
|
||||||
vtkm::worklet::contourtree_distributed::HyperSweepBlock<FieldType>*
|
|
||||||
localHyperSweeperBlocks[localDataBlocks.size()];
|
|
||||||
for (size_t blockNo = 0; blockNo < localDataBlocks.size(); ++blockNo)
|
|
||||||
{
|
{
|
||||||
auto currInBlock = localDataBlocks[blockNo];
|
vtkmdiy::Master hierarchical_hyper_sweep_master(comm,
|
||||||
localHyperSweeperBlocks[blockNo] =
|
1, // Use 1 thread, VTK-M will do the treading
|
||||||
new vtkm::worklet::contourtree_distributed::HyperSweepBlock<FieldType>(
|
-1 // All block in memory
|
||||||
currInBlock->GlobalBlockId,
|
);
|
||||||
currInBlock->BlockOrigin,
|
|
||||||
currInBlock->BlockSize,
|
|
||||||
spatialDecomp.GlobalSize,
|
|
||||||
*currInBlock->HierarchicalAugmenter.AugmentedTree); // currInBlock->HierarchicalTree);
|
|
||||||
hierarchical_hyper_sweep_master.add(
|
|
||||||
vtkmdiyLocalBlockGids[blockNo], localHyperSweeperBlocks[blockNo], new vtkmdiy::Link());
|
|
||||||
}
|
|
||||||
|
|
||||||
vtkmdiy::fix_links(hierarchical_hyper_sweep_master, assigner);
|
vtkm::worklet::contourtree_distributed::HyperSweepBlock<FieldType>*
|
||||||
|
localHyperSweeperBlocks[localDataBlocks.size()];
|
||||||
|
for (size_t blockNo = 0; blockNo < localDataBlocks.size(); ++blockNo)
|
||||||
|
{
|
||||||
|
auto currInBlock = localDataBlocks[blockNo];
|
||||||
|
localHyperSweeperBlocks[blockNo] =
|
||||||
|
new vtkm::worklet::contourtree_distributed::HyperSweepBlock<FieldType>(
|
||||||
|
currInBlock->GlobalBlockId,
|
||||||
|
currInBlock->BlockOrigin,
|
||||||
|
currInBlock->BlockSize,
|
||||||
|
spatialDecomp.GlobalSize,
|
||||||
|
*currInBlock->HierarchicalAugmenter.AugmentedTree); // currInBlock->HierarchicalTree);
|
||||||
|
hierarchical_hyper_sweep_master.add(
|
||||||
|
vtkmdiyLocalBlockGids[blockNo], localHyperSweeperBlocks[blockNo], new vtkmdiy::Link());
|
||||||
|
}
|
||||||
|
|
||||||
hierarchical_hyper_sweep_master.foreach (
|
vtkmdiy::fix_links(hierarchical_hyper_sweep_master, assigner);
|
||||||
[](vtkm::worklet::contourtree_distributed::HyperSweepBlock<FieldType>* b,
|
|
||||||
const vtkmdiy::Master::ProxyWithLink&) {
|
|
||||||
// Create HyperSweeper
|
|
||||||
std::cout << "Block " << b->BlockNo << std::endl;
|
|
||||||
std::cout << b->HierarchicalContourTree.DebugPrint(
|
|
||||||
"Before initializing HyperSweeper", __FILE__, __LINE__);
|
|
||||||
vtkm::worklet::contourtree_distributed::HierarchicalHyperSweeper<vtkm::Id, FieldType>
|
|
||||||
hyperSweeper(
|
|
||||||
b->BlockNo, b->HierarchicalContourTree, b->IntrinsicVolume, b->DependentVolume);
|
|
||||||
|
|
||||||
std::cout << "Block " << b->BlockNo << std::endl;
|
hierarchical_hyper_sweep_master.foreach (
|
||||||
std::cout << b->HierarchicalContourTree.DebugPrint(
|
[](vtkm::worklet::contourtree_distributed::HyperSweepBlock<FieldType>* b,
|
||||||
"After initializing HyperSweeper", __FILE__, __LINE__);
|
const vtkmdiy::Master::ProxyWithLink&) {
|
||||||
// Create mesh and initialize vertex counts
|
// Create HyperSweeper
|
||||||
vtkm::worklet::contourtree_augmented::mesh_dem::IdRelabeler idRelabeler{ b->Origin,
|
std::cout << "Block " << b->BlockNo << std::endl;
|
||||||
b->Size,
|
std::cout << b->HierarchicalContourTree.DebugPrint(
|
||||||
b->GlobalSize };
|
"Before initializing HyperSweeper", __FILE__, __LINE__);
|
||||||
|
vtkm::worklet::contourtree_distributed::HierarchicalHyperSweeper<vtkm::Id, FieldType>
|
||||||
|
hyperSweeper(
|
||||||
|
b->BlockNo, b->HierarchicalContourTree, b->IntrinsicVolume, b->DependentVolume);
|
||||||
|
|
||||||
if (b->GlobalSize[2] <= 1)
|
std::cout << "Block " << b->BlockNo << std::endl;
|
||||||
{
|
std::cout << b->HierarchicalContourTree.DebugPrint(
|
||||||
vtkm::worklet::contourtree_augmented::DataSetMeshTriangulation2DFreudenthal mesh(
|
"After initializing HyperSweeper", __FILE__, __LINE__);
|
||||||
vtkm::Id2{ b->Size[0], b->Size[1] });
|
// Create mesh and initialize vertex counts
|
||||||
hyperSweeper.InitializeIntrinsicVertexCount(
|
vtkm::worklet::contourtree_augmented::mesh_dem::IdRelabeler idRelabeler{ b->Origin,
|
||||||
b->HierarchicalContourTree, mesh, idRelabeler, b->IntrinsicVolume);
|
b->Size,
|
||||||
}
|
b->GlobalSize };
|
||||||
else
|
|
||||||
{
|
|
||||||
// TODO/FIXME: For getting owned vertices, it should not make a difference if marching
|
|
||||||
// cubes or not. Verify.
|
|
||||||
vtkm::worklet::contourtree_augmented::DataSetMeshTriangulation3DFreudenthal mesh(b->Size);
|
|
||||||
hyperSweeper.InitializeIntrinsicVertexCount(
|
|
||||||
b->HierarchicalContourTree, mesh, idRelabeler, b->IntrinsicVolume);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cout << "Block " << b->BlockNo << std::endl;
|
if (b->GlobalSize[2] <= 1)
|
||||||
std::cout << b->HierarchicalContourTree.DebugPrint(
|
{
|
||||||
"After initializing intrinsic vertex count", __FILE__, __LINE__);
|
vtkm::worklet::contourtree_augmented::DataSetMeshTriangulation2DFreudenthal mesh(
|
||||||
// Initialize dependentVolume by copy from intrinsicVolume
|
vtkm::Id2{ b->Size[0], b->Size[1] });
|
||||||
vtkm::cont::Algorithm::Copy(b->IntrinsicVolume, b->DependentVolume);
|
hyperSweeper.InitializeIntrinsicVertexCount(
|
||||||
|
b->HierarchicalContourTree, mesh, idRelabeler, b->IntrinsicVolume);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// TODO/FIXME: For getting owned vertices, it should not make a difference if marching
|
||||||
|
// cubes or not. Verify.
|
||||||
|
vtkm::worklet::contourtree_augmented::DataSetMeshTriangulation3DFreudenthal mesh(b->Size);
|
||||||
|
hyperSweeper.InitializeIntrinsicVertexCount(
|
||||||
|
b->HierarchicalContourTree, mesh, idRelabeler, b->IntrinsicVolume);
|
||||||
|
}
|
||||||
|
|
||||||
// Perform the local hypersweep
|
std::cout << "Block " << b->BlockNo << std::endl;
|
||||||
hyperSweeper.LocalHyperSweep();
|
std::cout << b->HierarchicalContourTree.DebugPrint(
|
||||||
std::cout << "Block " << b->BlockNo << std::endl;
|
"After initializing intrinsic vertex count", __FILE__, __LINE__);
|
||||||
std::cout << b->HierarchicalContourTree.DebugPrint(
|
// Initialize dependentVolume by copy from intrinsicVolume
|
||||||
"After local hypersweep", __FILE__, __LINE__);
|
vtkm::cont::Algorithm::Copy(b->IntrinsicVolume, b->DependentVolume);
|
||||||
});
|
|
||||||
|
|
||||||
// Reduce
|
// Perform the local hypersweep
|
||||||
// partners for merge over regular block grid
|
hyperSweeper.LocalHyperSweep();
|
||||||
vtkmdiy::reduce(
|
std::cout << "Block " << b->BlockNo << std::endl;
|
||||||
hierarchical_hyper_sweep_master,
|
std::cout << b->HierarchicalContourTree.DebugPrint(
|
||||||
assigner,
|
"After local hypersweep", __FILE__, __LINE__);
|
||||||
partners,
|
});
|
||||||
vtkm::worklet::contourtree_distributed::CobmineHyperSweepBlockFunctor<FieldType>{});
|
|
||||||
|
|
||||||
// Print
|
// Reduce
|
||||||
vtkm::Id totalVolume =
|
// partners for merge over regular block grid
|
||||||
spatialDecomp.GlobalSize[0] * spatialDecomp.GlobalSize[1] * spatialDecomp.GlobalSize[2];
|
vtkmdiy::reduce(
|
||||||
hierarchical_hyper_sweep_master.foreach (
|
hierarchical_hyper_sweep_master,
|
||||||
[&totalVolume](vtkm::worklet::contourtree_distributed::HyperSweepBlock<FieldType>* b,
|
assigner,
|
||||||
const vtkmdiy::Master::ProxyWithLink&) {
|
partners,
|
||||||
std::cout << "Block " << b->BlockNo << std::endl;
|
vtkm::worklet::contourtree_distributed::CobmineHyperSweepBlockFunctor<FieldType>{});
|
||||||
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);
|
|
||||||
|
|
||||||
std::cout << b->HierarchicalContourTree.DebugPrint(
|
// Print
|
||||||
"Called from DumpVolumes", __FILE__, __LINE__);
|
vtkm::Id totalVolume =
|
||||||
std::cout << b->HierarchicalContourTree.DumpVolumes(
|
spatialDecomp.GlobalSize[0] * spatialDecomp.GlobalSize[1] * spatialDecomp.GlobalSize[2];
|
||||||
totalVolume, b->IntrinsicVolume, b->DependentVolume);
|
hierarchical_hyper_sweep_master.foreach (
|
||||||
});
|
[&totalVolume](vtkm::worklet::contourtree_distributed::HyperSweepBlock<FieldType>* b,
|
||||||
|
const vtkmdiy::Master::ProxyWithLink&) {
|
||||||
|
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);
|
||||||
|
|
||||||
// Clean-up
|
std::cout << b->HierarchicalContourTree.DebugPrint(
|
||||||
for (auto b : localHyperSweeperBlocks)
|
"Called from DumpVolumes", __FILE__, __LINE__);
|
||||||
{
|
std::cout << b->HierarchicalContourTree.DumpVolumes(
|
||||||
delete b;
|
totalVolume, b->IntrinsicVolume, b->DependentVolume);
|
||||||
}
|
});
|
||||||
|
|
||||||
|
// Clean-up
|
||||||
|
for (auto b : localHyperSweeperBlocks)
|
||||||
|
{
|
||||||
|
delete b;
|
||||||
|
}
|
||||||
|
} // end if(this->AugmentHierarchicalTree)
|
||||||
// END: THIS SHOULD GO INTO A SEPARATE FILTER
|
// END: THIS SHOULD GO INTO A SEPARATE FILTER
|
||||||
|
|
||||||
// Clean-up hierarchical contour tree blocks
|
// Clean-up hierarchical contour tree blocks
|
||||||
for (auto block : localDataBlocks)
|
for (auto block : localDataBlocks)
|
||||||
delete block;
|
delete block;
|
||||||
|
Loading…
Reference in New Issue
Block a user