1 /*========================================================================= 2 3 Program: Visualization Toolkit 4 Module: vtkTemporalArrayOperatorFilter.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 =========================================================================*/ 15 /** 16 * @class vtkTemporalArrayOperatorFilter 17 * @brief perform simple mathematical operation on a data array at different time 18 * 19 * This filter computes a simple operation between two time steps of one 20 * data array. 21 * 22 * @sa 23 * vtkArrayCalulator 24 */ 25 26 #ifndef vtkTemporalArrayOperatorFilter_h 27 #define vtkTemporalArrayOperatorFilter_h 28 29 #include "vtkFiltersHybridModule.h" // For export macro 30 #include "vtkMultiTimeStepAlgorithm.h" 31 32 class VTKFILTERSHYBRID_EXPORT vtkTemporalArrayOperatorFilter : public vtkMultiTimeStepAlgorithm 33 { 34 public: 35 static vtkTemporalArrayOperatorFilter* New(); 36 vtkTypeMacro(vtkTemporalArrayOperatorFilter, vtkMultiTimeStepAlgorithm); 37 void PrintSelf(ostream& os, vtkIndent indent) override; 38 39 enum OperatorType 40 { 41 ADD = 0, 42 SUB = 1, 43 MUL = 2, 44 DIV = 3 45 }; 46 47 ///@{ 48 /** 49 * @brief Set/Get the operator to apply. Default is ADD (0). 50 */ 51 vtkSetMacro(Operator, int); 52 vtkGetMacro(Operator, int); 53 ///@} 54 55 ///@{ 56 /** 57 * @brief Set/Get the first time step. 58 */ 59 vtkSetMacro(FirstTimeStepIndex, int); 60 vtkGetMacro(FirstTimeStepIndex, int); 61 ///@} 62 63 ///@{ 64 /** 65 * @brief Set/Get the second time step. 66 */ 67 vtkSetMacro(SecondTimeStepIndex, int); 68 vtkGetMacro(SecondTimeStepIndex, int); 69 ///@} 70 71 ///@{ 72 /** 73 * @brief Set/Get the suffix to be append to the output array name. 74 * If not specified, output will be suffixed with '_' and the operation 75 * type (eg. myarrayname_add). 76 */ 77 vtkSetStringMacro(OutputArrayNameSuffix); 78 vtkGetStringMacro(OutputArrayNameSuffix); 79 ///@} 80 81 protected: 82 vtkTemporalArrayOperatorFilter(); 83 ~vtkTemporalArrayOperatorFilter() override; 84 85 int FillInputPortInformation(int, vtkInformation*) override; 86 int FillOutputPortInformation(int, vtkInformation*) override; 87 88 int RequestDataObject(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override; 89 int RequestInformation(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override; 90 int RequestUpdateExtent(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override; 91 int Execute(vtkInformation* request, const std::vector<vtkSmartPointer<vtkDataObject>>& inputs, 92 vtkInformationVector* outputVector) override; 93 94 int GetInputArrayAssociation(); 95 virtual vtkDataObject* Process(vtkDataObject*, vtkDataObject*); 96 virtual vtkDataObject* ProcessDataObject(vtkDataObject*, vtkDataObject*); 97 virtual vtkDataArray* ProcessDataArray(vtkDataArray*, vtkDataArray*); 98 99 int Operator; 100 int FirstTimeStepIndex; 101 int SecondTimeStepIndex; 102 int NumberTimeSteps; 103 char* OutputArrayNameSuffix; 104 105 private: 106 vtkTemporalArrayOperatorFilter(const vtkTemporalArrayOperatorFilter&) = delete; 107 void operator=(const vtkTemporalArrayOperatorFilter&) = delete; 108 }; 109 110 #endif 111