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  REDUCE_ALL_TO_ONE = 0,
52  MOVE_ALL_TO_ONE = 1,
53  REDUCE_ALL_TO_ALL = 2
55 
57 
64  vtkSetClampMacro(ReductionMode, int, vtkReductionFilter::REDUCE_ALL_TO_ONE,
66  vtkGetMacro(ReductionMode, int);
68 
70 
74  vtkSetMacro(ReductionProcessId, int);
75  vtkGetMacro(ReductionProcessId, int);
77 
79 
83  void SetPreGatherHelper(vtkAlgorithm*);
84  void SetPreGatherHelperName(const char*);
85  vtkGetObjectMacro(PreGatherHelper, vtkAlgorithm);
87 
89 
95  void SetPostGatherHelper(vtkAlgorithm*);
96  void SetPostGatherHelperName(const char*);
97  vtkGetObjectMacro(PostGatherHelper, vtkAlgorithm);
99 
103  void SetController(vtkMultiProcessController*);
104 
106 
112  vtkSetMacro(PassThrough, int);
113  vtkGetMacro(PassThrough, int);
115 
117 
123  vtkSetMacro(GenerateProcessIds, int);
124  vtkGetMacro(GenerateProcessIds, int);
126 
127  enum Tags
128  {
129  TRANSMIT_DATA_OBJECT = 23484
130  };
131 
132 protected:
134  ~vtkReductionFilter() override;
135 
136  // Overridden to mark input as optional, since input data may
137  // not be available on all processes that this filter is instantiated.
138  int FillInputPortInformation(int port, vtkInformation* info) override;
139 
140  int RequestDataObject(vtkInformation* request, vtkInformationVector** inputVector,
141  vtkInformationVector* outputVector) override;
142  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
143  vtkInformationVector* outputVector) override;
144 
145  void Reduce(vtkDataObject* input, vtkDataObject* output);
146  vtkDataObject* PreProcess(vtkDataObject* input);
147  void PostProcess(
148  vtkDataObject* output, vtkSmartPointer<vtkDataObject> inputs[], unsigned int num_inputs);
149 
155  int GatherSelection(vtkSelection* sendData,
156  std::vector<vtkSmartPointer<vtkDataObject> >& receiveData, int destProcessId);
157 
165 
166 private:
167  vtkReductionFilter(const vtkReductionFilter&) = delete;
168  void operator=(const vtkReductionFilter&) = delete;
169 };
170 
171 #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.