An update will be applied December 9th, between 12PM and 1:00PM EST (UTC -5:00). The site may be slow during that time.

Commit e847f4ae authored by Ken Martin's avatar Ken Martin
Browse files

ENH: can prioritize pieces based on scalar range

parent 668ab1ef
......@@ -43,7 +43,7 @@
#include <math.h>
vtkCxxRevisionMacro(vtkContourFilter, "1.125");
vtkCxxRevisionMacro(vtkContourFilter, "1.126");
vtkStandardNewMacro(vtkContourFilter);
vtkCxxSetObjectMacro(vtkContourFilter,ScalarTree,vtkScalarTree);
......@@ -606,6 +606,60 @@ int vtkContourFilter::GetArrayComponent()
return( this->SynchronizedTemplates2D->GetArrayComponent() );
}
//----------------------------------------------------------------------------
int vtkContourFilter::ProcessRequest(vtkInformation* request,
vtkInformationVector** inputVector,
vtkInformationVector* outputVector)
{
// generate the data
if(request->Has(vtkStreamingDemandDrivenPipeline::REQUEST_UPDATE_EXTENT_INFORMATION()))
{
// compute the priority for this UE
vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
if (!inInfo)
{
return 1;
}
// get the range of the input if available
vtkInformation *fInfo =
vtkDataObject::GetActiveFieldInformation
(inInfo, vtkDataObject::FIELD_ASSOCIATION_POINTS,
vtkDataSetAttributes::SCALARS);
if (!fInfo)
{
return 1;
}
double *range = fInfo->Get(vtkDataObject::FIELD_RANGE());
if (range)
{
// compute the priority
// get the incoming priority if any
double inPrior = 1;
if (inInfo->Has(vtkStreamingDemandDrivenPipeline::PRIORITY()))
{
inPrior = inInfo->Get(vtkStreamingDemandDrivenPipeline::PRIORITY());
}
// do any contours intersect the range?
int numContours=this->ContourValues->GetNumberOfContours();
double *values=this->ContourValues->GetValues();
double prior = 0;
int i;
for (i=0; i < numContours; i++)
{
if (values[i] >= range[0] && values[i] <= range[1])
{
prior = inPrior;
break;
}
}
outputVector->GetInformationObject(0)->
Set(vtkStreamingDemandDrivenPipeline::PRIORITY(),prior);
}
return 1;
}
return this->Superclass::ProcessRequest(request, inputVector, outputVector);
}
int vtkContourFilter::FillInputPortInformation(int, vtkInformation *info)
{
info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkDataSet");
......
......@@ -136,6 +136,12 @@ public:
void SetArrayComponent( int );
int GetArrayComponent();
// Description:
// see vtkAlgorithm for details
virtual int ProcessRequest(vtkInformation*,
vtkInformationVector**,
vtkInformationVector*);
protected:
vtkContourFilter();
~vtkContourFilter();
......
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