vtkReductionFilter.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
3 // SPDX-License-Identifier: BSD-3-Clause
22 #ifndef vtkReductionFilter_h
23 #define vtkReductionFilter_h
24 
25 #include "vtkDataObjectAlgorithm.h"
26 #include "vtkPVVTKExtensionsMiscModule.h" // needed for export macro
27 #include "vtkSmartPointer.h" // needed for vtkSmartPointer.
28 #include <vector> // needed for std::vector
29 
31 class vtkSelection;
33 {
34 public:
35  static vtkReductionFilter* New();
37  void PrintSelf(ostream& os, vtkIndent indent) override;
38 
39  typedef enum ReductionModeType
40  {
41  REDUCE_ALL_TO_ONE = 0,
42  MOVE_ALL_TO_ONE = 1,
43  REDUCE_ALL_TO_ALL = 2
45 
47 
54  vtkSetClampMacro(ReductionMode, int, vtkReductionFilter::REDUCE_ALL_TO_ONE,
56  vtkGetMacro(ReductionMode, int);
58 
60 
64  vtkSetMacro(ReductionProcessId, int);
65  vtkGetMacro(ReductionProcessId, int);
67 
69 
73  void SetPreGatherHelper(vtkAlgorithm*);
74  void SetPreGatherHelperName(const char*);
75  vtkGetObjectMacro(PreGatherHelper, vtkAlgorithm);
77 
79 
85  void SetPostGatherHelper(vtkAlgorithm*);
86  void SetPostGatherHelperName(const char*);
87  vtkGetObjectMacro(PostGatherHelper, vtkAlgorithm);
89 
93  void SetController(vtkMultiProcessController*);
94 
96 
102  vtkSetMacro(PassThrough, int);
103  vtkGetMacro(PassThrough, int);
105 
107 
113  vtkSetMacro(GenerateProcessIds, int);
114  vtkGetMacro(GenerateProcessIds, int);
116 
117  enum Tags
118  {
119  TRANSMIT_DATA_OBJECT = 23484
120  };
121 
122 protected:
124  ~vtkReductionFilter() override;
125 
126  // Overridden to mark input as optional, since input data may
127  // not be available on all processes that this filter is instantiated.
128  int FillInputPortInformation(int port, vtkInformation* info) override;
129 
130  int RequestDataObject(vtkInformation* request, vtkInformationVector** inputVector,
131  vtkInformationVector* outputVector) override;
132  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
133  vtkInformationVector* outputVector) override;
134 
135  void Reduce(vtkDataObject* input, vtkDataObject* output);
136  vtkDataObject* PreProcess(vtkDataObject* input);
137  void PostProcess(
138  vtkDataObject* output, vtkSmartPointer<vtkDataObject> inputs[], unsigned int num_inputs);
139 
145  int GatherSelection(vtkSelection* sendData,
146  std::vector<vtkSmartPointer<vtkDataObject>>& receiveData, int destProcessId);
147 
155 
156 private:
157  vtkReductionFilter(const vtkReductionFilter&) = delete;
158  void operator=(const vtkReductionFilter&) = delete;
159 };
160 
161 #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.