VTK
vtkExtractTimeSteps.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkExtractTimeSteps.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
35 #ifndef vtkExtractTimeSteps_h
36 #define vtkExtractTimeSteps_h
37 
38 #include "vtkFiltersExtractionModule.h" // for export macro
40 
41 #include <set> // for time step indices
42 
43 
44 class VTKFILTERSEXTRACTION_EXPORT vtkExtractTimeSteps : public vtkPassInputTypeAlgorithm
45 {
46 public:
48  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
50  static vtkExtractTimeSteps *New();
51 
56  {
57  return static_cast<int>(this->TimeStepIndices.size());
58  }
59 
63  void AddTimeStepIndex(int timeStepIndex);
64 
66 
70  void SetTimeStepIndices(int count, const int *timeStepIndices);
71  void GetTimeStepIndices(int *timeStepIndices) const;
73 
77  void GenerateTimeStepIndices(int begin, int end, int step);
78 
80 
84  {
85  this->TimeStepIndices.clear();
86  this->Modified();
87  }
89 
91 
95  vtkGetMacro(UseRange, bool);
96  vtkSetMacro(UseRange, bool);
97  vtkBooleanMacro(UseRange, bool);
99 
101 
104  vtkGetVector2Macro(Range, int);
105  vtkSetVector2Macro(Range, int);
107 
109 
113  vtkGetMacro(TimeStepInterval, int);
114  vtkSetClampMacro(TimeStepInterval, int, 1, VTK_INT_MAX);
116 
117  // What timestep to provide when the requested time is between the timesteps
118  // the filter is set to extract
119  enum {
120  PREVIOUS_TIMESTEP, // floor the time to the previous timestep
121  NEXT_TIMESTEP, // ceiling the time to the next timestep
122  NEAREST_TIMESTEP // take the timestep whose absolute difference from the requested time is smallest
123  } EstimationMode;
125 
130  vtkGetMacro(TimeEstimationMode, int);
131  vtkSetMacro(TimeEstimationMode, int);
132  void SetTimeEstimationModeToPrevious() { this->SetTimeEstimationMode(PREVIOUS_TIMESTEP); }
133  void SetTimeEstimationModeToNext() { this->SetTimeEstimationMode(NEXT_TIMESTEP); }
134  void SetTimeEstimationModeToNearest() { this->SetTimeEstimationMode(NEAREST_TIMESTEP); }
136 
137 protected:
139  ~vtkExtractTimeSteps() override {};
140 
142  vtkInformationVector *) override;
144  vtkInformationVector *) override;
146  vtkInformationVector *) override;
147 
148  std::set<int> TimeStepIndices;
149  bool UseRange;
150  int Range[2];
153 
154 private:
155  vtkExtractTimeSteps(const vtkExtractTimeSteps&) = delete;
156  void operator=(const vtkExtractTimeSteps&) = delete;
157 };
158 
159 #endif // vtkExtractTimeSteps_h
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:159
vtkExtractTimeSteps
extract specific time-steps from dataset
Definition: vtkExtractTimeSteps.h:44
vtkPassInputTypeAlgorithm.h
vtkExtractTimeSteps::SetTimeEstimationModeToNext
void SetTimeEstimationModeToNext()
Definition: vtkExtractTimeSteps.h:133
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkExtractTimeSteps::~vtkExtractTimeSteps
~vtkExtractTimeSteps() override
Definition: vtkExtractTimeSteps.h:139
vtkObject::Modified
virtual void Modified()
Update the modification time for this object.
vtkExtractTimeSteps::UseRange
bool UseRange
Definition: vtkExtractTimeSteps.h:149
vtkExtractTimeSteps::SetTimeEstimationModeToNearest
void SetTimeEstimationModeToNearest()
Definition: vtkExtractTimeSteps.h:134
vtkExtractTimeSteps::NEXT_TIMESTEP
Definition: vtkExtractTimeSteps.h:121
vtkExtractTimeSteps::TimeStepInterval
int TimeStepInterval
Definition: vtkExtractTimeSteps.h:151
vtkPassInputTypeAlgorithm::RequestData
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called within ProcessRequest when a request asks the algorithm to do its work.
Definition: vtkPassInputTypeAlgorithm.h:175
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:80
vtkExtractTimeSteps::TimeStepIndices
std::set< int > TimeStepIndices
Definition: vtkExtractTimeSteps.h:148
vtkExtractTimeSteps::PREVIOUS_TIMESTEP
Definition: vtkExtractTimeSteps.h:120
vtkPassInputTypeAlgorithm::New
static vtkPassInputTypeAlgorithm * New()
vtkPassInputTypeAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkExtractTimeSteps::ClearTimeStepIndices
void ClearTimeStepIndices()
Clear the time step indices.
Definition: vtkExtractTimeSteps.h:83
vtkPassInputTypeAlgorithm::RequestUpdateExtent
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called within ProcessRequest when each filter in the pipeline decides what portion of its inp...
Definition: vtkPassInputTypeAlgorithm.h:147
vtkPassInputTypeAlgorithm::RequestInformation
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called within ProcessRequest when a request asks for Information.
Definition: vtkPassInputTypeAlgorithm.h:126
vtkExtractTimeSteps::SetTimeEstimationModeToPrevious
void SetTimeEstimationModeToPrevious()
Definition: vtkExtractTimeSteps.h:132
vtkPassInputTypeAlgorithm
Superclass for algorithms that produce output of the same type as input.
Definition: vtkPassInputTypeAlgorithm.h:51
vtkExtractTimeSteps::GetNumberOfTimeSteps
int GetNumberOfTimeSteps() const
Get the number of time steps that will be extracted.
Definition: vtkExtractTimeSteps.h:55
vtkExtractTimeSteps::TimeEstimationMode
int TimeEstimationMode
Definition: vtkExtractTimeSteps.h:152