Commit 6a8089f3 authored by Sreekanth Arikatla's avatar Sreekanth Arikatla
Browse files

REFAC: Rebase and conditionally enable verbose

parent 6e7dba06
......@@ -23,6 +23,7 @@
// Comment this out to skip performance benchmarking
//#define VTKM_BENCHMARK_VORONOI 1
//#define VTKM_VORONOI_VERBOSE
#ifdef VTKM_BENCHMARK_VORONOI
#include "vtkm/cont/Timer.h"
......@@ -624,7 +625,8 @@ public:
PointIter& iterData,
const SearchType& search) const
{
auto iter = StaticPointLocator::PointIteratorMethods<SearchType, PointIter>(&iterData, &search, false);
auto iter =
StaticPointLocator::PointIteratorMethods<SearchType, PointIter>(&iterData, &search, false);
iter.SetLocator(&search);
if (!iter.IsValid())
......@@ -757,8 +759,8 @@ public:
OutputStateType& output,
const vtkm::Id4& counts) const
{
auto iter =
StaticPointLocator::PointIteratorMethods<SearchType, PointIterType>(&iterData, &locator, false);
auto iter = StaticPointLocator::PointIteratorMethods<SearchType, PointIterType>(
&iterData, &locator, false);
(void)generatorSrcId;
(void)counts;
......@@ -1405,20 +1407,21 @@ public:
// edge in the clip-plane's loop.
// given an edge find the start and size of the loop that contains it
vtkm::Id2 loopStartSize = this->loopStartAndSize(state, generatorId, currEntryNextFace); // startFace);
vtkm::Id2 loopStartSize =
this->loopStartAndSize(state, generatorId, currEntryNextFace); // startFace);
vtkm::Id prevEntryCurrFace = this->traverseLoop(loopStartSize, currEntryNextFace, -1);
vtkm::Id nextEntryNextFace = this->lookupCoedge(state, prevEntryCurrFace);
loopStartSize = this->loopStartAndSize(state, generatorId, nextEntryNextFace);
currEntryNextFace = this->traverseLoop(loopStartSize, nextEntryNextFace, -1);
auto currConn = state.m_nextLoopConn.Get(currEntryNextFace);
bool currDir;
Voronoi::orientedEdgeToIdAndDir(currConn, currEdge, currDir);
#ifdef VTKM_VORONOI_VERBOSE
std::cout << "iter" << std::endl;
#endif
} while (currEdge != startEdge);
}
}
......@@ -1570,8 +1573,9 @@ public:
vtkm::Id generatorId,
vtkm::Id connOffset)
{
std::cout << generatorId << " " << connOffset << std::endl;
#ifdef VTKM_VORONOI_VERBOSE
std::cout << generatorId << " " << connOffset << std::endl;
#endif
vtkm::Id2 startAndSize{ -1, -1 };
vtkm::Id loopStrt = state.m_nextCellOffsets.Get(generatorId);
......@@ -1594,12 +1598,13 @@ public:
atleastOnce = true;
continue;
}
#ifdef VTKM_VORONOI_VERBOSE
if (!atleastOnce)
{
std::cout << "-break-" << std::endl;
std::cout << "[" << generatorId << " " << connOffset << "]" << std::endl;
std::cout << "-break-" << std::endl;
std::cout << "[" << generatorId << " " << connOffset << "]" << std::endl;
}
#endif
break;
}
// If we found a loop, get its size:
......@@ -1613,8 +1618,8 @@ public:
// Verify that connOffset is actually interior to the loop.
if (connOffset >= startAndSize[0] + startAndSize[1])
{
std::cout << "Warning: ConnOffset is actually interior to the loop!!"
<< startAndSize[0] << "\t" << startAndSize[1] << std::endl;
/*std::cout << "Warning: ConnOffset is actually interior to the loop!!" << startAndSize[0]
<< "\t" << startAndSize[1] << std::endl;*/
startAndSize[0] = startAndSize[1] = -1;
}
return startAndSize;
......@@ -1765,6 +1770,7 @@ Voronoi::Diagram Voronoi::Construct(
int iteration;
for (iteration = 0; ng > 0; ++iteration)
{
#ifdef VTKM_VORONOI_VERBOSE
{
std::cout << "VI.A. # " << iteration << " remain "
<< state.m_cellLoopNext.GetNumberOfValues() << "\n";
......@@ -1774,6 +1780,7 @@ Voronoi::Diagram Voronoi::Construct(
std::cout << " " << xx << " " << port.Get(xx) << "\n";
}
}
#endif
// A. Update the per-Voronoi-cell blossom search radius every so often.
// This requires work linear in O(state.m_points) and we start with
......@@ -1838,8 +1845,9 @@ Voronoi::Diagram Voronoi::Construct(
elapsed = timer.GetElapsedTime();
accumExtractComplete += elapsed;
#endif
#ifdef VTKM_VORONOI_VERBOSE
std::cout << "Cell totals " << cellTotals << "\n\n" << std::endl;
#endif
if (cellTotals[3] > 0)
{
m_diagram.AddBlock(outputState.createOutput(DeviceAdapter()));
......@@ -1851,6 +1859,7 @@ Voronoi::Diagram Voronoi::Construct(
timer.Reset();
#endif
#ifdef VTKM_VORONOI_VERBOSE
{
std::cout << "VI.E. # " << iteration << " remain "
<< state.m_cellLoopNext.GetNumberOfValues() << "\n";
......@@ -1861,9 +1870,10 @@ Voronoi::Diagram Voronoi::Construct(
}
std::cout << "Running PrepareToClip on " << inputPointIds.GetNumberOfValues()
<< " generators."
<< "\n\n" << std::endl;
<< "\n\n"
<< std::endl;
}
#endif
PrepareToClipCells<CoordType> prepareToClip;
vtkm::worklet::DispatcherMapField<PrepareToClipCells<CoordType>> prepareToClipDispatch(
prepareToClip);
......@@ -1871,7 +1881,7 @@ Voronoi::Diagram Voronoi::Construct(
// F. Turn the counts into offsets and allocate new arrays to hold
// points, neighbors, and loop offsets.
#ifdef VTKM_VORONOI_VERBOSE
{
std::cout << "VI.F. # " << iteration << " remain "
<< state.m_cellLoopNext.GetNumberOfValues() << "\n";
......@@ -1882,7 +1892,7 @@ Voronoi::Diagram Voronoi::Construct(
}
std::cout << "\n" << std::endl;
}
#endif
vtkm::Id nextCellLoopOffsetsSize =
DeviceAlg::ScanExclusive(state.m_cellLoopNext, state.m_cellLoopNext);
state.m_nextLoopOffsets.Allocate(nextCellLoopOffsetsSize);
......@@ -1936,7 +1946,7 @@ Voronoi::Diagram Voronoi::Construct(
offsetToCount.SetTotal(nextPointsSize);
offsetToCountDispatch.Invoke(
state.m_cellPointNext, state.m_cellPointNext, state.m_cellPointNext);
#ifdef VTKM_VORONOI_VERBOSE
{
std::cout << "VI.H. # " << iteration << " remain "
<< state.m_cellLoopNext.GetNumberOfValues() << "\n";
......@@ -1947,6 +1957,7 @@ Voronoi::Diagram Voronoi::Construct(
}
std::cout << "\n" << std::endl;
}
#endif
// Now trim completed stuff from input arrays
DeviceAlg::CopyIf(inputPointIds, state.m_complete, inputPointIds, Incomplete());
......@@ -1968,7 +1979,9 @@ Voronoi::Diagram Voronoi::Construct(
#endif
ng = inputPointIds.GetNumberOfValues();
#ifdef VTKM_VORONOI_VERBOSE
std::cout << "----------------------------------------\n\n" << std::endl;
#endif
}
#ifdef VTKM_BENCHMARK_VORONOI
std::cout << " Update blossom radii: " << accumBlossomUpdate << " ("
......
......@@ -33,7 +33,7 @@
namespace
{
using DeviceAdapter = VTKM_DEFAULT_DEVICE_ADAPTER_TAG;
using DeviceAdapter = vtkm::cont::DeviceAdapterTagTBB;
static std::string distribution;
static int npts = 100;
......
......@@ -38,10 +38,10 @@
namespace
{
static int npts = 1000;
static std::string distribution = "two";//"lissajous";//lissajous";
static std::string distribution = "lissajous";
static vtkm::Id singleGeneratorId = -1;
using DeviceAdapter = VTKM_DEFAULT_DEVICE_ADAPTER_TAG;
using DeviceAdapter = vtkm::cont::DeviceAdapterTagTBB;
void WriteDataSet(const vtkm::cont::DataSet& dataset, const std::string& filename)
{
......
......@@ -3,7 +3,8 @@ import os
import sys
from vtk import *
directory = sys.argv[1]
#directory = sys.argv[1]
directory = "G:/VTK-m/builds/release2017/vtkm/worklet/testing"
print('dir ', directory)
rdr = vtkDataSetReader()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment