vtkExtractTimeSteps.h 2.82 KB
Newer Older
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
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkExtractTimeSteps.h

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

    This software is distributed WITHOUT ANY WARRANTY; without even
    the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
// .NAME vtkExtractTimeSteps - extract specific time-steps from dataset
// .SECTION Description
// vtkExtractTimeSteps extracts the specified time steps from the input dataset.
// The timesteps to be extracted are specified by their indices. If no
// time step is specified, all of the input time steps are extracted.
// This filter is useful when one wants to work with only a sub-set of the input
// time steps.

#ifndef vtkExtractTimeSteps_h
#define vtkExtractTimeSteps_h

#include "vtkFiltersExtractionModule.h" // for export macro
#include "vtkPassInputTypeAlgorithm.h"

#include <set> // for time step indices


class VTKFILTERSEXTRACTION_EXPORT vtkExtractTimeSteps : public vtkPassInputTypeAlgorithm
{
public:
  vtkTypeMacro(vtkExtractTimeSteps, vtkPassInputTypeAlgorithm);
  void PrintSelf(ostream& os, vtkIndent indent);

  static vtkExtractTimeSteps *New();

  // Description:
  // Get the number of time steps that will be extracted
  int GetNumberOfTimeSteps() const
  {
    return static_cast<int>(this->TimeStepIndices.size());
  }

  // Description:
  // Add a time step index. Not added if the index already exists.
  void AddTimeStepIndex(int timeStepIndex);

  // Description:
  // Get/Set an array of time step indices. For the Get function,
  // timeStepIndices should be big enough for GetNumberOfTimeSteps() values.
  void SetTimeStepIndices(int count, const int *timeStepIndices);
  void GetTimeStepIndices(int *timeStepIndices) const;

  // Description:
  // Generate a range of indices in [begin, end) with a step size of 'step'
  void GenerateTimeStepIndices(int begin, int end, int step);

  // Description:
  // Clear the time step indices
  void ClearTimeStepIndices()
  {
    this->TimeStepIndices.clear();
    this->Modified();
  }

protected:
  vtkExtractTimeSteps() {};
  ~vtkExtractTimeSteps() {};

  virtual int RequestData(vtkInformation *, vtkInformationVector **,
                          vtkInformationVector *);
  virtual int RequestInformation(vtkInformation *, vtkInformationVector **,
                                 vtkInformationVector *);

  std::set<int> TimeStepIndices;

private:
  vtkExtractTimeSteps(const vtkExtractTimeSteps&) VTK_DELETE_FUNCTION;
  void operator=(const vtkExtractTimeSteps&) VTK_DELETE_FUNCTION;
};

#endif // vtkExtractTimeSteps_h