Loading [MathJax]/extensions/tex2jax.js
VTK  9.4.20250402
vtkExtractTimeSteps.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
26#ifndef vtkExtractTimeSteps_h
27#define vtkExtractTimeSteps_h
28
29#include "vtkFiltersExtractionModule.h" // for export macro
31
32#include <set> // for time step indices
33
34VTK_ABI_NAMESPACE_BEGIN
35class VTKFILTERSEXTRACTION_EXPORT vtkExtractTimeSteps : public vtkPassInputTypeAlgorithm
36{
37public:
39 void PrintSelf(ostream& os, vtkIndent indent) override;
40
42
46 int GetNumberOfTimeSteps() const { return static_cast<int>(this->TimeStepIndices.size()); }
47
51 void AddTimeStepIndex(int timeStepIndex);
52
54
58 void SetTimeStepIndices(int count, const int* timeStepIndices);
59 void GetTimeStepIndices(int* timeStepIndices) const;
61
65 void GenerateTimeStepIndices(int begin, int end, int step);
66
68
72 {
73 this->TimeStepIndices.clear();
74 this->Modified();
75 }
77
79
83 vtkGetMacro(UseRange, bool);
84 vtkSetMacro(UseRange, bool);
85 vtkBooleanMacro(UseRange, bool);
87
89
92 vtkGetVector2Macro(Range, int);
93 vtkSetVector2Macro(Range, int);
95
97
101 vtkGetMacro(TimeStepInterval, int);
102 vtkSetClampMacro(TimeStepInterval, int, 1, VTK_INT_MAX);
104
105 // What timestep to provide when the requested time is between the timesteps
106 // the filter is set to extract
107 enum
108 {
109 PREVIOUS_TIMESTEP, // floor the time to the previous timestep
110 NEXT_TIMESTEP, // ceiling the time to the next timestep
111 NEAREST_TIMESTEP // take the timestep whose absolute difference from the requested time is
112 // smallest
113 } EstimationMode;
115
120 vtkGetMacro(TimeEstimationMode, int);
121 vtkSetMacro(TimeEstimationMode, int);
122 void SetTimeEstimationModeToPrevious() { this->SetTimeEstimationMode(PREVIOUS_TIMESTEP); }
123 void SetTimeEstimationModeToNext() { this->SetTimeEstimationMode(NEXT_TIMESTEP); }
124 void SetTimeEstimationModeToNearest() { this->SetTimeEstimationMode(NEAREST_TIMESTEP); }
126
127protected:
129 ~vtkExtractTimeSteps() override = default;
130
134
135 std::set<int> TimeStepIndices;
137 int Range[2];
140
141private:
143 void operator=(const vtkExtractTimeSteps&) = delete;
144};
145
146VTK_ABI_NAMESPACE_END
147#endif // vtkExtractTimeSteps_h
extract specific time-steps from dataset
void SetTimeEstimationModeToNext()
Get/Set what to do when the requested time is not one of the timesteps this filter is set to extract.
void GenerateTimeStepIndices(int begin, int end, int step)
Generate a range of indices in [begin, end) with a step size of 'step'.
static vtkExtractTimeSteps * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
~vtkExtractTimeSteps() override=default
void ClearTimeStepIndices()
Clear the time step indices.
int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called within ProcessRequest when each filter in the pipeline decides what portion of its inp...
int GetNumberOfTimeSteps() const
Get the number of time steps that will be extracted.
std::set< int > TimeStepIndices
void AddTimeStepIndex(int timeStepIndex)
Add a time step index.
void SetTimeEstimationModeToPrevious()
Get/Set what to do when the requested time is not one of the timesteps this filter is set to extract.
void SetTimeEstimationModeToNearest()
Get/Set what to do when the requested time is not one of the timesteps this filter is set to extract.
int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called within ProcessRequest when a request asks for Information.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called within ProcessRequest when a request asks the algorithm to do its work.
void SetTimeStepIndices(int count, const int *timeStepIndices)
Get/Set an array of time step indices.
void GetTimeStepIndices(int *timeStepIndices) const
Get/Set an array of time step indices.
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Superclass for algorithms that produce output of the same type as input.
#define VTK_INT_MAX
Definition vtkType.h:161