Commit ceb22b45 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Cleaned up API to control ordered compositing process order.

When ordered compositing is enabled, ParaView determines the process order by
partitioning the data using PKdTree. However, in some cases, like when volume
rendering image-data, we need to override the partitioning using the partitions
from the image data itself. This commit cleans up the API for proving such
information to the view from a representation. In past it was tightly coupled
with vtkImageData producer. This change makes it possible to just pass the
meta-data about extent-translator to use, origin, spacing, extents etc. to
generate the partitioning. This will make it possible for non-image data
representations to provide this meta-data without having to create a
vtkImageData.

This removes obsolete vtkBSPCutsGenerator. Also vtkKdTreeManager now always
regenerates the KdTree. The checks to avoid regenerating unless the input
changed have been removed.

Change-Id: I469f54ba931fd64f66097d0ea579e9d8652d9bfc
parent 2cb15561
......@@ -16,6 +16,7 @@
#include "vtkAlgorithmOutput.h"
#include "vtkCommand.h"
#include "vtkExtentTranslator.h"
#include "vtkImageData.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
......@@ -29,6 +30,7 @@
#include "vtkRenderer.h"
#include "vtkSmartPointer.h"
#include "vtkSmartVolumeMapper.h"
#include "vtkStreamingDemandDrivenPipeline.h"
#include "vtkVolumeProperty.h"
#include <map>
......@@ -106,8 +108,24 @@ int vtkImageVolumeRepresentation::ProcessViewRequest(
// will get back to it later.
if (this->GetNumberOfInputConnections(0) == 1)
{
vtkPVRenderView::SetImageDataProducer(inInfo, this,
this->GetInputConnection(0, 0));
vtkAlgorithmOutput* connection = this->GetInputConnection(0, 0);
vtkAlgorithm* inputAlgo = connection->GetProducer();
vtkStreamingDemandDrivenPipeline* sddp =
vtkStreamingDemandDrivenPipeline::SafeDownCast(inputAlgo->GetExecutive());
vtkExtentTranslator* translator =
sddp->GetExtentTranslator(connection->GetIndex());
int extent[6] = {1, -1, 1, -1, 1, -1};
sddp->GetWholeExtent(sddp->GetOutputInformation(connection->GetIndex()),
extent);
double origin[3], spacing[3];
vtkImageData* image = vtkImageData::SafeDownCast(
inputAlgo->GetOutputDataObject(connection->GetIndex()));
image->GetOrigin(origin);
image->GetSpacing(spacing);
vtkPVRenderView::SetOrderedCompositingInformation(inInfo, this,
translator, extent, origin, spacing);
}
}
else if (request_type == vtkPVView::REQUEST_RENDER())
......
......@@ -15,8 +15,9 @@
#include "vtkPVDataDeliveryManager.h"
#include "vtkAlgorithmOutput.h"
#include "vtkBSPCutsGenerator.h"
#include "vtkDataObject.h"
#include "vtkExtentTranslator.h"
#include "vtkKdTreeManager.h"
#include "vtkMPIMoveData.h"
#include "vtkMultiProcessController.h"
#include "vtkNew.h"
......@@ -67,6 +68,15 @@ public:
typedef std::priority_queue<vtkPriorityQueueItem> PriorityQueueType;
PriorityQueueType PriorityQueue;
class vtkOrderedCompositingInfo
{
public:
vtkSmartPointer<vtkExtentTranslator> Translator;
double Origin[3];
double Spacing[3];
int WholeExtent[6];
};
class vtkItem
{
vtkSmartPointer<vtkPVTrivialProducer> Producer;
......@@ -87,8 +97,7 @@ public:
unsigned long TimeStamp;
unsigned long ActualMemorySize;
public:
vtkWeakPointer<vtkAlgorithmOutput> ImageDataProducer;
// <-- HACK for image data volume rendering.
vtkOrderedCompositingInfo OrderedCompositingInfo;
vtkWeakPointer<vtkPVDataRepresentation> Representation;
bool AlwaysClone;
......@@ -384,13 +393,20 @@ void vtkPVDataDeliveryManager::SetPiece(unsigned int id, vtkDataObject* data, bo
}
//----------------------------------------------------------------------------
void vtkPVDataDeliveryManager::SetImageDataProducer(
vtkPVDataRepresentation* repr, vtkAlgorithmOutput *producer)
void vtkPVDataDeliveryManager::SetOrderedCompositingInformation(
vtkPVDataRepresentation* repr, vtkExtentTranslator* translator,
const int whole_extents[6], const double origin[3], const double spacing[3])
{
vtkInternals::vtkItem* item = this->Internals->GetItem(repr, false);
if (item)
{
item->ImageDataProducer = producer;
vtkInternals::vtkOrderedCompositingInfo info;
info.Translator = translator;
memcpy(info.WholeExtent, whole_extents, sizeof(int)*6);
memcpy(info.Origin, origin, sizeof(double)*3);
memcpy(info.Spacing, spacing, sizeof(double)*3);
item->OrderedCompositingInfo = info;
}
else
{
......@@ -509,7 +525,7 @@ void vtkPVDataDeliveryManager::RedistributeDataForOrderedCompositing(
// need to re-generate the kd-tree.
this->RedistributionTimeStamp.Modified();
vtkNew<vtkBSPCutsGenerator> cutsGenerator;
vtkNew<vtkKdTreeManager> cutsGenerator;
vtkInternals::ItemsMapType::iterator iter;
for (iter = this->Internals->ItemsMap.begin();
iter != this->Internals->ItemsMap.end(); ++iter)
......@@ -518,26 +534,24 @@ void vtkPVDataDeliveryManager::RedistributeDataForOrderedCompositing(
if (item.Representation &&
item.Representation->GetVisibility())
{
if (item.Redistributable)
if (item.OrderedCompositingInfo.Translator)
{
cutsGenerator->AddInputData(item.GetDeliveredDataObject());
// implies that the representation is providing us with means to
// override how the ordered compositing happens.
const vtkInternals::vtkOrderedCompositingInfo &info =
item.OrderedCompositingInfo;
cutsGenerator->SetStructuredDataInformation(info.Translator,
info.WholeExtent, info.Origin, info.Spacing);
}
else if (item.ImageDataProducer)
else if (item.Redistributable)
{
cutsGenerator->AddInputConnection(item.ImageDataProducer);
cutsGenerator->AddDataObject(item.GetDeliveredDataObject());
}
}
}
cutsGenerator->GenerateKdTree();
this->KdTree = cutsGenerator->GetKdTree();
vtkMultiProcessController* controller =
vtkMultiProcessController::GetGlobalController();
vtkStreamingDemandDrivenPipeline *sddp = vtkStreamingDemandDrivenPipeline::
SafeDownCast(cutsGenerator->GetExecutive());
sddp->SetUpdateExtent
(0,controller->GetLocalProcessId(),controller->GetNumberOfProcesses(),0);
sddp->Update(0);
this->KdTree = cutsGenerator->GetPKdTree();
vtkTimerLog::MarkEndEvent("Regenerate Kd-Tree");
}
......
......@@ -31,9 +31,10 @@
class vtkAlgorithmOutput;
class vtkDataObject;
class vtkExtentTranslator;
class vtkPKdTree;
class vtkPVDataRepresentation;
class vtkPVRenderView;
class vtkPKdTree;
//BTX
#include <vector>
......@@ -116,6 +117,13 @@ public:
// ensure that the geometries are redistributed, as needed.
void RedistributeDataForOrderedCompositing(bool use_lod);
// Description:
// Pass the structured-meta-data for determining rendering order for ordered
// compositing.
void SetOrderedCompositingInformation(
vtkPVDataRepresentation* repr, vtkExtentTranslator* translator,
const int whole_extents[6], const double origin[3], const double spacing[3]);
//BTX
// Description:
// Internal method used to determine the list of representations that need
......@@ -162,10 +170,6 @@ public:
// *******************************************************************
// *******************************************************************
// HACK for dealing with volume rendering for image data
void SetImageDataProducer(vtkPVDataRepresentation* repr, vtkAlgorithmOutput*);
//BTX
protected:
vtkPVDataDeliveryManager();
......
......@@ -1183,9 +1183,10 @@ void vtkPVRenderView::SetStreamable(
}
//----------------------------------------------------------------------------
void vtkPVRenderView::SetImageDataProducer(
void vtkPVRenderView::SetOrderedCompositingInformation(
vtkInformation* info, vtkPVDataRepresentation* repr,
vtkAlgorithmOutput* producer)
vtkExtentTranslator* translator,
const int whole_extents[6], const double origin[3], const double spacing[3])
{
vtkPVRenderView* view = vtkPVRenderView::SafeDownCast(info->Get(VIEW()));
if (!view)
......@@ -1193,8 +1194,8 @@ void vtkPVRenderView::SetImageDataProducer(
vtkGenericWarningMacro("Missing VIEW().");
return;
}
view->GetDeliveryManager()->SetImageDataProducer(repr, producer);
view->GetDeliveryManager()->SetOrderedCompositingInformation(
repr, translator, whole_extents, origin, spacing);
}
//----------------------------------------------------------------------------
......
......@@ -30,6 +30,7 @@
class vtkAlgorithmOutput;
class vtkCamera;
class vtkCameraManipulator;
class vtkExtentTranslator;
class vtkInformationDoubleKey;
class vtkInformationDoubleVectorKey;
class vtkInformationIntegerKey;
......@@ -41,6 +42,7 @@ class vtkMatrix4x4;
class vtkProp;
class vtkPVAxesWidget;
class vtkPVCenterAxesActor;
class vtkPVDataDeliveryManager;
class vtkPVDataRepresentation;
class vtkPVGenericRenderWindowInteractor;
class vtkPVHardwareSelector;
......@@ -49,7 +51,6 @@ class vtkPVSynchronizedRenderer;
class vtkRenderer;
class vtkRenderViewBase;
class vtkRenderWindow;
class vtkPVDataDeliveryManager;
class vtkTexture;
class VTKPVCLIENTSERVERCORERENDERING_EXPORT vtkPVRenderView : public vtkPVView
......@@ -332,10 +333,12 @@ public:
vtkInformation* info, vtkPVDataRepresentation* repr);
// Description:
// Hack to pass along image data producer to use to generate the KdTree cuts
// when volume rendering image data. This code needs refactoring.
static void SetImageDataProducer(
vtkInformation* info, vtkPVDataRepresentation* repr, vtkAlgorithmOutput*);
// Pass the structured-meta-data for determining rendering order for ordered
// compositing.
static void SetOrderedCompositingInformation(
vtkInformation* info, vtkPVDataRepresentation* repr,
vtkExtentTranslator* translator,
const int whole_extents[6], const double origin[3], const double spacing[3]);
// Description:
// Representations that support hardware (render-buffer based) selection,
......
......@@ -31,7 +31,6 @@
set(Module_SRCS
vtkAttributeDataToTableFilter.cxx
vtkBlockDeliveryPreprocessor.cxx
vtkBSPCutsGenerator.cxx
vtkCameraInterpolator2.cxx
vtkCameraManipulator.cxx
vtkCameraManipulatorGUIHelper.cxx
......
/*=========================================================================
Program: ParaView
Module: $RCSfile$
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkBSPCutsGenerator.h"
#include "vtkAlgorithmOutput.h"
#include "vtkBSPCuts.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkKdTreeManager.h"
#include "vtkMultiProcessController.h"
#include "vtkObjectFactory.h"
#include "vtkPKdTree.h"
vtkStandardNewMacro(vtkBSPCutsGenerator);
//----------------------------------------------------------------------------
vtkBSPCutsGenerator::vtkBSPCutsGenerator()
{
this->Enabled = true;
this->PKdTree = 0;
}
//----------------------------------------------------------------------------
vtkBSPCutsGenerator::~vtkBSPCutsGenerator()
{
this->SetPKdTree(0);
}
//----------------------------------------------------------------------------
int vtkBSPCutsGenerator::RequestDataObject(
vtkInformation*, vtkInformationVector**,
vtkInformationVector* outputVector)
{
vtkBSPCuts* output = vtkBSPCuts::GetData(outputVector, 0);
if (!output)
{
output = vtkBSPCuts::New();
outputVector->GetInformationObject(0)->Set(vtkDataObject::DATA_OBJECT(),
output);
outputVector->GetInformationObject(0)->Set(
vtkDataObject::DATA_EXTENT_TYPE(),
output->GetExtentType());
output->FastDelete();
}
return 1;
}
//-----------------------------------------------------------------------------
int vtkBSPCutsGenerator::FillInputPortInformation(
int port, vtkInformation *info)
{
if (!this->Superclass::FillInputPortInformation(port, info))
{
return 0;
}
info->Set(vtkAlgorithm::INPUT_IS_OPTIONAL(), 1);
info->Set(vtkAlgorithm::INPUT_IS_REPEATABLE(), 1);
return 1;
}
//----------------------------------------------------------------------------
int vtkBSPCutsGenerator::RequestData(vtkInformation *,
vtkInformationVector **inputVector, vtkInformationVector *outputVector)
{
vtkMultiProcessController* controller =
vtkMultiProcessController::GetGlobalController();
if (this->Enabled && controller && controller->GetNumberOfProcesses() > 1)
{
vtkKdTreeManager* mgr = vtkKdTreeManager::New();
vtkBSPCuts* output = vtkBSPCuts::GetData(outputVector, 0);
for (int cc=0; cc < inputVector[0]->GetNumberOfInformationObjects(); cc++)
{
vtkDataObject* input = vtkDataObject::GetData(inputVector[0], cc);
//vtkDataObject* clone = input->NewInstance();
//clone->ShallowCopy(input);
if (input->GetExtentType() == VTK_3D_EXTENT)
{
mgr->SetStructuredProducer(this->GetInputAlgorithm(0, cc));
}
else
{
mgr->AddProducer(this->GetInputAlgorithm(0, cc));
}
//clone->FastDelete();
}
mgr->Update();
output->ShallowCopy(mgr->GetKdTree()->GetCuts());
this->SetPKdTree(mgr->GetKdTree());
mgr->RemoveAllProducers();
mgr->SetStructuredProducer(NULL);
mgr->Delete();
}
return 1;
}
//----------------------------------------------------------------------------
void vtkBSPCutsGenerator::SetPKdTree(vtkPKdTree* tree)
{
if (this->PKdTree)
{
this->PKdTree->UnRegister(this);
}
this->PKdTree = tree;
if (tree)
{
tree->Register(this);
}
}
//----------------------------------------------------------------------------
void vtkBSPCutsGenerator::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
}
/*=========================================================================
Program: ParaView
Module: $RCSfile$
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkBSPCutsGenerator
// .SECTION Description
//
#ifndef __vtkBSPCutsGenerator_h
#define __vtkBSPCutsGenerator_h
#include "vtkDataObjectAlgorithm.h"
#include "vtkPVVTKExtensionsRenderingModule.h" // needed for export macro
class vtkPKdTree;
class VTKPVVTKEXTENSIONSRENDERING_EXPORT vtkBSPCutsGenerator : public vtkDataObjectAlgorithm
{
public:
static vtkBSPCutsGenerator* New();
vtkTypeMacro(vtkBSPCutsGenerator, vtkDataObjectAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
// Enable/Disable generation of the cuts.
vtkSetMacro(Enabled, bool);
vtkGetMacro(Enabled, bool);
// This is only valid after Update().
vtkGetObjectMacro(PKdTree, vtkPKdTree);
//BTX
protected:
vtkBSPCutsGenerator();
~vtkBSPCutsGenerator();
int FillInputPortInformation(int port, vtkInformation *info);
int RequestDataObject(vtkInformation *,
vtkInformationVector **, vtkInformationVector *);
int RequestData(vtkInformation *,
vtkInformationVector **, vtkInformationVector *);
void SetPKdTree(vtkPKdTree*);
vtkPKdTree* PKdTree;
bool Enabled;
private:
vtkBSPCutsGenerator(const vtkBSPCutsGenerator&); // Not implemented
void operator=(const vtkBSPCutsGenerator&); // Not implemented
//ETX
};
#endif
......@@ -39,6 +39,8 @@ vtkKdTreeGenerator::vtkKdTreeGenerator()
this->NumberOfPieces =1;
this->WholeExtent[0] = this->WholeExtent[2] = this->WholeExtent[4] = 0;
this->WholeExtent[1] = this->WholeExtent[3] = this->WholeExtent[5] = 1;
this->Origin[0] = this->Origin[1] = this->Origin[2] = 0.0;
this->Spacing[0] = this->Spacing[1] = this->Spacing[2] = 1.0;
this->ExtentTranslator = 0;
this->Regions = 0;
this->KdTree = 0;
......@@ -69,31 +71,34 @@ void vtkKdTreeGeneratorOrder(int* &ptr, vtkKdNode* node)
}
//-----------------------------------------------------------------------------
int vtkKdTreeGenerator::BuildTree(vtkDataObject* data, vtkInformation* info)
bool vtkKdTreeGenerator::BuildTree(vtkExtentTranslator* translator,
const int extents[6], const double origin[3], const double spacing[3])
{
if (!data)
if (!translator)
{
vtkErrorMacro("Cannot generate k-d tree without any data.");
return 0;
vtkErrorMacro("Cannot generate k-d tree without any ExtentTranslator.");
return false;
}
// We need the extent translator and the whole extents from the data.
vtkStreamingDemandDrivenPipeline* sddp =
vtkStreamingDemandDrivenPipeline::SafeDownCast(
vtkExecutive::PRODUCER()->GetExecutive(info));
if (sddp)
if (extents[0] > extents[1] ||
extents[2] > extents[3] ||
extents[4] > extents[5])
{
this->SetExtentTranslator(sddp->GetExtentTranslator(info));
int wholeExtent[6];
sddp->GetWholeExtent(info, wholeExtent);
this->SetWholeExtent(wholeExtent);
vtkErrorMacro("Invalid extents. Cannot generate KdTree.");
return false;
}
else
if (spacing[0] < 0 || spacing[1] < 0 || spacing[2] < 0)
{
vtkErrorMacro("Data must be obtained from pipeline so that "
" extent translator is available.");
return 0;
vtkErrorMacro("Invalid spacing. Cannot generate KdTree.");
return false;
}
this->SetExtentTranslator(translator);
this->SetWholeExtent(const_cast<int*>(extents));
this->SetOrigin(const_cast<double*>(origin));
this->SetSpacing(const_cast<double*>(spacing));
vtkSmartPointer<vtkKdNode> root = vtkSmartPointer<vtkKdNode>::New();
root->DeleteChildNodes();
root->SetBounds(this->WholeExtent[0], this->WholeExtent[1],
......@@ -113,7 +118,7 @@ int vtkKdTreeGenerator::BuildTree(vtkDataObject* data, vtkInformation* info)
}
// The formed tree is based on extents, we convert it to bounds.
if (!this->ConvertToBounds(data, root))
if (!this->ConvertToBounds(root))
{
return 0;
}
......@@ -353,24 +358,9 @@ static bool vtkConvertToBoundsInternal(
}
//-----------------------------------------------------------------------------
bool vtkKdTreeGenerator::ConvertToBounds(vtkDataObject* data, vtkKdNode* node)
bool vtkKdTreeGenerator::ConvertToBounds(vtkKdNode* node)
{
double origin[3];
double spacing[3];
vtkImageData* id = vtkImageData::SafeDownCast(data);
if (data)
{
id->GetOrigin(origin);
id->GetSpacing(spacing);
}
else
{
vtkErrorMacro(<< data->GetClassName() << " is not supported.");
return false;
}
return vtkConvertToBoundsInternal(node, origin, spacing);
return vtkConvertToBoundsInternal(node, this->Origin, this->Spacing);
}
//-----------------------------------------------------------------------------
......
......@@ -12,13 +12,15 @@
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkKdTreeGenerator - given a KdTree paritition, this class
// .NAME vtkKdTreeGenerator - creates a vtkPKdTree using the partitioning
// information provided by a vtkExtentTranslator.
// generates the KdTree
// .SECTION Description
// vtkKdTreeGenerator is used to generate a KdTree using the parititioning
// information available in an input data object. This class uses the
// extent translator from the producer of the data to determine the paritioning
// of the structured data among several processes.
// vtkKdTreeGenerator is used to generate a KdTree using the partitioning
// information garnered from a vtkExtentTranslator (or subclass). Since we need
// spatial bounds for the KdTree, we assume that structured data corresponding
// to the vtkExtentTranslator is an ImageData with the provided spacing and
// origin.
// The algorithm used can be summarized as under:
// \li Inputs: * Extent Translator, * Number of Pieces
// \li Determine the bounds for every piece/region using the extent translator.
......@@ -63,14 +65,16 @@ public:
void SetKdTree(vtkPKdTree*);
vtkGetObjectMacro(KdTree, vtkPKdTree);
// Description:
// Builds the KdTree using the partitioning of the data.
int BuildTree(vtkDataObject* data, vtkInformation* info);
// Description:
// Get/Set the number of pieces.
vtkSetMacro(NumberOfPieces, int);
vtkGetMacro(NumberOfPieces, int);
// Description:
// Builds the KdTree using the partitioning of the data.
bool BuildTree(vtkExtentTranslator* translator, const int extents[6],
const double origin[3], const double spacing[4]);
protected:
vtkKdTreeGenerator();
~vtkKdTreeGenerator();
......@@ -85,6 +89,10 @@ protected:
vtkSetVector6Macro(WholeExtent, int);
vtkGetVector6Macro(WholeExtent, int);
// Description:
vtkSetVector3Macro(Origin, double);
vtkSetVector3Macro(Spacing, double);
// Description:
// Obtains information from the extent translator about the partitioning of
// the input dataset among processes.
......@@ -96,10 +104,14 @@ protected:
vtkKdTreeGeneratorVector& left, vtkKdTreeGeneratorVector& right);
// Converts extents to bounds in the kdtree.
bool ConvertToBounds(vtkDataObject* data, vtkKdNode* node);
bool ConvertToBounds(vtkKdNode* node);
vtkPKdTree* KdTree;
vtkExtentTranslator* ExtentTranslator;
double Origin[3];
double Spacing[3];
int WholeExtent[6];
int NumberOfPieces;
......
......@@ -14,32 +14,27 @@
=========================================================================*/
#include "vtkKdTreeManager.h"
#include "vtkAlgorithm.h"
#include "vtkCellType.h"
#include "vtkCommunicator.h"
#include "vtkBoundingBox.h"
#include "vtkCompositeDataIterator.h"
#include "vtkCompositeDataSet.h"
#include "vtkExtentTranslator.h"
#include "vtkKdTreeGenerator.h"
#include "vtkMultiProcessController.h"
#include "vtkNew.h"
#include "vtkObjectFactory.h"
#include "vtkOutlineSource.h"
#include "vtkPKdTree.h"
#include "vtkPVUpdateSuppressor.h"
#include "vtkPoints.h"
#include "vtkSmartPointer.h"
#include "vtkSphereSource.h"
#include "vtkUnstructuredGrid.h"
#define VTK_CREATE(type, name) \
vtkSmartPointer<type> name = vtkSmartPointer<type>::New()
#include <set>
#include <vector>
class vtkKdTreeManager::vtkAlgorithmSet :
public std::set<vtkSmartPointer<vtkAlgorithm> > {};
class vtkKdTreeManager::vtkDataObjectSet :
public std::set<vtkSmartPointer<vtkDataObject> > {};
vtkStandardNewMacro(vtkKdTreeManager);
vtkCxxSetObjectMacro(vtkKdTreeManager, StructuredProducer, vtkAlgorithm);
//----------------------------------------------------------------------------
vtkKdTreeManager::vtkKdTreeManager()
{
......@@ -49,8 +44,7 @@ vtkKdTreeManager::vtkKdTreeManager()
{
vtkWarningMacro("No global controller");
}
this->Producers = new vtkAlgorithmSet();
this->StructuredProducer = 0;
this->DataObjects = new vtkDataObjectSet();
this->KdTree = 0;
this->NumberOfPieces = globalController?
globalController->GetNumberOfProcesses() : 1;
......@@ -62,51 +56,32 @@ vtkKdTreeManager::vtkKdTreeManager()
tree->SetNumberOfRegionsOrMore(this->NumberOfPieces);
this->SetKdTree(tree);
tree->FastDelete();
this->Origin[0] = this->Origin[1] = this->Origin[2] = 0.0;
this->Spacing[0] = this->Spacing[1] = this->Spacing[2] = 1.0;
this->WholeExtent[0] = this->WholeExtent[2] = this->WholeExtent[4] = 0;
this->WholeExtent[1] = this->WholeExtent[3] = this->WholeExtent[5] = 1;
}
//----------------------------------------------------------------------------
vtkKdTreeManager::~vtkKdTreeManager()
{
this->SetKdTree(0);
this->SetStructuredProducer(0);
delete this->Producers;
delete this->DataObjects;
}
//----------------------------------------------------------------------------
void vtkKdTreeManager::AddProducer(vtkAlgorithm* producer)
void vtkKdTreeManager::AddDataObject(vtkDataObject* dataObject)
{
this->Producers->insert(producer);
if (this->KdTree)
{
this->KdTree->RemoveAllDataSets();
}
this->DataObjects->insert(dataObject);
this->Modified();
}
//----------------------------------------------------------------------------
void vtkKdTreeManager::RemoveProducer(vtkAlgorithm* producer)
{
vtkAlgorithmSet::iterator