Commit a3fb610c authored by Dave Demarle's avatar Dave Demarle
Browse files

ENH: Make extractselection produce a second output, which holds an ids...

ENH: Make extractselection produce a second output, which holds an ids selection that helps to correlate entries in the output data set to the input data set.
parent a8a2697d
......@@ -30,7 +30,7 @@
#include "vtkStreamingDemandDrivenPipeline.h"
vtkCxxRevisionMacro(vtkExtractSelection, "1.17");
vtkCxxRevisionMacro(vtkExtractSelection, "1.18");
vtkStandardNewMacro(vtkExtractSelection);
//----------------------------------------------------------------------------
......@@ -69,6 +69,7 @@ int vtkExtractSelection::RequestDataObject(
vtkDataSet *input = vtkDataSet::SafeDownCast(
inInfo->Get(vtkDataObject::DATA_OBJECT()));
if (input)
{
int passThrough = 0;
......@@ -84,35 +85,32 @@ int vtkExtractSelection::RequestDataObject(
}
}
for(int i=0; i < this->GetNumberOfOutputPorts(); ++i)
{
vtkInformation* info = outputVector->GetInformationObject(i);
vtkDataSet *output = vtkDataSet::SafeDownCast(
info->Get(vtkDataObject::DATA_OBJECT()));
vtkInformation* info = outputVector->GetInformationObject(0);
vtkDataSet *output = vtkDataSet::SafeDownCast(
info->Get(vtkDataObject::DATA_OBJECT()));
if (!output
||
(passThrough && !output->IsA(input->GetClassName()))
||
(!passThrough && !output->IsA("vtkUnstructuredGrid"))
)
if (!output
||
(passThrough && !output->IsA(input->GetClassName()))
||
(!passThrough && !output->IsA("vtkUnstructuredGrid"))
)
{
vtkDataSet* newOutput = NULL;
if (!passThrough)
{
// The mesh will be modified.
newOutput = vtkUnstructuredGrid::New();
}
else
{
vtkDataSet* newOutput = NULL;
if (!passThrough)
{
// The mesh will be modified.
newOutput = vtkUnstructuredGrid::New();
}
else
{
// The mesh will not be modified.
newOutput = input->NewInstance();
}
newOutput->SetPipelineInformation(info);
newOutput->Delete();
this->GetOutputPortInformation(i)->Set(
vtkDataObject::DATA_EXTENT_TYPE(), newOutput->GetExtentType());
// The mesh will not be modified.
newOutput = input->NewInstance();
}
newOutput->SetPipelineInformation(info);
newOutput->Delete();
this->GetOutputPortInformation(0)->Set(
vtkDataObject::DATA_EXTENT_TYPE(), newOutput->GetExtentType());
}
return 1;
}
......
......@@ -58,12 +58,12 @@ protected:
vtkExtractSelection();
~vtkExtractSelection();
//sets up output dataset
//sets up empty output dataset
virtual int RequestDataObject(vtkInformation* request,
vtkInformationVector** inputVector,
vtkInformationVector* outputVector);
// Usual data generation method
//runs the algorithm and fills the output with results
virtual int RequestData(vtkInformation *,
vtkInformationVector **,
vtkInformationVector *);
......
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