Commit 0677752a authored by Kyle Lutz's avatar Kyle Lutz

Add query selections

Conflicts:

  ParaViewCore/VTKExtensions/vtkQuerySelectionSource.cxx

Change-Id: I9829e1e38c5e627ba80673fda0fe21230fd2f758
parent 499fcbc4
......@@ -64,6 +64,7 @@ SET (Kit_SRCS
vtkPVDisplayInformation.cxx
vtkPVEnvironmentInformation.cxx
vtkPVEnvironmentInformationHelper.cxx
vtkPVExtractSelection.cxx
vtkPVFileInformation.cxx
vtkPVFileInformationHelper.cxx
vtkPVGenericAttributeInformation.cxx
......@@ -139,8 +140,8 @@ IF(PARAVIEW_ENABLE_PYTHON)
SET(Kit_SRCS ${Kit_SRCS}
vtkPythonAnimationCue.cxx
vtkPythonCalculator.cxx
vtkPythonExtractSelection.cxx
vtkPythonProgrammableFilter.cxx
vtkPythonExtractSelection.cxx
)
SET (KIT_LIBS ${KIT_LIBS} ${PYTHON_LIBRARIES} vtkPVPythonInterpretor)
INCLUDE_DIRECTORIES(
......
......@@ -45,6 +45,7 @@
#include "vtkPVDisplayInformation.h"
#include "vtkPVEnvironmentInformation.h"
#include "vtkPVEnvironmentInformationHelper.h"
#include "vtkPVExtractSelection.h"
#include "vtkPVFileInformation.h"
#include "vtkPVFileInformationHelper.h"
#include "vtkPVGenericAttributeInformation.h"
......@@ -158,6 +159,7 @@ int main(int, char**)
PRINT_SELF(vtkPVDisplayInformation);
PRINT_SELF(vtkPVEnvironmentInformation);
PRINT_SELF(vtkPVEnvironmentInformationHelper);
PRINT_SELF(vtkPVExtractSelection);
PRINT_SELF(vtkPVFileInformation);
PRINT_SELF(vtkPVFileInformationHelper);
PRINT_SELF(vtkPVGenericAttributeInformation);
......
......@@ -30,6 +30,7 @@
#include "vtkSmartPointer.h"
#include "vtkTable.h"
#include "vtkGraph.h"
#include "vtkPythonExtractSelection.h"
#include <vector>
......@@ -44,7 +45,7 @@ vtkStandardNewMacro(vtkPVExtractSelection);
//----------------------------------------------------------------------------
vtkPVExtractSelection::vtkPVExtractSelection()
{
this->SetNumberOfOutputPorts(3);
this->SetNumberOfOutputPorts(1);
}
//----------------------------------------------------------------------------
......@@ -78,26 +79,6 @@ int vtkPVExtractSelection::RequestDataObject(
return 0;
}
// Second and third outputs are selections
for (int i = 1; i <= 2; ++i)
{
vtkInformation* info = outputVector->GetInformationObject(i);
vtkSelection *selOut = vtkSelection::GetData(info);
if (!selOut || !selOut->IsA("vtkSelection"))
{
vtkDataObject* newOutput = vtkSelection::New();
if (!newOutput)
{
vtkErrorMacro("Could not create vtkSelectionOutput");
return 0;
}
newOutput->SetPipelineInformation(info);
this->GetOutputPortInformation(i)->Set(
vtkDataObject::DATA_EXTENT_TYPE(), newOutput->GetExtentType());
newOutput->Delete();
}
}
return 1;
}
......@@ -107,52 +88,47 @@ int vtkPVExtractSelection::RequestData(
vtkInformationVector** inputVector ,
vtkInformationVector* outputVector)
{
if (!this->Superclass::RequestData(request, inputVector, outputVector))
{
return 0;
}
vtkDataObject* inputDO = vtkDataObject::GetData(inputVector[0], 0);
vtkSelection* sel = vtkSelection::GetData(inputVector[1], 0);
vtkCompositeDataSet* cdInput = vtkCompositeDataSet::SafeDownCast(inputDO);
vtkCompositeDataSet* cdOutput = vtkCompositeDataSet::GetData(outputVector, 0);
vtkDataObject *dataObjectOutput = vtkDataObject::GetData(outputVector, 0);
//make an ids selection for the second output
//we can do this because all of the extractSelectedX filters produce
//arrays called "vtkOriginalXIds" that record what input cells produced
//each output cell, at least as long as PRESERVE_TOPOLOGY is off
//when we start allowing PreserveTopology, this will have to instead run
//through the vtkInsidedNess arrays, and for every on entry, record the
//entries index
//
// TODO: The ExtractSelectedGraph filter does not produce the vtkOriginalXIds,
// so to add support for vtkGraph selection in ParaView the filter will have
// to be extended. This requires test cases in ParaView to confirm it functions
// as expected.
vtkSelection *output = vtkSelection::SafeDownCast(
outputVector->GetInformationObject(1)->Get(vtkDataObject::DATA_OBJECT()));
output->Initialize();
vtkDataObject *outputDO = vtkDataObject::GetData(outputVector, 0);
if (!sel)
{
return 1;
}
// Simply pass the input selection into the third output
vtkSelection *passThroughSelection = vtkSelection::SafeDownCast(
outputVector->GetInformationObject(2)->Get(vtkDataObject::DATA_OBJECT()));
passThroughSelection->ShallowCopy(sel);
if(sel->GetNumberOfNodes() >= 1 && sel->GetNode(0)->GetContentType() == vtkSelectionNode::QUERY)
{
vtkPythonExtractSelection *pythonExtractSelection = vtkPythonExtractSelection::New();
vtkDataObject *localInputDO = inputDO->NewInstance();
localInputDO->ShallowCopy(inputDO);
// If input selection content type is vtkSelectionNode::BLOCKS, then we simply
// need to shallow copy the input as the output.
if (this->GetContentType(sel) == vtkSelectionNode::BLOCKS)
vtkSelection *localSel = sel->NewInstance();
localSel->ShallowCopy(sel);
pythonExtractSelection->SetInputConnection(0, localInputDO->GetProducerPort());
pythonExtractSelection->SetSelectionConnection(localSel->GetProducerPort());
pythonExtractSelection->Update();
outputDO->ShallowCopy(pythonExtractSelection->GetOutputDataObject(0));
pythonExtractSelection->Delete();
localSel->Delete();
localInputDO->Delete();
}
else
{
output->ShallowCopy(sel);
return 1;
// only call superclass's request data for non-query type
// selections (which use the python extract selection filter)
if (!this->Superclass::RequestData(request, inputVector, outputVector))
{
return 0;
}
}
vtkSelectionNodeVector oVector;
......@@ -194,18 +170,18 @@ int vtkPVExtractSelection::RequestData(
hbIter->GetCurrentIndex(), sel);
}
dataObjectOutput = vtkDataObject::SafeDownCast(cdOutput->GetDataSet(iter));
outputDO = vtkDataObject::SafeDownCast(cdOutput->GetDataSet(iter));
vtkSelectionNodeVector curOVector;
if (curSel && dataObjectOutput)
if (curSel && outputDO)
{
this->RequestDataInternal(curOVector, dataObjectOutput, curSel);
this->RequestDataInternal(curOVector, outputDO, curSel);
}
for (vtkSelectionNodeVector::iterator giter = non_composite_nodes.begin();
giter != non_composite_nodes.end(); ++giter)
{
this->RequestDataInternal(curOVector, dataObjectOutput, giter->GetPointer());
this->RequestDataInternal(curOVector, outputDO, giter->GetPointer());
}
for (vtkSelectionNodeVector::iterator viter = curOVector.begin();
......@@ -220,21 +196,15 @@ int vtkPVExtractSelection::RequestData(
}
iter->Delete();
}
else if (dataObjectOutput) // and not composite dataset.
else if (outputDO) // and not composite dataset.
{
unsigned int numNodes = sel->GetNumberOfNodes();
for (unsigned int i = 0; i < numNodes; i++)
{
this->RequestDataInternal(oVector, dataObjectOutput, sel->GetNode(i));
this->RequestDataInternal(oVector, outputDO, sel->GetNode(i));
}
}
vtkSelectionNodeVector::iterator iter;
for (iter = oVector.begin(); iter != oVector.end(); ++iter)
{
output->AddNode(iter->GetPointer());
}
return 1;
}
......@@ -385,4 +355,3 @@ void vtkPVExtractSelection::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
}
......@@ -19,19 +19,6 @@
// Output port 0 -- is the output from the superclass. It's nothing but the
// extracted dataset.
//
// Output port 1 -- is a vtkSelection consisting of indices of the cells/points
// extracted. If vtkSelection used as the input to this filter is of the field
// type vtkSelection::CELL, then the output vtkSelection has both the cell
// indicides as well as point indices of the cells/points that were extracted.
// If input field type is vtkSelection::POINT, then the output vtkSelection only
// has the indicies of the points that were extracted.
// This second output is useful for correlating particular
// cells in the subset with the original data set. This is used, for instance,
// by ParaView's Spreadsheet view.
//
// Output port 2 -- is simply the input vtkSelection (set on input port number
// 1).
//
// .SECTION See Also
// vtkExtractSelection vtkSelection
......
......@@ -31,6 +31,8 @@
#include "vtkTable.h"
#include "vtkUnstructuredGrid.h"
#include "vtkCell.h"
#include "vtkSelection.h"
#include "vtkSelectionNode.h"
#include <assert.h>
#include <vtksys/ios/sstream>
......@@ -40,26 +42,36 @@
vtkStandardNewMacro(vtkPythonExtractSelection);
//----------------------------------------------------------------------------
vtkPythonExtractSelection::vtkPythonExtractSelection()
: ArrayAssociation(vtkDataObject::FIELD_ASSOCIATION_POINTS),
Expression(0)
{
this->SetExecuteMethod(vtkPythonExtractSelection::ExecuteScript, this);
// eventually, once this class starts taking in a real vtkSelection.
// this->SetNumberOfInputPorts(2);
this->SetNumberOfInputPorts(2);
}
//----------------------------------------------------------------------------
vtkPythonExtractSelection::~vtkPythonExtractSelection()
{
this->SetExpression(0);
}
//----------------------------------------------------------------------------
int vtkPythonExtractSelection::FillInputPortInformation(int port, vtkInformation *info)
{
this->Superclass::FillInputPortInformation(port, info);
info->Append(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkCompositeDataSet");
if(port == 0)
{
this->Superclass::FillInputPortInformation(port, info);
info->Append(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkCompositeDataSet");
}
else if(port == 1)
{
info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkSelection");
info->Set(vtkAlgorithm::INPUT_IS_OPTIONAL(), 1);
}
else
{
return 0;
}
return 1;
}
......@@ -134,7 +146,7 @@ void vtkPythonExtractSelection::Exec()
<< "paraview.fromFilter = True" << endl
<< "from paraview import extract_selection as pv_es" << endl
<< "me = paraview.servermanager.vtkPythonExtractSelection('" << aplus << " ')" << endl
<< "pv_es.Exec(me, me.GetInputDataObject(0, 0), me.GetOutputDataObject(0))" << endl
<< "pv_es.Exec(me, me.GetInputDataObject(0, 0), me.GetInputDataObject(1, 0), me.GetOutputDataObject(0))" << endl
<< "del me" << endl;
vtkPythonProgrammableFilter::GetGlobalPipelineInterpretor()->RunSimpleString(
......@@ -144,19 +156,20 @@ void vtkPythonExtractSelection::Exec()
//----------------------------------------------------------------------------
vtkDataObject* vtkPythonExtractSelection::ExtractElements(
vtkDataObject* data, vtkCharArray* mask)
vtkDataObject* data, vtkSelection *selection, vtkCharArray* mask)
{
vtkDataSet* ds = vtkDataSet::SafeDownCast(data);
vtkTable* table = vtkTable::SafeDownCast(data);
vtkSelectionNode* selNode = selection->GetNode(0);
if (ds)
{
switch (this->ArrayAssociation)
switch (selNode->GetFieldType())
{
case vtkDataObject::FIELD_ASSOCIATION_POINTS:
case vtkSelectionNode::POINT:
return this->ExtractPoints(ds, mask);
case vtkDataObject::FIELD_ASSOCIATION_CELLS:
case vtkSelectionNode::CELL:
return this->ExtractCells(ds, mask);
}
}
......@@ -189,7 +202,7 @@ vtkUnstructuredGrid* vtkPythonExtractSelection::ExtractPoints(
outputPD->CopyAllocate(inputPD, numPoints);
vtkIdTypeArray* originalIds = vtkIdTypeArray::New();
originalIds->SetName("vtkOriginalIds");
originalIds->SetName("vtkOriginalPointIds");
originalIds->Allocate(numPoints);
const char* pmask = mask->GetPointer(0);
......@@ -248,11 +261,11 @@ vtkUnstructuredGrid* vtkPythonExtractSelection::ExtractCells(
outputPD->CopyAllocate(inputPD);
vtkIdTypeArray* originalPointIds = vtkIdTypeArray::New();
originalPointIds->SetName("vtkOriginalIds");
originalPointIds->SetName("vtkOriginalPointIds");
originalPointIds->Allocate(numPoints);
vtkIdTypeArray* originalCellIds = vtkIdTypeArray::New();
originalCellIds->SetName("vtkOriginalIds");
originalCellIds->SetName("vtkOriginalCellIds");
originalCellIds->Allocate(numCells);
std::map<vtkIdType, vtkIdType> outPointIdMap;
......
......@@ -24,6 +24,7 @@
class vtkCharArray;
class vtkDataSet;
class vtkTable;
class vtkSelection;
class vtkUnstructuredGrid;
class VTK_EXPORT vtkPythonExtractSelection : public vtkProgrammableFilter
......@@ -34,22 +35,16 @@ public:
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Which field data to get the arrays from. See
// vtkDataObject::FieldAssociations for choices. The default
// is FIELD_ASSOCIATION_POINTS.
vtkSetMacro(ArrayAssociation, int);
vtkGetMacro(ArrayAssociation, int);
// Description:
// Set the text of the python expression to execute. This expression
// must return a scalar value (which is converted to an array) or a
// numpy array.
vtkSetStringMacro(Expression)
vtkGetStringMacro(Expression)
// Convenience method to specify the selection connection (2nd input
// port)
void SetSelectionConnection(vtkAlgorithmOutput* algOutput)
{
this->SetInputConnection(1, algOutput);
}
// Description:
// Internal method.
vtkDataObject* ExtractElements(vtkDataObject* data, vtkCharArray* mask);
vtkDataObject* ExtractElements(vtkDataObject* data, vtkSelection* selection, vtkCharArray* mask);
//BTX
protected:
......@@ -72,9 +67,6 @@ protected:
vtkInformationVector** inputVector,
vtkInformationVector* outputVector);
int ArrayAssociation;
char* Expression;
private:
vtkPythonExtractSelection(const vtkPythonExtractSelection&); // Not implemented
void operator=(const vtkPythonExtractSelection&); // Not implemented
......
......@@ -73,7 +73,7 @@ int vtkSpreadSheetRepresentation::FillInputPortInformation(
break;
case 2:
info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkSelection");
info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkDataObject");
break;
default:
......@@ -133,11 +133,7 @@ vtkAlgorithmOutput* vtkSpreadSheetRepresentation::GetExtractedDataProducer()
//----------------------------------------------------------------------------
vtkAlgorithmOutput* vtkSpreadSheetRepresentation::GetSelectionProducer()
{
if (this->GetNumberOfInputConnections(2) == 1)
{
return this->GetInternalOutputPort(2, 0);
}
return NULL;
return this->GetExtractedDataProducer();
}
......
......@@ -8785,21 +8785,6 @@ This filter extracts a list of datasets from hierarchical datasets.
The input that provides the selection object.
</Documentation>
</InputProperty>
<IntVectorProperty
name="PreserveTopology"
command="SetPreserveTopology"
number_of_elements="1"
default_values="0" >
<BooleanDomain name="bool"/>
<Documentation>
If this property is set to 1 the output preserves the topology of its
input and adds an insidedness array to mark which cells are inside or
out. If 0 then the output is an unstructured grid which contains only
the subset of cells that are inside.
</Documentation>
</IntVectorProperty>
<!-- End ExtractSelection -->
</SourceProxy>
......@@ -8957,7 +8942,7 @@ This property controls how the filter works to generate tensor cell data. You ca
</SourceProxy>
<!-- ==================================================================== -->
<SourceProxy name="ExtractSelection" class="vtkExtractSelection"
<SourceProxy name="ExtractSelection" class="vtkPVExtractSelection"
label="Extract Selection">
<Documentation
short_help="Extract different type of selections."
......
<ServerManagerConfiguration>
<ProxyGroup name="filters">
<SourceProxy name="PythonExtractSelection"
class="vtkPythonExtractSelection"
label="Extract Selection (Python)">
<InputProperty
name="Input"
command="AddInputConnection"
clean_command="RemoveAllInputs"
multiple_input="1">
<ProxyGroupDomain name="groups">
<Group name="sources"/>
<Group name="filters"/>
</ProxyGroupDomain>
<DataTypeDomain name="input_type">
<DataType value="vtkDataSet"/>
</DataTypeDomain>
<Documentation>
Set the input of the filter.
</Documentation>
</InputProperty>
<StringVectorProperty
name="Expression"
command="SetExpression"
number_of_elements="1">
<Documentation>
The Python expression evaluated during execution.
</Documentation>
</StringVectorProperty>
<IntVectorProperty
name="ArrayAssociation"
command="SetArrayAssociation"
number_of_elements="1"
default_values="0">
<EnumerationDomain name="enum">
<Entry value="0" text="Point Data"/>
<Entry value="1" text="Cell Data"/>
</EnumerationDomain>
<Documentation>
This property controls the association of the output array as well as
which arrays are defined as variables.
</Documentation>
</IntVectorProperty>
</SourceProxy>
<SourceProxy name="PythonCalculator"
class="vtkPythonCalculator"
label="Python Calculator">
......
......@@ -1428,57 +1428,12 @@ OS is the output scalar; M represents the maximum value; G represents the Gaussi
</EnumerationDomain>
</IntVectorProperty>
<IntVectorProperty name="TermMode"
command="SetTermMode"
number_of_elements="1"
default_values="0">
<EnumerationDomain name="enum">
<Entry value="0" text="None" />
<Entry value="1" text="ID" />
<Entry value="2" text="GLOBALID" />
<Entry value="3" text="ARRAY" />
<Entry value="4" text="LOCATION" />
<Entry value="5" text="BLOCK" />
</EnumerationDomain>
</IntVectorProperty>
<IntVectorProperty name="Operator"
command="SetOperator"
number_of_elements="1"
default_values="0">
<EnumerationDomain name="enum">
<Entry value="0" text="None" />
<Entry value="1" text="IS_ONE_OF" />
<Entry value="2" text="IS_BETWEEN" />
<Entry value="3" text="IS_GE" />
<Entry value="4" text="IS_LE" />
</EnumerationDomain>
</IntVectorProperty>
<StringVectorProperty name="ArrayName"
command="SetArrayName"
<StringVectorProperty name="QueryString"
command="SetQueryString"
number_of_elements="1"
default_values="">
</StringVectorProperty>
<IntVectorProperty name="ArrayComponent"
command="SetArrayComponent"
number_of_elements="1"
default_values="0">
</IntVectorProperty>
<IdTypeVectorProperty name="IdTypeValues"
command="SetIdTypeValues"
set_number_command="SetNumberOfIdTypeValues"
argument_is_array="1">
</IdTypeVectorProperty>
<DoubleVectorProperty name="DoubleValues"
command="SetDoubleValues"
set_number_command="SetNumberOfDoubleValues"
argument_is_array="1">
</DoubleVectorProperty>
<IntVectorProperty name="CompositeIndex"
command="SetCompositeIndex"
number_of_elements="1"
......@@ -1491,7 +1446,6 @@ OS is the output scalar; M represents the maximum value; G represents the Gaussi
default_values="-1">
</IntVectorProperty>
<IntVectorProperty name="HierarchicalIndex"
command="SetHierarchicalIndex"
number_of_elements="1"
......@@ -1504,17 +1458,6 @@ OS is the output scalar; M represents the maximum value; G represents the Gaussi
default_values="-1">
</IntVectorProperty>
<IntVectorProperty name="ContainingCells"
command="SetContainingCells"
number_of_elements="1"
default_values="0">
<BooleanDomain name="bool" />
<Documentation>
Useful only when FieldType==POINT. This results in selecting the cells
that contain the matching points.
</Documentation>
</IntVectorProperty>
<StringVectorProperty name="UserFriendlyText"
information_only="1"
command="GetUserFriendlyText">
......@@ -1523,19 +1466,6 @@ OS is the output scalar; M represents the maximum value; G represents the Gaussi
Reconstructs the query as a user friendly text eg. "IDs >= 12".
</Documentation>
</StringVectorProperty>
<IntVectorProperty
name="InsideOut"
command="SetInverse"
number_of_elements="1"
default_values="0" >
<BooleanDomain name="bool"/>
<Documentation>
When this property is false the selection describes everything that
should be extracted. When this is true the selection describes
everything that should NOT be extracted.
</Documentation>
</IntVectorProperty>
<!-- end of SelectionQuerySource -->
</SourceProxy>
......
......@@ -121,7 +121,6 @@ SET (Kit_SRCS
vtkPVEnSightMasterServerTranslator.cxx
vtkPVExponentialKeyFrame.cxx
vtkPVExtentTranslator.cxx
vtkPVExtractSelection.cxx
vtkPVExtractVOI.cxx
vtkPVFrustumActor.cxx
vtkPVGenericRenderWindowInteractor.cxx
......
......@@ -115,7 +115,6 @@
#include "vtkPVEnSightMasterServerTranslator.h"
#include "vtkPVExponentialKeyFrame.h"
#include "vtkPVExtentTranslator.h"
#include "vtkPVExtractSelection.h"
#include "vtkPVExtractVOI.h"
#include "vtkPVFrustumActor.h"
#include "vtkPVGenericRenderWindowInteractor.h"
......@@ -321,7 +320,6 @@ int main(int , char *[])
PRINT_SELF(vtkPVEnSightMasterServerTranslator);
PRINT_SELF(vtkPVExponentialKeyFrame);
PRINT_SELF(vtkPVExtentTranslator);
PRINT_SELF(vtkPVExtractSelection);
PRINT_SELF(vtkPVExtractVOI);
PRINT_SELF(vtkPVFrustumActor);
PRINT_SELF(vtkPVGenericRenderWindowInteractor);
......
......@@ -22,6 +22,10 @@
#include "vtkSelectionNode.h"
#include "vtkTable.h"
#include "vtkUnsignedIntArray.h"
#include "vtkDataSet.h"
#include "vtkPointData.h"
#include "vtkCellData.h"
#include "vtkUnstructuredGrid.h"
vtkStandardNewMacro(vtkMarkSelectedRows);
//----------------------------------------------------------------------------
......@@ -41,7 +45,7 @@ int vtkMarkSelectedRows::FillInputPortInformation(int port, vtkInformation* info
{
if (port == 1)
{
info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkSelection");
info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkUnstructuredGrid");
info->Set(vtkAlgorithm::INPUT_IS_OPTIONAL(), 1);
return 1;
}
......@@ -54,9 +58,10 @@ int vtkMarkSelectedRows::RequestData(vtkInformation*,
vtkInformationVector** inputVector,
vtkInformationVector* outputVector)
{
vtkSelection* inputSelection = vtkSelection::GetData(inputVector[1], 0);
vtkTable* input = vtkTable::GetData(inputVector[0], 0);
vtkUnstructuredGrid *inputUG = vtkUnstructuredGrid::GetData(inputVector[1], 0);
vtkTable* output = vtkTable::GetData(outputVector, 0);
output->ShallowCopy(input);
vtkCharArray* selected = vtkCharArray::New();
......@@ -66,77 +71,107 @@ int vtkMarkSelectedRows::RequestData(vtkInformation*,
output->AddColumn(selected);
selected->Delete();
if (!inputSelection)
if(!inputUG)
{
return 1;
}
vtkIdTypeArray *selectedIdsArray = 0;
if(vtkPointData *pointData = inputUG->GetPointData())
{
selectedIdsArray = vtkIdTypeArray::SafeDownCast(pointData->GetAbstractArray("vtkOriginalIds"));
}
else if(vtkCellData *cellData = inputUG->GetCellData())
{
selectedIdsArray = vtkIdTypeArray::SafeDownCast(cellData->GetAbstractArray("vtkOriginalIds"));
}
if(!selectedIdsArray)
{
return 1;
}
// Locate the selection node that may be applicable to the input.
// This is determined by using the existence of special array in the input
// such as vtkOriginalIndices, vtkOriginalProcessIds, vtkCompositeIndexArray
// etc.
vtkUnsignedIntArray* compIndexArray = vtkUnsignedIntArray::SafeDownCast(
input->GetColumnByName("vtkCompositeIndexArray"));
vtkIdTypeArray* originalIdsArray = vtkIdTypeArray::SafeDownCast(
input->GetColumnByName("vtkOriginalIndices"));
for (unsigned int ii=0; ii < inputSelection->GetNumberOfNodes(); ii++)
for (unsigned int i = 0; i < output->GetNumberOfRows(); i++)
{
vtkSelectionNode* node = inputSelection->GetNode(ii);
if ((node->GetFieldType() == vtkSelectionNode::POINT &&
this->FieldAssociation == vtkDataObject::FIELD_ASSOCIATION_POINTS) ||
(node->GetFieldType() == vtkSelectionNode::CELL &&
this->FieldAssociation == vtkDataObject::FIELD_ASSOCIATION_CELLS) ||
(node->GetFieldType() == vtkSelectionNode::ROW &&
this->FieldAssociation == vtkDataObject::FIELD_ASSOCIATION_ROWS))
{
// field association matches -- keep going.
}
else
{
continue;
}
vtkInformation* properties = node->GetProperties();
bool has_cid = properties->Has(vtkSelectionNode::COMPOSITE_INDEX()) != 0;