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 "vtkPVVTKExtensionsMiscModule.h" // needed for export macro
38 #include "vtkSmartPointer.h" // needed for vtkSmartPointer.
39 #include <vector> // needed for std::vector
40 
42 class vtkSelection;
44 {
45 public:
46  static vtkReductionFilter* New();
48  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
50  typedef enum ReductionModeType
51  {
52  REDUCE_ALL_TO_ONE = 0,
53  MOVE_ALL_TO_ONE = 1,
54  REDUCE_ALL_TO_ALL = 2
56 
58 
65  vtkSetClampMacro(ReductionMode, int, vtkReductionFilter::REDUCE_ALL_TO_ONE,
67  vtkGetMacro(ReductionMode, int);
69 
71 
75  vtkSetMacro(ReductionProcessId, int);
76  vtkGetMacro(ReductionProcessId, int);
78 
80 
84  void SetPreGatherHelper(vtkAlgorithm*);
85  void SetPreGatherHelperName(const char*);
86  vtkGetObjectMacro(PreGatherHelper, vtkAlgorithm);
88 
90 
96  void SetPostGatherHelper(vtkAlgorithm*);
97  void SetPostGatherHelperName(const char*);
98  vtkGetObjectMacro(PostGatherHelper, vtkAlgorithm);
100 
104  void SetController(vtkMultiProcessController*);
105 
107 
113  vtkSetMacro(PassThrough, int);
114  vtkGetMacro(PassThrough, int);
116 
118 
124  vtkSetMacro(GenerateProcessIds, int);
125  vtkGetMacro(GenerateProcessIds, int);
127 
128  enum Tags
129  {
130  TRANSMIT_DATA_OBJECT = 23484
131  };
132 
133 protected:
135  ~vtkReductionFilter() override;
136 
137  // Overridden to mark input as optional, since input data may
138  // not be available on all processes that this filter is instantiated.
139  int FillInputPortInformation(int port, vtkInformation* info) override;
140 
141  int RequestDataObject(vtkInformation* request, vtkInformationVector** inputVector,
142  vtkInformationVector* outputVector) override;
143  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
144  vtkInformationVector* outputVector) override;
145 
146  void Reduce(vtkDataObject* input, vtkDataObject* output);
147  vtkDataObject* PreProcess(vtkDataObject* input);
148  void PostProcess(
149  vtkDataObject* output, vtkSmartPointer<vtkDataObject> inputs[], unsigned int num_inputs);
150 
156  int GatherSelection(vtkSelection* sendData,
157  std::vector<vtkSmartPointer<vtkDataObject>>& receiveData, int destProcessId);
158 
166 
167 private:
168  vtkReductionFilter(const vtkReductionFilter&) = delete;
169  void operator=(const vtkReductionFilter&) = delete;
170 };
171 
172 #endif
virtual int RequestDataObject(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
static vtkDataObjectAlgorithm * New()
vtkMultiProcessController * Controller
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
#define VTKPVVTKEXTENSIONSMISC_EXPORT
virtual int FillInputPortInformation(int port, vtkInformation *info)
vtkAlgorithm * PreGatherHelper
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
vtkAlgorithm * PostGatherHelper
void operator=(const vtkObjectBase &)
A generic filter that can reduce any type of dataset using any reduction algorithm.