VTK  9.3.0
vtkReduceTable.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
27 #ifndef vtkReduceTable_h
28 #define vtkReduceTable_h
29 
30 #include "vtkInfovisCoreModule.h" // For export macro
31 #include "vtkTableAlgorithm.h"
32 
33 #include <map> // For ivar
34 #include <set> // For ivar
35 #include <vector> // For ivar
36 
37 VTK_ABI_NAMESPACE_BEGIN
38 class vtkVariant;
39 
40 class VTKINFOVISCORE_EXPORT vtkReduceTable : public vtkTableAlgorithm
41 {
42 public:
43  static vtkReduceTable* New();
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
48 
53  vtkGetMacro(IndexColumn, vtkIdType);
54  vtkSetMacro(IndexColumn, vtkIdType);
56 
58 
62  vtkGetMacro(NumericalReductionMethod, int);
63  vtkSetMacro(NumericalReductionMethod, int);
65 
67 
71  vtkGetMacro(NonNumericalReductionMethod, int);
72  vtkSetMacro(NonNumericalReductionMethod, int);
74 
81 
86  void SetReductionMethodForColumn(vtkIdType col, int method);
87 
91  enum
92  {
95  MODE
96  };
97 
98 protected:
100  ~vtkReduceTable() override;
101 
103 
108  void InitializeOutputTable(vtkTable* input, vtkTable* output);
109 
115 
120 
126  void PopulateDataColumn(vtkTable* input, vtkTable* output, vtkIdType col);
127 
132  void ReduceValuesToMean(vtkTable* input, vtkTable* output, vtkIdType row, vtkIdType col,
133  std::vector<vtkIdType> oldRows);
134 
139  void ReduceValuesToMedian(vtkTable* input, vtkTable* output, vtkIdType row, vtkIdType col,
140  std::vector<vtkIdType> oldRows);
141 
146  void ReduceValuesToMode(vtkTable* input, vtkTable* output, vtkIdType row, vtkIdType col,
147  std::vector<vtkIdType> oldRows);
148 
150  std::set<vtkVariant> IndexValues;
151  std::map<vtkVariant, std::vector<vtkIdType>> NewRowToOldRowsMap;
152  std::map<vtkIdType, int> ColumnReductionMethods;
153 
156 
157 private:
158  vtkReduceTable(const vtkReduceTable&) = delete;
159  void operator=(const vtkReduceTable&) = delete;
160 };
161 
162 VTK_ABI_NAMESPACE_END
163 #endif
a simple class to control print indentation
Definition: vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
combine some of the rows of a table
int GetReductionMethodForColumn(vtkIdType col)
Get the method that should be used to combine the values within the specified column.
std::map< vtkIdType, int > ColumnReductionMethods
static vtkReduceTable * New()
int NumericalReductionMethod
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
int NonNumericalReductionMethod
std::map< vtkVariant, std::vector< vtkIdType > > NewRowToOldRowsMap
void AccumulateIndexValues(vtkTable *input)
Find the distinct values in the input table's index column.
void SetReductionMethodForColumn(vtkIdType col, int method)
Set the method that should be used to combine the values within the specified column.
void ReduceValuesToMedian(vtkTable *input, vtkTable *output, vtkIdType row, vtkIdType col, std::vector< vtkIdType > oldRows)
Find the median of a series of values from the input table and store it in the output table.
~vtkReduceTable() override
void ReduceValuesToMean(vtkTable *input, vtkTable *output, vtkIdType row, vtkIdType col, std::vector< vtkIdType > oldRows)
Find the mean of a series of values from the input table and store it in the output table.
void ReduceValuesToMode(vtkTable *input, vtkTable *output, vtkIdType row, vtkIdType col, std::vector< vtkIdType > oldRows)
Find the mode of a series of values from the input table and store it in the output table.
std::set< vtkVariant > IndexValues
void PopulateDataColumn(vtkTable *input, vtkTable *output, vtkIdType col)
Populate a non-index column of the output table.
vtkIdType IndexColumn
void PopulateIndexColumn(vtkTable *output)
Populate the index column of the output table.
void InitializeOutputTable(vtkTable *input, vtkTable *output)
Initialize the output table to have the same types of columns as the input table, but no rows.
Superclass for algorithms that produce only vtkTables as output.
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:59
A type representing the union of many types.
Definition: vtkVariant.h:53
int vtkIdType
Definition: vtkType.h:315