1 // Copyright (C) 2014-2019 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 virtual void PrintSelf(ostream &, vtkIndent);
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 virtual ~vtkDifferenceTimestepsFilter();
70 /// The methods which is called on filtering data
71 virtual int FillInputPortInformation(int, vtkInformation *);
73 virtual int FillOutputPortInformation(int, vtkInformation *);
75 virtual int RequestDataObject(vtkInformation *,
76 vtkInformationVector **,
77 vtkInformationVector *);
79 virtual int RequestInformation(vtkInformation *,
80 vtkInformationVector **,
81 vtkInformationVector *);
83 virtual int RequestUpdateExtent(vtkInformation *,
84 vtkInformationVector **,
85 vtkInformationVector *);
87 virtual int RequestData(vtkInformation *,
88 vtkInformationVector **,
89 vtkInformationVector *);
92 // General computation differences routine for any type on input data. This
93 // is called recursively when heirarchical/multiblock data is encountered.
94 vtkDataObject *DifferenceDataObject(vtkDataObject* theInput1,
95 vtkDataObject* theInput2);
98 // Root level interpolation for a concrete dataset object.
99 // Point/Cell data and points are different.
100 // Needs improving if connectivity is to be handled.
101 virtual vtkDataSet *DifferenceDataSet(vtkDataSet* theInput1,
102 vtkDataSet* theInput2);
105 // Compute difference a single vtkDataArray. Called from computation
106 // of the difference routine on pointdata or celldata.
107 virtual vtkDataArray *DifferenceDataArray(vtkDataArray** theArrays,
111 // Range of indices of the time steps.
112 int RangeIndicesTimeSteps[2];
115 // First time step index.
116 int FirstTimeStepIndex;
119 // Second time step index.
120 int SecondTimeStepIndex;
123 // Length of time steps array
127 // Array of time step values.
128 std::vector<double> TimeStepValues;
131 // Prefix of array name.
132 char *ArrayNamePrefix;
135 vtkDifferenceTimestepsFilter(const vtkDifferenceTimestepsFilter &); // Not implemented yet
136 void operator=(const vtkDifferenceTimestepsFilter &); // Not implemented yet
139 // Get field association type.
140 int GetInputFieldAssociation();
143 // Called just before computation of the difference of the dataset to ensure that
144 // each data array has the same array name, number of tuples or components and etc.
145 bool VerifyArrays(vtkDataArray **theArrays, int theNumArrays);
148 #endif // __DifferenceTimestepsFilter_h_