1 // Copyright (C) 2014-2022 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // Author : Maxim Glibin
21 #ifndef __DifferenceTimestepsFilter_h_
22 #define __DifferenceTimestepsFilter_h_
24 #include <vtkMultiTimeStepAlgorithm.h>
32 * Description of class:
33 * Class allows to compute difference between two time steps of one data array (field).
35 class VTK_EXPORT vtkDifferenceTimestepsFilter : public vtkMultiTimeStepAlgorithm
38 /// Returns pointer on a new instance of the class
39 static vtkDifferenceTimestepsFilter* New();
41 vtkTypeMacro(vtkDifferenceTimestepsFilter, vtkMultiTimeStepAlgorithm)
43 /// Prints current state of the objects
44 void PrintSelf(ostream&, vtkIndent) override;
47 // Set/Get methods for first time step.
48 vtkSetMacro(FirstTimeStepIndex, int);
49 vtkGetMacro(FirstTimeStepIndex, int);
52 // Set/Get methods for first time step.
53 vtkSetMacro(SecondTimeStepIndex, int);
54 vtkGetMacro(SecondTimeStepIndex, int);
57 // Get methods for range of indices of time steps.
58 vtkGetVector2Macro(RangeIndicesTimeSteps, int);
61 // Set/Get methods for prefix of array name.
62 vtkSetStringMacro(ArrayNamePrefix);
63 vtkGetStringMacro(ArrayNamePrefix);
66 /// Constructor & destructor
67 vtkDifferenceTimestepsFilter();
68 ~vtkDifferenceTimestepsFilter() override;
70 /// The methods which is called on filtering data
71 int FillInputPortInformation(int, vtkInformation*) override;
73 int FillOutputPortInformation(int, vtkInformation*) override;
75 int RequestDataObject(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
77 int RequestInformation(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
79 int RequestUpdateExtent(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
81 //int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
84 // General computation differences routine for any type on input data. This
85 // is called recursively when heirarchical/multiblock data is encountered.
86 vtkDataObject* DifferenceDataObject(vtkDataObject* theInput1, vtkDataObject* theInput2);
89 // Root level interpolation for a concrete dataset object.
90 // Point/Cell data and points are different.
91 // Needs improving if connectivity is to be handled.
92 virtual vtkDataSet* DifferenceDataSet(vtkDataSet* theInput1, vtkDataSet* theInput2);
95 // Compute difference a single vtkDataArray. Called from computation
96 // of the difference routine on pointdata or celldata.
97 virtual vtkDataArray* DifferenceDataArray(vtkDataArray** theArrays, vtkIdType theN);
100 // Range of indices of the time steps.
101 int RangeIndicesTimeSteps[2];
104 // First time step index.
105 int FirstTimeStepIndex;
108 // Second time step index.
109 int SecondTimeStepIndex;
112 // Length of time steps array
116 // Array of time step values.
117 std::vector<double> TimeStepValues;
120 // Prefix of array name.
121 char* ArrayNamePrefix;
124 vtkDifferenceTimestepsFilter(const vtkDifferenceTimestepsFilter&) = delete;
125 void operator=(const vtkDifferenceTimestepsFilter&) = delete;
128 // Get field association type.
129 int GetInputFieldAssociation();
132 // Called just before computation of the difference of the dataset to ensure that
133 // each data array has the same array name, number of tuples or components and etc.
134 bool VerifyArrays(vtkDataArray** theArrays, int theNumArrays);
137 #endif // __DifferenceTimestepsFilter_h_