1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
// SPDX-License-Identifier: BSD-3-Clause
/**
* @class vtkSynchronizeTimeFilter
* @brief Set "close" time step values from the second input to the first
*
* Synchronize time step values in the first input to time step
* values in the second input that are considered close enough.
* The outputted data set is from the first input and the number of
* output time steps is also equal to the number of time steps in
* the first input. Time step values in the first input that are
* "close" to time step values in the second input are replaced
* with the value from the second input. Close is determined to
* be if the difference is less than RelativeTolerance multiplied
* by the time range of the first input.
*/
#ifndef vtkSynchronizeTimeFilter_h
#define vtkSynchronizeTimeFilter_h
#include "vtkFiltersGeneralModule.h" // For export macro
#include "vtkPassInputTypeAlgorithm.h"
#include <vector> // Use of dynamically allocated array
VTK_ABI_NAMESPACE_BEGIN
class VTKFILTERSGENERAL_EXPORT vtkSynchronizeTimeFilter : public vtkPassInputTypeAlgorithm
{
public:
static vtkSynchronizeTimeFilter* New();
vtkTypeMacro(vtkSynchronizeTimeFilter, vtkPassInputTypeAlgorithm);
void PrintSelf(ostream& os, vtkIndent indent) override;
/**
* Specify the input that we may potentially replace time
* steps with. SetInputConnection() should be used for providing the data
* set that will actually be output from this filter.
*/
void SetSourceConnection(vtkAlgorithmOutput* algOutput);
/**
* Set/get the relative tolerance for comparing time step
* values to see if they are close enough to be considered
* identical.
*/
vtkSetClampMacro(RelativeTolerance, double, 0, VTK_DOUBLE_MAX);
vtkGetMacro(RelativeTolerance, double);
protected:
vtkSynchronizeTimeFilter();
~vtkSynchronizeTimeFilter() override;
/**
* Helper methods for getting the input time value or output time
* value given the output time value or input time value, respectively.
*/
double GetInputTimeValue(double outputTimeValue);
double GetOutputTimeValue(double inputTimeValue);
int RequestInformation(vtkInformation* request, vtkInformationVector** inputVector,
vtkInformationVector* outputVector) override;
int RequestUpdateExtent(vtkInformation* request, vtkInformationVector** inputVector,
vtkInformationVector* outputVector) override;
int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*) override;
private:
vtkSynchronizeTimeFilter(const vtkSynchronizeTimeFilter&) = delete;
void operator=(const vtkSynchronizeTimeFilter&) = delete;
/**
* Copies of the time steps for both the input and
* the output values.
*/
std::vector<double> InputTimeStepValues;
std::vector<double> OutputTimeStepValues;
/**
* The relative tolerance for comparing time step values to see if they
* are close enough to be considered identical. The default value is 0.00001
*/
double RelativeTolerance;
};
VTK_ABI_NAMESPACE_END
#endif
|