VTK  9.3.1
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 
34 VTK_ABI_NAMESPACE_BEGIN
35 class VTKFILTERSEXTRACTION_EXPORT vtkExtractTimeSteps : public vtkPassInputTypeAlgorithm
36 {
37 public:
39  void PrintSelf(ostream& os, vtkIndent indent) override;
40 
41  static vtkExtractTimeSteps* New();
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 
127 protected:
129  ~vtkExtractTimeSteps() override = default;
130 
134 
135  std::set<int> TimeStepIndices;
136  bool UseRange;
137  int Range[2];
140 
141 private:
142  vtkExtractTimeSteps(const vtkExtractTimeSteps&) = delete;
143  void operator=(const vtkExtractTimeSteps&) = delete;
144 };
145 
146 VTK_ABI_NAMESPACE_END
147 #endif // vtkExtractTimeSteps_h
extract specific time-steps from dataset
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called within ProcessRequest when a request asks for Information.
Superclass for algorithms that produce output of the same type as input.
Store vtkAlgorithm input/output information.
#define VTK_INT_MAX
Definition: vtkType.h:144
auto Range(IterablePtr iterable, Options &&...opts) -> typename detail::IterableTraits< typename detail::StripPointers< IterablePtr >::type >::RangeType
Generate an iterable STL proxy object for a VTK container.
Definition: vtkRange.h:74
void SetTimeEstimationModeToNext()
Get/Set what to do when the requested time is not one of the timesteps this filter is set to extract...
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called within ProcessRequest when each filter in the pipeline decides what portion of its inp...
a simple class to control print indentation
Definition: vtkIndent.h:28
void SetTimeEstimationModeToNearest()
Get/Set what to do when the requested time is not one of the timesteps this filter is set to extract...
virtual void Modified()
Update the modification time for this object.
void SetTimeEstimationModeToPrevious()
Get/Set what to do when the requested time is not one of the timesteps this filter is set to extract...
int GetNumberOfTimeSteps() const
Get the number of time steps that will be extracted.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void ClearTimeStepIndices()
Clear the time step indices.
Store zero or more vtkInformation instances.
std::set< int > TimeStepIndices
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called within ProcessRequest when a request asks the algorithm to do its work.
static vtkPassInputTypeAlgorithm * New()