Updated names in MeshExtrema to match VTKm style

This commit is contained in:
Oliver Ruebel 2020-01-23 00:03:36 -08:00
parent fee363232d
commit 1fa1410324
15 changed files with 137 additions and 137 deletions

@ -89,11 +89,11 @@ int main(int argc, char* argv[])
vtkm::Id2 vdims;
inFile >> vdims[0];
inFile >> vdims[1];
std::size_t nVertices = static_cast<std::size_t>(vdims[0] * vdims[1]);
std::size_t numVertices = static_cast<std::size_t>(vdims[0] * vdims[1]);
// read data
std::vector<vtkm::Float32> values(nVertices);
for (std::size_t vertex = 0; vertex < nVertices; vertex++)
std::vector<vtkm::Float32> values(numVertices);
for (std::size_t vertex = 0; vertex < numVertices; vertex++)
{
inFile >> values[vertex];
}

@ -90,11 +90,11 @@ int main(int argc, char* argv[])
inFile >> vdims[0];
inFile >> vdims[1];
inFile >> vdims[2];
std::size_t nVertices = static_cast<std::size_t>(vdims[0] * vdims[1] * vdims[2]);
std::size_t numVertices = static_cast<std::size_t>(vdims[0] * vdims[1] * vdims[2]);
// read data
std::vector<vtkm::Float32> values(nVertices);
for (std::size_t vertex = 0; vertex < nVertices; vertex++)
std::vector<vtkm::Float32> values(numVertices);
for (std::size_t vertex = 0; vertex < numVertices; vertex++)
{
inFile >> values[vertex];
}

@ -461,7 +461,7 @@ int main(int argc, char* argv[])
// Compute the number of vertices, i.e., xdim * ydim * zdim
unsigned short nDims = static_cast<unsigned short>(dims.size());
std::size_t nVertices = static_cast<std::size_t>(
std::size_t numVertices = static_cast<std::size_t>(
std::accumulate(dims.begin(), dims.end(), 1, std::multiplies<std::size_t>()));
// Print the mesh metadata
@ -475,7 +475,7 @@ int main(int argc, char* argv[])
<< nDims
<< std::endl
<< " Number of mesh vertices: "
<< nVertices
<< numVertices
<< std::endl);
}
@ -504,8 +504,8 @@ int main(int argc, char* argv[])
}
// Read data
std::vector<ValueType> values(nVertices);
for (std::size_t vertex = 0; vertex < nVertices; ++vertex)
std::vector<ValueType> values(numVertices);
for (std::size_t vertex = 0; vertex < numVertices; ++vertex)
{
inFile >> values[vertex];
}

@ -86,7 +86,7 @@ struct ContourTreeBlockData
static void destroy(void* b) { delete static_cast<ContourTreeBlockData<FieldType>*>(b); }
// ContourTreeMesh data
vtkm::Id nVertices;
vtkm::Id NumVertices;
vtkm::worklet::contourtree_augmented::IdArrayType
sortOrder; // TODO we should be able to remove this one, but we need to figure out what we need to return in the worklet instead
vtkm::cont::ArrayHandle<FieldType> sortedValues;
@ -111,7 +111,7 @@ struct Serialization<ContourTreeBlockData<FieldType>>
{
static void save(vtkmdiy::BinaryBuffer& bb, const ContourTreeBlockData<FieldType>& block)
{
vtkmdiy::save(bb, block.nVertices);
vtkmdiy::save(bb, block.NumVertices);
vtkmdiy::save(bb, block.sortOrder);
vtkmdiy::save(bb, block.sortedValues);
vtkmdiy::save(bb, block.globalMeshIndex);
@ -126,7 +126,7 @@ struct Serialization<ContourTreeBlockData<FieldType>>
static void load(vtkmdiy::BinaryBuffer& bb, ContourTreeBlockData<FieldType>& block)
{
vtkmdiy::load(bb, block.nVertices);
vtkmdiy::load(bb, block.NumVertices);
vtkmdiy::load(bb, block.sortOrder);
vtkmdiy::load(bb, block.sortedValues);
vtkmdiy::load(bb, block.globalMeshIndex);
@ -414,7 +414,7 @@ void merge_block_functor(
// Construct the two contour tree mesh by assignign the block data
vtkm::worklet::contourtree_augmented::ContourTreeMesh<FieldType> contourTreeMeshIn;
contourTreeMeshIn.nVertices = recvblock.nVertices;
contourTreeMeshIn.NumVertices = recvblock.NumVertices;
contourTreeMeshIn.sortOrder = recvblock.sortOrder;
contourTreeMeshIn.sortedValues = recvblock.sortedValues;
contourTreeMeshIn.globalMeshIndex = recvblock.globalMeshIndex;
@ -423,7 +423,7 @@ void merge_block_functor(
contourTreeMeshIn.maxNeighbours = recvblock.maxNeighbours;
vtkm::worklet::contourtree_augmented::ContourTreeMesh<FieldType> contourTreeMeshOut;
contourTreeMeshOut.nVertices = block->nVertices;
contourTreeMeshOut.NumVertices = block->NumVertices;
contourTreeMeshOut.sortOrder = block->sortOrder;
contourTreeMeshOut.sortedValues = block->sortedValues;
contourTreeMeshOut.globalMeshIndex = block->globalMeshIndex;
@ -455,7 +455,7 @@ void merge_block_functor(
if (selfid == 0)
{
// Save the data from our block for the next iteration
block->nVertices = contourTreeMeshOut.nVertices;
block->NumVertices = contourTreeMeshOut.NumVertices;
block->sortOrder = contourTreeMeshOut.sortOrder;
block->sortedValues = contourTreeMeshOut.sortedValues;
block->globalMeshIndex = contourTreeMeshOut.globalMeshIndex;
@ -512,7 +512,7 @@ void merge_block_functor(
}
// Copy the data from newContourTreeMesh into block
block->nVertices = newContourTreeMesh->nVertices;
block->NumVertices = newContourTreeMesh->NumVertices;
block->sortOrder = newContourTreeMesh->sortOrder;
block->sortedValues = newContourTreeMesh->sortedValues;
block->globalMeshIndex = newContourTreeMesh->globalMeshIndex;
@ -762,7 +762,7 @@ VTKM_CONT void ContourTreeAugmented::DoPostExecute(
localContourTreeMeshes[bi] = currContourTreeMesh;
// create the local data block structure
localDataBlocks[bi] = new ContourTreeBlockData<T>();
localDataBlocks[bi]->nVertices = currContourTreeMesh->nVertices;
localDataBlocks[bi]->NumVertices = currContourTreeMesh->NumVertices;
localDataBlocks[bi]->sortOrder = currContourTreeMesh->sortOrder;
localDataBlocks[bi]->sortedValues = currContourTreeMesh->sortedValues;
localDataBlocks[bi]->globalMeshIndex = currContourTreeMesh->globalMeshIndex;
@ -856,7 +856,7 @@ VTKM_CONT void ContourTreeAugmented::DoPostExecute(
vtkm::cont::ArrayHandle<T> currField;
// Construct the contour tree mesh from the last block
vtkm::worklet::contourtree_augmented::ContourTreeMesh<T> contourTreeMeshOut;
contourTreeMeshOut.nVertices = localDataBlocks[0]->nVertices;
contourTreeMeshOut.NumVertices = localDataBlocks[0]->NumVertices;
contourTreeMeshOut.sortOrder = localDataBlocks[0]->sortOrder;
contourTreeMeshOut.sortedValues = localDataBlocks[0]->sortedValues;
contourTreeMeshOut.globalMeshIndex = localDataBlocks[0]->globalMeshIndex;

@ -235,7 +235,7 @@ private:
timer.Start();
// Stage 3: Assign every mesh vertex to a peak
MeshExtrema extrema(mesh.nVertices);
MeshExtrema extrema(mesh.NumVertices);
extrema.SetStarts(mesh, true);
extrema.BuildRegularChains(true);
timingsStream << " " << std::setw(38) << std::left << "Join Tree Regular Chains"
@ -243,7 +243,7 @@ private:
timer.Start();
// Stage 4: Identify join saddles & construct Active Join Graph
MergeTree joinTree(mesh.nVertices, true);
MergeTree joinTree(mesh.NumVertices, true);
ActiveGraph joinGraph(true);
joinGraph.Initialise(mesh, extrema);
timingsStream << " " << std::setw(38) << std::left << "Join Tree Initialize Active Graph"
@ -272,7 +272,7 @@ private:
timer.Start();
// Stage 7: Identify split saddles & construct Active Split Graph
MergeTree splitTree(mesh.nVertices, false);
MergeTree splitTree(mesh.NumVertices, false);
ActiveGraph splitGraph(false);
splitGraph.Initialise(mesh, extrema);
timingsStream << " " << std::setw(38) << std::left << "Splot Tree Initialize Active Graph"
@ -295,7 +295,7 @@ private:
timer.Start();
// Stage 9: Join & Split Tree are Augmented, then combined to construct Contour Tree
contourTree.Init(mesh.nVertices);
contourTree.Init(mesh.NumVertices);
ContourTreeMaker treeMaker(contourTree, joinTree, splitTree);
// 9.1 First we compute the hyper- and super- structure
treeMaker.ComputeHyperAndSuperStructure();

@ -130,7 +130,7 @@ public:
const vtkm::cont::ArrayHandle<T, StorageType>& values;
// size of mesh
vtkm::Id nRows, nCols, nSlices, nVertices, nLogSteps;
vtkm::Id nRows, nCols, nSlices, NumVertices, nLogSteps;
// whether it is join or split tree
bool isJoinTree;
@ -180,16 +180,16 @@ MergeTree<T, StorageType>::MergeTree(const vtkm::cont::ArrayHandle<T, StorageTyp
, nSlices(NSlices)
, isJoinTree(IsJoinTree)
{
nVertices = nRows * nCols * nSlices;
NumVertices = nRows * nCols * nSlices;
nLogSteps = 1;
for (vtkm::Id shifter = nVertices; shifter != 0; shifter >>= 1)
for (vtkm::Id shifter = NumVertices; shifter != 0; shifter >>= 1)
nLogSteps++;
vtkm::cont::ArrayHandleConstant<vtkm::Id> nullArray(0, nVertices);
vtkm::cont::ArrayHandleConstant<vtkm::Id> nullArray(0, NumVertices);
mergeArcs.Allocate(nVertices);
extrema.Allocate(nVertices);
saddles.Allocate(nVertices);
mergeArcs.Allocate(NumVertices);
extrema.Allocate(NumVertices);
saddles.Allocate(NumVertices);
vtkm::cont::ArrayCopy(nullArray, mergeArcs);
vtkm::cont::ArrayCopy(nullArray, extrema);
@ -209,9 +209,9 @@ void MergeTree<T, StorageType>::BuildRegularChains()
#endif
// 2. Create a temporary array so that we can alternate writing between them
vtkm::cont::ArrayHandle<vtkm::Id> temporaryArcs;
temporaryArcs.Allocate(nVertices);
temporaryArcs.Allocate(NumVertices);
vtkm::cont::ArrayHandleIndex vertexIndexArray(nVertices);
vtkm::cont::ArrayHandleIndex vertexIndexArray(NumVertices);
ChainDoubler chainDoubler;
vtkm::worklet::DispatcherMapField<ChainDoubler> chainDoublerDispatcher(chainDoubler);
@ -287,7 +287,7 @@ void MergeTree<T, StorageType>::ComputeAugmentedArcs(vtkm::cont::ArrayHandle<vtk
DebugPrint("Sorting Complete");
#endif
vtkm::cont::ArrayHandleConstant<vtkm::Id> noVertArray(NO_VERTEX_ASSIGNED, nVertices);
vtkm::cont::ArrayHandleConstant<vtkm::Id> noVertArray(NO_VERTEX_ASSIGNED, NumVertices);
vtkm::cont::ArrayCopy(noVertArray, mergeArcs);
vtkm::cont::ArrayHandleIndex critVertexIndexArray(nCriticalVerts);

@ -106,7 +106,7 @@ public:
const vtkm::cont::ArrayHandle<T, StorageType>& values;
// size of the mesh
vtkm::Id nRows, nCols, nVertices, nLogSteps;
vtkm::Id nRows, nCols, NumVertices, nLogSteps;
// Array with neighbourhood masks
vtkm::cont::ArrayHandle<vtkm::Id> neighbourhoodMask;
@ -129,10 +129,10 @@ void Mesh2D_DEM_Triangulation<T, StorageType>::SetStarts(vtkm::cont::ArrayHandle
bool ascending)
{
// create the neighbourhood mask
neighbourhoodMask.Allocate(nVertices);
neighbourhoodMask.Allocate(NumVertices);
// For each vertex set the next vertex in the chain
vtkm::cont::ArrayHandleIndex vertexIndexArray(nVertices);
vtkm::cont::ArrayHandleIndex vertexIndexArray(NumVertices);
Mesh2D_DEM_VertexStarter<T> vertexStarter(nRows, nCols, ascending);
vtkm::worklet::DispatcherMapField<Mesh2D_DEM_VertexStarter<T>> vertexStarterDispatcher(
vertexStarter);
@ -153,11 +153,11 @@ Mesh2D_DEM_Triangulation<T, StorageType>::Mesh2D_DEM_Triangulation(
, nRows(NRows)
, nCols(NCols)
{
nVertices = nRows * nCols;
NumVertices = nRows * nCols;
// compute the number of log-jumping steps (i.e. lg_2 (nVertices))
// compute the number of log-jumping steps (i.e. lg_2 (NumVertices))
nLogSteps = 1;
for (vtkm::Id shifter = nVertices; shifter > 0; shifter >>= 1)
for (vtkm::Id shifter = NumVertices; shifter > 0; shifter >>= 1)
nLogSteps++;
}
@ -171,11 +171,11 @@ void Mesh2D_DEM_Triangulation<T, StorageType>::SetSaddleStarts(
vtkm::cont::ArrayHandle<vtkm::Id> inverseIndex;
vtkm::cont::ArrayHandle<vtkm::Id> isCritical;
vtkm::cont::ArrayHandle<vtkm::Id> outdegree;
inverseIndex.Allocate(nVertices);
isCritical.Allocate(nVertices);
outdegree.Allocate(nVertices);
inverseIndex.Allocate(NumVertices);
isCritical.Allocate(NumVertices);
outdegree.Allocate(NumVertices);
vtkm::cont::ArrayHandleIndex vertexIndexArray(nVertices);
vtkm::cont::ArrayHandleIndex vertexIndexArray(NumVertices);
Mesh2D_DEM_VertexOutdegreeStarter vertexOutdegreeStarter(nRows, nCols, ascending);
vtkm::worklet::DispatcherMapField<Mesh2D_DEM_VertexOutdegreeStarter>
vertexOutdegreeStarterDispatcher(vertexOutdegreeStarter);
@ -189,8 +189,8 @@ void Mesh2D_DEM_Triangulation<T, StorageType>::SetSaddleStarts(
vtkm::cont::Algorithm::ScanExclusive(isCritical, inverseIndex);
// now we can compute how many critical points we carry forward
vtkm::Id nCriticalPoints = vtkm::cont::ArrayGetValue(nVertices - 1, inverseIndex) +
vtkm::cont::ArrayGetValue(nVertices - 1, isCritical);
vtkm::Id nCriticalPoints = vtkm::cont::ArrayGetValue(NumVertices - 1, inverseIndex) +
vtkm::cont::ArrayGetValue(NumVertices - 1, isCritical);
// allocate space for the join graph vertex arrays
mergeGraph.AllocateVertexArrays(nCriticalPoints);

@ -106,7 +106,7 @@ public:
const vtkm::cont::ArrayHandle<T, StorageType>& values;
// size of the mesh
vtkm::Id nRows, nCols, nSlices, nVertices, nLogSteps;
vtkm::Id nRows, nCols, nSlices, NumVertices, nLogSteps;
// array with neighbourhood masks
vtkm::cont::ArrayHandle<vtkm::Id> neighbourhoodMask;
@ -142,11 +142,11 @@ Mesh3D_DEM_Triangulation<T, StorageType>::Mesh3D_DEM_Triangulation(
, neighbourOffsets3D()
, linkComponentCaseTable3D()
{
nVertices = nRows * nCols * nSlices;
NumVertices = nRows * nCols * nSlices;
// compute the number of log-jumping steps (i.e. lg_2 (nVertices))
// compute the number of log-jumping steps (i.e. lg_2 (NumVertices))
nLogSteps = 1;
for (vtkm::Id shifter = nVertices; shifter > 0; shifter >>= 1)
for (vtkm::Id shifter = NumVertices; shifter > 0; shifter >>= 1)
nLogSteps++;
neighbourOffsets3D =
@ -161,10 +161,10 @@ void Mesh3D_DEM_Triangulation<T, StorageType>::SetStarts(vtkm::cont::ArrayHandle
bool ascending)
{
// create the neighbourhood mask
neighbourhoodMask.Allocate(nVertices);
neighbourhoodMask.Allocate(NumVertices);
// For each vertex set the next vertex in the chain
vtkm::cont::ArrayHandleIndex vertexIndexArray(nVertices);
vtkm::cont::ArrayHandleIndex vertexIndexArray(NumVertices);
Mesh3D_DEM_VertexStarter<T> vertexStarter(nRows, nCols, nSlices, ascending);
vtkm::worklet::DispatcherMapField<Mesh3D_DEM_VertexStarter<T>> vertexStarterDispatcher(
vertexStarter);
@ -186,7 +186,7 @@ void Mesh3D_DEM_Triangulation<T, StorageType>::SetSaddleStarts(
vtkm::cont::ArrayHandle<vtkm::Id> isCritical;
vtkm::cont::ArrayHandle<vtkm::Id> outdegree;
vtkm::cont::ArrayHandleIndex vertexIndexArray(nVertices);
vtkm::cont::ArrayHandleIndex vertexIndexArray(NumVertices);
Mesh3D_DEM_VertexOutdegreeStarter vertexOutdegreeStarter(nRows, nCols, nSlices, ascending);
vtkm::worklet::DispatcherMapField<Mesh3D_DEM_VertexOutdegreeStarter>
vertexOutdegreeStarterDispatcher(vertexOutdegreeStarter);
@ -202,8 +202,8 @@ void Mesh3D_DEM_Triangulation<T, StorageType>::SetSaddleStarts(
vtkm::cont::Algorithm::ScanExclusive(isCritical, inverseIndex);
// now we can compute how many critical points we carry forward
vtkm::Id nCriticalPoints = vtkm::cont::ArrayGetValue(nVertices - 1, inverseIndex) +
vtkm::cont::ArrayGetValue(nVertices - 1, isCritical);
vtkm::Id nCriticalPoints = vtkm::cont::ArrayGetValue(NumVertices - 1, inverseIndex) +
vtkm::cont::ArrayGetValue(NumVertices - 1, isCritical);
// allocate space for the join graph vertex arrays
mergeGraph.AllocateVertexArrays(nCriticalPoints);

@ -240,7 +240,7 @@ template <class Mesh>
void ActiveGraph::Initialise(Mesh& mesh, const MeshExtrema& meshExtrema)
{ // InitialiseActiveGraph()
// reference to the correct array in the extrema
const IdArrayType& extrema = isJoinGraph ? meshExtrema.peaks : meshExtrema.pits;
const IdArrayType& extrema = isJoinGraph ? meshExtrema.Peaks : meshExtrema.Pits;
// For every vertex, work out whether it is critical
// We do so by computing outdegree in the mesh & suppressing the vertex if outdegree is 1
@ -251,13 +251,13 @@ void ActiveGraph::Initialise(Mesh& mesh, const MeshExtrema& meshExtrema)
// Neighbourhood mask (one bit set per connected component in neighbourhood
IdArrayType neighbourhoodMasks;
neighbourhoodMasks.Allocate(mesh.nVertices);
neighbourhoodMasks.Allocate(mesh.NumVertices);
IdArrayType outDegrees; // TODO Should we change this to an unsigned type
outDegrees.Allocate(mesh.nVertices);
outDegrees.Allocate(mesh.NumVertices);
// Initialize the nerighborhoodMasks and outDegrees arrays
mesh.setPrepareForExecutionBehavior(isJoinGraph);
vtkm::cont::ArrayHandleIndex sortIndexArray(mesh.nVertices);
vtkm::cont::ArrayHandleIndex sortIndexArray(mesh.NumVertices);
active_graph_inc_ns::InitializeNeighbourhoodMasksAndOutDegrees initNeighMasksAndOutDegWorklet(
isJoinGraph);
@ -275,7 +275,7 @@ void ActiveGraph::Initialise(Mesh& mesh, const MeshExtrema& meshExtrema)
// we need a temporary inverse index to change vertex IDs
IdArrayType inverseIndex;
inverseIndex.Allocate(mesh.nVertices);
inverseIndex.Allocate(mesh.NumVertices);
inverseIndex.GetPortalControl().Set(0,0);
std::partial_sum(
@ -303,9 +303,9 @@ void ActiveGraph::Initialise(Mesh& mesh, const MeshExtrema& meshExtrema)
// activeIndex gets the next available ID in the active graph (was called nearIndex before)
// globalIndex stores the index in the join tree for later access
IdArrayType activeIndices;
activeIndices.Allocate(mesh.nVertices);
activeIndices.Allocate(mesh.NumVertices);
vtkm::cont::ArrayHandleConstant<vtkm::Id> noSuchElementArray((vtkm::Id)NO_SUCH_ELEMENT,
mesh.nVertices);
mesh.NumVertices);
vtkm::cont::Algorithm::Copy(noSuchElementArray, activeIndices);
active_graph_inc_ns::InitializeActiveGraphVertices initActiveGraphVerticesWorklet;
@ -798,7 +798,7 @@ void ActiveGraph::SetArcs(MergeTree& tree, MeshExtrema& meshExtrema)
using PermuteIndexType = vtkm::cont::ArrayHandlePermutation<IdArrayType, IdArrayType>;
// reference to the correct array in the extrema
const IdArrayType& extrema = isJoinGraph ? meshExtrema.peaks : meshExtrema.pits;
const IdArrayType& extrema = isJoinGraph ? meshExtrema.Peaks : meshExtrema.Pits;
// 1. Set the arcs for the super/hypernodes based on where they prune to
active_graph_inc_ns::SetArcsSetSuperAndHypernodeArcs setSuperAndHypernodeArcsWorklet;
@ -817,7 +817,7 @@ void ActiveGraph::SetArcs(MergeTree& tree, MeshExtrema& meshExtrema)
isJoinGraph, nSupernodes, nHypernodes);
this->Invoke(slideVerticesWorklet,
tree.arcs, // (input)
extrema, // (input) i.e,. meshExtrema.peaks or meshExtrema.pits
extrema, // (input) i.e,. meshExtrema.Peaks or meshExtrema.Pits
tree.firstSuperchild, // (input)
tree.supernodes, // (input)
tree.superparents); // (input/output)

@ -400,8 +400,8 @@ void ContourTreeMaker::ComputeRegularStructure(MeshExtrema& meshExtrema)
contourTree.hyperarcs, // (input)
contourTree.hypernodes, // (input)
contourTree.supernodes, // (input)
meshExtrema.peaks, // (input)
meshExtrema.pits); // (input)
meshExtrema.Peaks, // (input)
meshExtrema.Pits); // (input)
// We have now set the superparent correctly for each node, and need to sort them to get the correct regular arcs
vtkm::cont::Algorithm::Copy(vtkm::cont::ArrayHandleIndex(contourTree.arcs.GetNumberOfValues()),
@ -470,8 +470,8 @@ void ContourTreeMaker::ComputeBoundaryRegularStructure(
contourTree.hyperarcs, // (input)
contourTree.hypernodes, // (input)
contourTree.supernodes, // (input)
meshExtrema.peaks, // (input)
meshExtrema.pits, // (input)
meshExtrema.Peaks, // (input)
meshExtrema.Pits, // (input)
meshBoundaryExecObj); // (input)
// We have now set the superparent correctly for each node, and need to sort them to get the correct regular arcs

@ -238,7 +238,7 @@ inline void MergeTree::DebugPrintTree(const char* message,
std::cout << "==========" << std::endl;
for (vtkm::Id entry = 0; entry < mesh.nVertices; entry++)
for (vtkm::Id entry = 0; entry < mesh.NumVertices; entry++)
{
vtkm::Id sortIndex = mesh.sortIndices.GetPortalConstControl().Get(entry);
vtkm::Id arc = this->arcs.GetPortalConstControl().Get(sortIndex);

@ -81,10 +81,10 @@ class MeshExtrema
public:
vtkm::cont::Invoker Invoke;
// arrays for peaks & pits
IdArrayType peaks;
IdArrayType pits;
vtkm::Id nVertices;
vtkm::Id nLogSteps;
IdArrayType Peaks;
IdArrayType Pits;
vtkm::Id NumVertices;
vtkm::Id NumLogSteps;
// constructor
VTKM_CONT
@ -106,23 +106,23 @@ public:
inline MeshExtrema::MeshExtrema(vtkm::Id meshSize)
: peaks()
, pits()
, nVertices(meshSize)
, nLogSteps(0)
: Peaks()
, Pits()
, NumVertices(meshSize)
, NumLogSteps(0)
{ // MeshExrema
// Compute the number of log steps required in this pass
nLogSteps = 1;
for (vtkm::Id shifter = nVertices; shifter != 0; shifter >>= 1)
nLogSteps++;
NumLogSteps = 1;
for (vtkm::Id shifter = NumVertices; shifter != 0; shifter >>= 1)
NumLogSteps++;
// Allocate memory for the peaks and pits
peaks.Allocate(nVertices);
pits.Allocate(nVertices);
// TODO Check if we really need to set the peaks and pits to zero or whether it is enough to allocate them
vtkm::cont::ArrayHandleConstant<vtkm::Id> constZeroArray(0, nVertices);
vtkm::cont::Algorithm::Copy(constZeroArray, peaks);
vtkm::cont::Algorithm::Copy(constZeroArray, pits);
Peaks.Allocate(NumVertices);
Pits.Allocate(NumVertices);
// TODO Check if we really need to set the Peaks and pits to zero or whether it is enough to allocate them
vtkm::cont::ArrayHandleConstant<vtkm::Id> constZeroArray(0, NumVertices);
vtkm::cont::Algorithm::Copy(constZeroArray, Peaks);
vtkm::cont::Algorithm::Copy(constZeroArray, Pits);
} // MeshExtrema
@ -130,15 +130,15 @@ inline void MeshExtrema::BuildRegularChains(bool isMaximal)
{ // BuildRegularChains()
// Create vertex index array -- note, this is a fancy vtk-m array, i.e, the full array
// is not actually allocated but the array only acts like a sequence of numbers
vtkm::cont::ArrayHandleIndex vertexIndexArray(nVertices);
IdArrayType& extrema = isMaximal ? peaks : pits;
vtkm::cont::ArrayHandleIndex vertexIndexArray(NumVertices);
IdArrayType& extrema = isMaximal ? Peaks : Pits;
// Create the PointerDoubling worklet and corresponding dispatcher
vtkm::worklet::contourtree_augmented::PointerDoubling pointerDoubler;
// Iterate to perform pointer-doubling to build chains to extrema (i.e., maxima or minima)
// depending on whether we are computing a JoinTree or a SplitTree
for (vtkm::Id logStep = 0; logStep < this->nLogSteps; logStep++)
for (vtkm::Id logStep = 0; logStep < this->NumLogSteps; logStep++)
{
this->Invoke(pointerDoubler,
vertexIndexArray, // input
@ -152,14 +152,14 @@ inline void MeshExtrema::SetStarts(MeshType& mesh, bool isMaximal)
{
mesh.setPrepareForExecutionBehavior(isMaximal);
mesh_extrema_inc_ns::SetStarts setStartsWorklet;
vtkm::cont::ArrayHandleIndex sortIndexArray(mesh.nVertices);
vtkm::cont::ArrayHandleIndex sortIndexArray(mesh.NumVertices);
if (isMaximal)
{
this->Invoke(setStartsWorklet, sortIndexArray, mesh, peaks);
this->Invoke(setStartsWorklet, sortIndexArray, mesh, Peaks);
}
else
{
this->Invoke(setStartsWorklet, sortIndexArray, mesh, pits);
this->Invoke(setStartsWorklet, sortIndexArray, mesh, Pits);
}
DebugPrint("Regular Starts Set", __FILE__, __LINE__);
}
@ -177,9 +177,9 @@ inline void MeshExtrema::DebugPrint(const char* message, const char* fileName, l
std::cout << "---------------------------" << std::endl;
std::cout << std::endl;
printHeader(peaks.GetNumberOfValues());
PrintIndices("Peaks", peaks);
PrintIndices("Pits", pits);
printHeader(Peaks.GetNumberOfValues());
PrintIndices("Peaks", Peaks);
PrintIndices("Pits", Pits);
#else
// Prevent unused parameter warning
(void)message;

@ -102,7 +102,7 @@ class Mesh_DEM_Triangulation
{
public:
// common mesh size parameters
vtkm::Id nVertices, nLogSteps;
vtkm::Id NumVertices, nLogSteps;
// Define dimensionality of the mesh
vtkm::Id nDims;
@ -116,14 +116,14 @@ public:
//empty constructor
Mesh_DEM_Triangulation()
: nVertices(0)
: NumVertices(0)
, nLogSteps(0)
, nDims(2)
{
}
// Getter function for nVertices
vtkm::Id GetNumberOfVertices() const { return nVertices; }
// Getter function for NumVertices
vtkm::Id GetNumberOfVertices() const { return NumVertices; }
// sorts the data and initializes the sortIndex & indexReverse
void SortData(const vtkm::cont::ArrayHandle<T, StorageType>& values);
@ -162,11 +162,11 @@ public:
, nRows(nrows)
{
this->nDims = 2;
this->nVertices = nRows * nCols;
this->NumVertices = nRows * nCols;
// compute the number of log-jumping steps (i.e. lg_2 (nVertices))
// compute the number of log-jumping steps (i.e. lg_2 (NumVertices))
this->nLogSteps = 1;
for (vtkm::Id shifter = this->nVertices; shifter > 0; shifter >>= 1)
for (vtkm::Id shifter = this->NumVertices; shifter > 0; shifter >>= 1)
this->nLogSteps++;
}
@ -203,11 +203,11 @@ public:
, nSlices(nslices)
{
this->nDims = 3;
this->nVertices = nRows * nCols * nSlices;
this->NumVertices = nRows * nCols * nSlices;
// compute the number of log-jumping steps (i.e. lg_2 (nVertices))
// compute the number of log-jumping steps (i.e. lg_2 (NumVertices))
this->nLogSteps = 1;
for (vtkm::Id shifter = this->nVertices; shifter > 0; shifter >>= 1)
for (vtkm::Id shifter = this->NumVertices; shifter > 0; shifter >>= 1)
this->nLogSteps++;
}
@ -226,18 +226,18 @@ void Mesh_DEM_Triangulation<T, StorageType>::SortData(
namespace mesh_dem_worklets = vtkm::worklet::contourtree_augmented::mesh_dem;
// Make sure that the values have the correct size
assert(values.GetNumberOfValues() == nVertices);
assert(values.GetNumberOfValues() == NumVertices);
// Just in case, make sure that everything is cleaned up
sortIndices.ReleaseResources();
sortOrder.ReleaseResources();
// allocate memory for the sort arrays
sortOrder.Allocate(nVertices);
sortIndices.Allocate(nVertices);
sortOrder.Allocate(NumVertices);
sortIndices.Allocate(NumVertices);
// now sort the sort order vector by the values, i.e,. initialize the sortOrder member variable
vtkm::cont::ArrayHandleIndex initVertexIds(nVertices); // create sequence 0, 1, .. nVertices
vtkm::cont::ArrayHandleIndex initVertexIds(NumVertices); // create sequence 0, 1, .. NumVertices
vtkm::cont::ArrayCopy(initVertexIds, sortOrder);
vtkm::cont::Algorithm::Sort(sortOrder,
@ -245,7 +245,7 @@ void Mesh_DEM_Triangulation<T, StorageType>::SortData(
// now set the index lookup, i.e., initialize the sortIndices member variable
// In serial this would be
// for (indexType vertex = 0; vertex < nVertices; vertex++)
// for (indexType vertex = 0; vertex < NumVertices; vertex++)
// sortIndices[sortOrder[vertex]] = vertex;
mesh_dem_worklets::SortIndices sortIndicesWorklet;
vtkm::cont::Invoker invoke;
@ -270,8 +270,8 @@ void Mesh_DEM_Triangulation<T, StorageType>::DebugPrint(const char* message,
std::cout << "Mesh Contains: " << std::endl;
std::cout << "------------------------------------------------------" << std::endl;
//DebugPrintExtents();
printLabel("nVertices");
printIndexType(nVertices);
printLabel("NumVertices");
printIndexType(NumVertices);
std::cout << std::endl;
printLabel("nLogSteps");
printIndexType(nLogSteps);

@ -253,8 +253,8 @@ public:
if (NoSuchElement(contourTree.superparents[node]))
{ // regular nodes only
// we will need to prune top and bottom until one of them prunes past the node
indexType top = meshExtrema.peaks[node];
indexType bottom = meshExtrema.pits[node];
indexType top = meshExtrema.Peaks[node];
indexType bottom = meshExtrema.Pits[node];
// these are the regular IDs of supernodes, so their superparents are already set
indexType topSuperparent = contourTree.superparents[top];
indexType bottomSuperparent = contourTree.superparents[bottom];
@ -595,8 +595,8 @@ public:
if (NoSuchElement(contourTree.superparents[node]) && mesh.liesOnBoundary(node))
{ // regular nodes only
// we will need to prune top and bottom until one of them prunes past the node
indexType top = meshExtrema.peaks[node];
indexType bottom = meshExtrema.pits[node];
indexType top = meshExtrema.Peaks[node];
indexType bottom = meshExtrema.Pits[node];
// these are the regular IDs of supernodes, so their superparents are already set
indexType topSuperparent = contourTree.superparents[top];
indexType bottomSuperparent = contourTree.superparents[bottom];

@ -156,10 +156,10 @@ public:
ContourTreeMesh(const char* filename)
{
load(filename);
this->nVertices = this->sortedValues.GetNumberOfValues();
this->NumVertices = this->sortedValues.GetNumberOfValues();
}
vtkm::Id GetNumberOfVertices() const { return this->nVertices; }
vtkm::Id GetNumberOfVertices() const { return this->NumVertices; }
// Combine two ContourTreeMeshes
template <typename DeviceTag>
@ -181,7 +181,7 @@ public:
// Public fields
static const int MAX_OUTDEGREE = 20;
vtkm::Id nVertices;
vtkm::Id NumVertices;
// TODO we should be able to remove this one, but we need to figure out what we need to return in the worklet instead
IdArrayType sortOrder;
vtkm::cont::ArrayHandle<FieldType> sortedValues;
@ -244,7 +244,7 @@ void ContourTreeMesh<FieldType>::DebugPrint(const char* message, const char* fil
std::cout << "---------------------------" << std::endl;
std::cout << std::endl;
printHeader(this->nVertices);
printHeader(this->NumVertices);
PrintIndices("sortOrder", sortOrder);
PrintValues("sortedValues", sortedValues);
PrintIndices("globalMeshIndex", globalMeshIndex);
@ -275,7 +275,7 @@ ContourTreeMesh<FieldType>::ContourTreeMesh(const IdArrayType& arcs,
, neighbours()
, firstNeighbour()
{
this->nVertices = this->sortOrder.GetNumberOfValues();
this->NumVertices = this->sortOrder.GetNumberOfValues();
// values permuted by sortOrder to sort the values
auto permutedValues = vtkm::cont::make_ArrayHandlePermutation(this->sortOrder, values);
// TODO check if we actually need to make this copy here. we could just store the permutedValues array to save memory
@ -308,7 +308,7 @@ ContourTreeMesh<FieldType>::ContourTreeMesh(const IdArrayType& nodes,
permutedSortOrder,
this
->sortOrder); // TODO Check if the sortOrder needs to be set form the input or the permutted sortOrder
this->nVertices = this->sortedValues.GetNumberOfValues();
this->NumVertices = this->sortedValues.GetNumberOfValues();
this->InitialiseNeighboursFromArcs(arcs);
#ifdef DEBUG_PRINT
// Print the contents fo this for debugging
@ -325,7 +325,7 @@ ContourTreeMesh<FieldType>::ContourTreeMesh(const IdArrayType& arcs,
, neighbours()
, firstNeighbour()
{
this->nVertices = this->sortedValues.GetNumberOfValues();
this->NumVertices = this->sortedValues.GetNumberOfValues();
this->InitialiseNeighboursFromArcs(arcs);
#ifdef DEBUG_PRINT
// Print the contents fo this for debugging
@ -350,7 +350,7 @@ ContourTreeMesh<FieldType>::ContourTreeMesh(const IdArrayType& nodes,
auto permutedSortedValues = vtkm::cont::make_ArrayHandlePermutation(nodes, mesh.sortedValues);
vtkm::cont::Algorithm::Copy(permutedSortedValues, this->sortedValues);
// Initialize the neighbours from the arcs
this->nVertices = this->sortedValues.GetNumberOfValues();
this->NumVertices = this->sortedValues.GetNumberOfValues();
this->InitialiseNeighboursFromArcs(arcs);
#ifdef DEBUG_PRINT
// Print the contents fo this for debugging
@ -386,7 +386,7 @@ void ContourTreeMesh<FieldType>::InitialiseNeighboursFromArcs(const IdArrayType&
vtkm::cont::Algorithm::Sort(this->neighbours, contourtree_mesh_inc_ns::ArcComparator(arcs));
// Find start index for each vertex into neighbours array
this->firstNeighbour.Allocate(this->nVertices);
this->firstNeighbour.Allocate(this->NumVertices);
contourtree_mesh_inc_ns::FindStartIndexWorklet findStartIndexWorklet;
this->Invoke(findStartIndexWorklet,
@ -415,8 +415,8 @@ void ContourTreeMesh<FieldType>::InitialiseNeighboursFromArcs(const IdArrayType&
{
std::cout << vtx << ": ";
vtkm::Id neighboursBeginIndex = firstNeighbourPortal.Get(vtx);
vtkm::Id neighboursEndIndex = (vtx < this->nVertices - 1) ? firstNeighbourPortal.Get(vtx + 1)
: neighbours.GetNumberOfValues();
vtkm::Id neighboursEndIndex = (vtx < this->NumVertices - 1) ? firstNeighbourPortal.Get(vtx + 1)
: neighbours.GetNumberOfValues();
for (vtkm::Id ni = neighboursBeginIndex; ni < neighboursEndIndex; ++ni)
{
@ -431,7 +431,7 @@ void ContourTreeMesh<FieldType>::InitialiseNeighboursFromArcs(const IdArrayType&
template <typename FieldType>
void ContourTreeMesh<FieldType>::ComputeNNeighboursVector(IdArrayType& nNeighbours) const
{
nNeighbours.Allocate(this->firstNeighbour.GetNumberOfValues()); // same as this->nVertices
nNeighbours.Allocate(this->firstNeighbour.GetNumberOfValues()); // same as this->NumVertices
contourtree_mesh_inc_ns::ComputeMaxNeighboursWorklet computeMaxNeighboursWorklet(
this->neighbours.GetNumberOfValues());
this->Invoke(computeMaxNeighboursWorklet, this->firstNeighbour, nNeighbours);
@ -490,13 +490,13 @@ void ContourTreeMesh<FieldType>::mergeWith(ContourTreeMesh<FieldType>& other)
// Create combined sort order
IdArrayType
overallSortOrder; // TODO This vector could potentially be implemented purely as a smart array handle to reduce memory usage
overallSortOrder.Allocate(this->nVertices + other.nVertices);
overallSortOrder.Allocate(this->NumVertices + other.NumVertices);
{ // Create a new scope so that the following two vectors get deleted when leaving the scope
auto thisIndices = vtkm::cont::ArrayHandleIndex(this->nVertices); // A regular index array
auto thisIndices = vtkm::cont::ArrayHandleIndex(this->NumVertices); // A regular index array
MarkOther markOtherFunctor;
auto otherIndices = vtkm::cont::make_ArrayHandleTransform(
vtkm::cont::ArrayHandleIndex(other.nVertices), markOtherFunctor);
vtkm::cont::ArrayHandleIndex(other.NumVertices), markOtherFunctor);
contourtree_mesh_inc_ns::CombinedSimulatedSimplicityIndexComparator<FieldType, DeviceTag>
cssicFunctor(allSortedValues, allGlobalIndices);
std::merge(vtkm::cont::ArrayPortalToIteratorBegin(thisIndices.GetPortalConstControl()),
@ -530,12 +530,12 @@ void ContourTreeMesh<FieldType>::mergeWith(ContourTreeMesh<FieldType>& other)
vtkm::cont::Algorithm::CopySubRange(
tempArr, 0, tempArr.GetNumberOfValues(), overallSortIndex, 1);
}
vtkm::Id nVerticesCombined =
vtkm::Id numVerticesCombined =
overallSortIndex.GetPortalConstControl().Get(overallSortIndex.GetNumberOfValues() - 1) + 1;
#ifdef DEBUG_PRINT
std::cout << "OverallSortIndex.size " << overallSortIndex.GetNumberOfValues() << std::endl;
PrintIndices("overallSortIndex", overallSortIndex);
std::cout << "nVerticesCombined: " << nVerticesCombined << std::endl;
std::cout << "numVerticesCombined: " << numVerticesCombined << std::endl;
std::cout << std::endl;
#endif
@ -558,7 +558,7 @@ void ContourTreeMesh<FieldType>::mergeWith(ContourTreeMesh<FieldType>& other)
#endif
IdArrayType combinedNNeighbours;
vtkm::cont::Algorithm::Copy(vtkm::cont::ArrayHandleConstant<vtkm::Id>(0, nVerticesCombined),
vtkm::cont::Algorithm::Copy(vtkm::cont::ArrayHandleConstant<vtkm::Id>(0, numVerticesCombined),
combinedNNeighbours);
{ // New scope so that array gets deleted when leaving scope
IdArrayType nNeighbours;
@ -569,7 +569,7 @@ void ContourTreeMesh<FieldType>::mergeWith(ContourTreeMesh<FieldType>& other)
}
IdArrayType combinedOtherStartIndex;
vtkm::cont::Algorithm::Copy(vtkm::cont::ArrayHandleConstant<vtkm::Id>(0, nVerticesCombined),
vtkm::cont::Algorithm::Copy(vtkm::cont::ArrayHandleConstant<vtkm::Id>(0, numVerticesCombined),
combinedOtherStartIndex);
{ // New scope so that array gets deleted when leaving scope
IdArrayType nNeighbours;
@ -590,7 +590,7 @@ void ContourTreeMesh<FieldType>::mergeWith(ContourTreeMesh<FieldType>& other)
#endif
IdArrayType combinedFirstNeighbour;
combinedFirstNeighbour.Allocate(nVerticesCombined);
combinedFirstNeighbour.Allocate(numVerticesCombined);
vtkm::cont::Algorithm::ScanExclusive(combinedNNeighbours, combinedFirstNeighbour);
vtkm::Id nCombinedNeighbours = combinedFirstNeighbour.GetPortalConstControl().Get(
combinedFirstNeighbour.GetNumberOfValues() - 1) +
@ -610,7 +610,7 @@ void ContourTreeMesh<FieldType>::mergeWith(ContourTreeMesh<FieldType>& other)
combinedFirstNeighbour,
vtkm::cont::ArrayHandleConstant<vtkm::Id>(
0,
nVerticesCombined), // Constant 0 array. Just needed so we can use the same worklet for both cases
numVerticesCombined), // Constant 0 array. Just needed so we can use the same worklet for both cases
combinedNeighbours);
// Update neighbours from other
this->Invoke(updateCombinedNeighboursWorklet,
@ -716,7 +716,7 @@ void ContourTreeMesh<FieldType>::mergeWith(ContourTreeMesh<FieldType>& other)
this->globalMeshIndex = combinedGlobalMeshIndex;
this->neighbours = combinedNeighbours;
this->firstNeighbour = combinedFirstNeighbour;
this->nVertices = sortedValues.GetNumberOfValues();
this->NumVertices = sortedValues.GetNumberOfValues();
// TODO Do we need to set the sort order as well?
// Re-compute maximum number of neigbours