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;
32 class VTKPVVTKEXTENSIONSMISC_EXPORT vtkReductionFilter : public vtkDataObjectAlgorithm
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
44  } ReductionModeType;
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
vtkObjectBase::operator=
void operator=(const vtkObjectBase &)
vtkAlgorithm
vtkInformationVector
vtkReductionFilter::PreGatherHelper
vtkAlgorithm * PreGatherHelper
Definition: vtkReductionFilter.h:148
vtkDataObjectAlgorithm
vtkSmartPointer< vtkDataObject >
vtkReductionFilter::PostGatherHelper
vtkAlgorithm * PostGatherHelper
Definition: vtkReductionFilter.h:149
vtkReductionFilter::ReductionMode
int ReductionMode
Definition: vtkReductionFilter.h:153
vtkSelection
vtkReductionFilter::GenerateProcessIds
int GenerateProcessIds
Definition: vtkReductionFilter.h:152
vtkDataObjectAlgorithm::FillInputPortInformation
virtual int FillInputPortInformation(int port, vtkInformation *info)
vtkDataObjectAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
vtkReductionFilter::REDUCE_ALL_TO_ALL
@ REDUCE_ALL_TO_ALL
Definition: vtkReductionFilter.h:43
vtkReductionFilter::Tags
Tags
Definition: vtkReductionFilter.h:117
vtkReductionFilter::ReductionProcessId
int ReductionProcessId
Definition: vtkReductionFilter.h:154
vtkMultiProcessController
vtkIndent
vtkSmartPointer.h
vtkReductionFilter::PassThrough
int PassThrough
Definition: vtkReductionFilter.h:151
vtkInformation
vtkReductionFilter::ReductionModeType
ReductionModeType
Definition: vtkReductionFilter.h:39
vtkDataObjectAlgorithm::New
static vtkDataObjectAlgorithm * New()
vtkReductionFilter
A generic filter that can reduce any type of dataset using any reduction algorithm.
Definition: vtkReductionFilter.h:32
vtkReductionFilter::REDUCE_ALL_TO_ONE
@ REDUCE_ALL_TO_ONE
Definition: vtkReductionFilter.h:41
vtkDataObjectAlgorithm::RequestData
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
vtkReductionFilter::Controller
vtkMultiProcessController * Controller
Definition: vtkReductionFilter.h:150
vtkDataObjectAlgorithm.h
vtkDataObjectAlgorithm::RequestDataObject
virtual int RequestDataObject(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
vtkDataObject