ParaView
vtkReductionFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkReductionFilter.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
33 #ifndef vtkReductionFilter_h
34 #define vtkReductionFilter_h
35 
36 #include "vtkDataObjectAlgorithm.h"
37 #include "vtkPVVTKExtensionsRenderingModule.h" // needed for export macro
38 #include "vtkSmartPointer.h" // needed for vtkSmartPointer.
39 #include <vector> // needed for std::vector
40 
41 class vtkMultiProcessController;
42 class vtkSelection;
43 class VTKPVVTKEXTENSIONSRENDERING_EXPORT vtkReductionFilter : public vtkDataObjectAlgorithm
44 {
45 public:
46  static vtkReductionFilter* New();
47  vtkTypeMacro(vtkReductionFilter, vtkDataObjectAlgorithm);
48  void PrintSelf(ostream& os, vtkIndent indent);
49 
51 
55  void SetPreGatherHelper(vtkAlgorithm*);
56  void SetPreGatherHelperName(const char*);
57  vtkGetObjectMacro(PreGatherHelper, vtkAlgorithm);
59 
61 
67  void SetPostGatherHelper(vtkAlgorithm*);
68  void SetPostGatherHelperName(const char*);
69  vtkGetObjectMacro(PostGatherHelper, vtkAlgorithm);
71 
75  void SetController(vtkMultiProcessController*);
76 
78 
84  vtkSetMacro(PassThrough, int);
85  vtkGetMacro(PassThrough, int);
87 
89 
95  vtkSetMacro(GenerateProcessIds, int);
96  vtkGetMacro(GenerateProcessIds, int);
98 
99  enum Tags
100  {
101  TRANSMIT_DATA_OBJECT = 23484
102  };
103 
104 protected:
107 
108  // Overridden to mark input as optional, since input data may
109  // not be available on all processes that this filter is instantiated.
110  virtual int FillInputPortInformation(int port, vtkInformation* info);
111 
112  virtual int RequestDataObject(vtkInformation* request, vtkInformationVector** inputVector,
113  vtkInformationVector* outputVector);
114  virtual int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
115  vtkInformationVector* outputVector);
116 
117  void Reduce(vtkDataObject* input, vtkDataObject* output);
118  vtkDataObject* PreProcess(vtkDataObject* input);
119  void PostProcess(
120  vtkDataObject* output, vtkSmartPointer<vtkDataObject> inputs[], unsigned int num_inputs);
121 
127  int GatherSelection(vtkSelection* sendData,
128  std::vector<vtkSmartPointer<vtkDataObject> >& receiveData, int destProcessId);
129 
130  vtkAlgorithm* PreGatherHelper;
131  vtkAlgorithm* PostGatherHelper;
132  vtkMultiProcessController* Controller;
135 
136 private:
137  vtkReductionFilter(const vtkReductionFilter&) VTK_DELETE_FUNCTION;
138  void operator=(const vtkReductionFilter&) VTK_DELETE_FUNCTION;
139 };
140 
141 #endif
vtkMultiProcessController * Controller
vtkAlgorithm * PreGatherHelper
vtkAlgorithm * PostGatherHelper
A generic filter that can reduce any type of dataset using any reduction algorithm.