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 =========================================================================*/
38 #ifndef vtkExtractTimeSteps_h
39 #define vtkExtractTimeSteps_h
40 
41 #include "vtkFiltersExtractionModule.h" // for export macro
43 
44 #include <set> // for time step indices
45 
46 
47 class VTKFILTERSEXTRACTION_EXPORT vtkExtractTimeSteps : public vtkPassInputTypeAlgorithm
48 {
49 public:
51  void PrintSelf(ostream& os, vtkIndent indent) override;
52 
53  static vtkExtractTimeSteps *New();
54 
59  {
60  return static_cast<int>(this->TimeStepIndices.size());
61  }
62 
66  void AddTimeStepIndex(int timeStepIndex);
67 
69 
73  void SetTimeStepIndices(int count, const int *timeStepIndices);
74  void GetTimeStepIndices(int *timeStepIndices) const;
76 
80  void GenerateTimeStepIndices(int begin, int end, int step);
81 
83 
87  {
88  this->TimeStepIndices.clear();
89  this->Modified();
90  }
92 
94 
98  vtkGetMacro(UseRange, bool);
99  vtkSetMacro(UseRange, bool);
100  vtkBooleanMacro(UseRange, bool);
102 
104 
107  vtkGetVector2Macro(Range, int);
108  vtkSetVector2Macro(Range, int);
110 
112 
116  vtkGetMacro(TimeStepInterval, int);
117  vtkSetClampMacro(TimeStepInterval, int, 1, VTK_INT_MAX);
119 
120  // What timestep to provide when the requested time is between the timesteps
121  // the filter is set to extract
122  enum {
123  PREVIOUS_TIMESTEP, // floor the time to the previous timestep
124  NEXT_TIMESTEP, // ceiling the time to the next timestep
125  NEAREST_TIMESTEP // take the timestep whose absolute difference from the requested time is smallest
126  } EstimationMode;
128 
133  vtkGetMacro(TimeEstimationMode, int);
134  vtkSetMacro(TimeEstimationMode, int);
135  void SetTimeEstimationModeToPrevious() { this->SetTimeEstimationMode(PREVIOUS_TIMESTEP); }
136  void SetTimeEstimationModeToNext() { this->SetTimeEstimationMode(NEXT_TIMESTEP); }
137  void SetTimeEstimationModeToNearest() { this->SetTimeEstimationMode(NEAREST_TIMESTEP); }
139 
140 protected:
142  ~vtkExtractTimeSteps() override {};
143 
145  vtkInformationVector *) override;
147  vtkInformationVector *) override;
149  vtkInformationVector *) override;
150 
151  std::set<int> TimeStepIndices;
152  bool UseRange;
153  int Range[2];
156 
157 private:
158  vtkExtractTimeSteps(const vtkExtractTimeSteps&) = delete;
159  void operator=(const vtkExtractTimeSteps&) = delete;
160 };
161 
162 #endif // vtkExtractTimeSteps_h
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:159
vtkExtractTimeSteps
extract specific time-steps from dataset
Definition: vtkExtractTimeSteps.h:47
vtkPassInputTypeAlgorithm.h
vtkExtractTimeSteps::SetTimeEstimationModeToNext
void SetTimeEstimationModeToNext()
Definition: vtkExtractTimeSteps.h:136
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
vtkExtractTimeSteps::~vtkExtractTimeSteps
~vtkExtractTimeSteps() override
Definition: vtkExtractTimeSteps.h:142
vtkObject::Modified
virtual void Modified()
Update the modification time for this object.
vtkExtractTimeSteps::UseRange
bool UseRange
Definition: vtkExtractTimeSteps.h:152
vtkExtractTimeSteps::SetTimeEstimationModeToNearest
void SetTimeEstimationModeToNearest()
Definition: vtkExtractTimeSteps.h:137
vtkExtractTimeSteps::NEXT_TIMESTEP
Definition: vtkExtractTimeSteps.h:124
vtkExtractTimeSteps::TimeStepInterval
int TimeStepInterval
Definition: vtkExtractTimeSteps.h:154
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:178
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkExtractTimeSteps::TimeStepIndices
std::set< int > TimeStepIndices
Definition: vtkExtractTimeSteps.h:151
vtkExtractTimeSteps::PREVIOUS_TIMESTEP
Definition: vtkExtractTimeSteps.h:123
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:86
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:150
vtkPassInputTypeAlgorithm::RequestInformation
virtual int RequestInformation(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called within ProcessRequest when a request asks for Information.
Definition: vtkPassInputTypeAlgorithm.h:129
vtkExtractTimeSteps::SetTimeEstimationModeToPrevious
void SetTimeEstimationModeToPrevious()
Definition: vtkExtractTimeSteps.h:135
vtkPassInputTypeAlgorithm
Superclass for algorithms that produce output of the same type as input.
Definition: vtkPassInputTypeAlgorithm.h:54
vtkExtractTimeSteps::GetNumberOfTimeSteps
int GetNumberOfTimeSteps() const
Get the number of time steps that will be extracted.
Definition: vtkExtractTimeSteps.h:58
vtkExtractTimeSteps::TimeEstimationMode
int TimeEstimationMode
Definition: vtkExtractTimeSteps.h:155