Commit 2862917f authored by Brian Wylie's avatar Brian Wylie
Browse files

ENH: Adding an optional default value parameter to InsertNextBlankRow

parent 9ca5db5d
......@@ -35,7 +35,7 @@
// Standard functions
//
vtkCxxRevisionMacro(vtkTable, "1.27");
vtkCxxRevisionMacro(vtkTable, "1.28");
vtkStandardNewMacro(vtkTable);
vtkCxxSetObjectMacro(vtkTable, RowData, vtkDataSetAttributes);
......@@ -216,7 +216,7 @@ void vtkTable::SetRow(vtkIdType row, vtkVariantArray *values)
}
//----------------------------------------------------------------------------
vtkIdType vtkTable::InsertNextBlankRow()
vtkIdType vtkTable::InsertNextBlankRow(double default_num_val)
{
vtkIdType ncol = this->GetNumberOfColumns();
for (vtkIdType i = 0; i < ncol; i++)
......@@ -229,7 +229,7 @@ vtkIdType vtkTable::InsertNextBlankRow()
double* tuple = new double[comps];
for (int j = 0; j < comps; j++)
{
tuple[j] = 0;
tuple[j] = default_num_val;
}
data->InsertNextTuple(tuple);
delete[] tuple;
......
......@@ -105,7 +105,7 @@ public:
// Description:
// Insert a blank row at the end of the table.
vtkIdType InsertNextBlankRow();
vtkIdType InsertNextBlankRow(double default_num_val=0.0);
// Description:
// Insert a row specified by a vtkVariantArray. The number of entries in the array
......
......@@ -37,7 +37,7 @@
#include <vtksys/stl/utility>
#include <vtksys/stl/vector>
vtkCxxRevisionMacro(vtkGroupLeafVertices, "1.12");
vtkCxxRevisionMacro(vtkGroupLeafVertices, "1.13");
vtkStandardNewMacro(vtkGroupLeafVertices);
//---------------------------------------------------------------------------
......@@ -194,7 +194,7 @@ int vtkGroupLeafVertices::RequestData(
else
{
group_vertex = builder->AddVertex();
treeTable->InsertNextBlankRow();
treeTable->InsertNextBlankRow(-1);
vtkEdgeType group_e = builder->AddEdge(v, group_vertex);
builderEdgeData->CopyData(inputEdgeData, tree_e.Id, group_e.Id);
group_vertices[vtksys_stl::make_pair(v, groupVal)] = group_vertex;
......
......@@ -36,7 +36,7 @@
#include <vtkstd/vector>
#include <vtkstd/string>
vtkCxxRevisionMacro(vtkTableToTreeFilter, "1.9");
vtkCxxRevisionMacro(vtkTableToTreeFilter, "1.10");
vtkStandardNewMacro(vtkTableToTreeFilter);
......@@ -95,22 +95,22 @@ int vtkTableToTreeFilter::RequestData(
if (new_table->GetNumberOfRows() != 0)
{
// The tree will have one more vertex than the number of rows
// in the table (the extra vertex is the new root).
for (vtkIdType v = 0; v <= new_table->GetNumberOfRows(); ++v)
{
builder->AddVertex();
}
// Make a star, originating at the new root (the last vertex).
vtkIdType root = new_table->GetNumberOfRows();
for (vtkIdType v = 0; v < new_table->GetNumberOfRows(); ++v)
{
builder->AddEdge(root, v);
}
// Insert a row in the table for the new root.
new_table->InsertNextBlankRow();
// The tree will have one more vertex than the number of rows
// in the table (the extra vertex is the new root).
for (vtkIdType v = 0; v <= new_table->GetNumberOfRows(); ++v)
{
builder->AddVertex();
}
// Make a star, originating at the new root (the last vertex).
vtkIdType root = new_table->GetNumberOfRows();
for (vtkIdType v = 0; v < new_table->GetNumberOfRows(); ++v)
{
builder->AddEdge(root, v);
}
// Insert a row in the table for the new root.
new_table->InsertNextBlankRow(-1);
}
// Move the structure of the mutable graph into the tree.
......
Supports Markdown
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