1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkTimeSourceExample.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 =========================================================================*/
15 // .NAME vtkTimeSource - creates a simple time varying data set.
16 // .SECTION Description
17 // Creates a small easily understood time varying data set for testing.
18 // The output is a vtkUntructuredGrid in which the point and cell values vary
19 // over time in a sin wave. The analytic ivar controls whether the output
20 // corresponds to a step function over time or is continuous.
21 // The X and Y Amplitude ivars make the output move in the X and Y directions
22 // over time. The Growing ivar makes the number of cells in the output grow
23 // and then shrink over time.
24 
25 #ifndef vtkTimeSourceExample_h
26 #define vtkTimeSourceExample_h
27 
28 #include "vtkFiltersGeneralModule.h" // For export macro
29 #include "vtkUnstructuredGridAlgorithm.h"
30 
31 class VTKFILTERSGENERAL_EXPORT vtkTimeSourceExample : public vtkUnstructuredGridAlgorithm
32 {
33 public:
34   static vtkTimeSourceExample *New();
35   vtkTypeMacro(vtkTimeSourceExample,vtkUnstructuredGridAlgorithm);
36   void PrintSelf(ostream& os, vtkIndent indent);
37 
38   //Description:
39   //When off (the default) this source produces a discrete set of values.
40   //When on, this source produces a value analytically for any queried time.
41   vtkSetClampMacro(Analytic, int, 0, 1);
42   vtkGetMacro(Analytic, int);
43   vtkBooleanMacro(Analytic, int);
44 
45   //Description:
46   //When 0.0 (the default) this produces a data set that is stationary.
47   //When on the data set moves in the X/Y plane over a sin wave over time,
48   //amplified by the value.
49   vtkSetMacro(XAmplitude, double);
50   vtkGetMacro(XAmplitude, double);
51   vtkSetMacro(YAmplitude, double);
52   vtkGetMacro(YAmplitude, double);
53 
54   //Description:
55   //When off (the default) this produces a single cell data set.
56   //When on the the number of cells (in the Y direction) grows
57   //and shrinks over time along a hat function.
58   vtkSetClampMacro(Growing, int, 0, 1);
59   vtkGetMacro(Growing, int);
60   vtkBooleanMacro(Growing, int);
61 
62 protected:
63   vtkTimeSourceExample();
64   ~vtkTimeSourceExample();
65 
66   virtual int RequestInformation(vtkInformation*,
67                                  vtkInformationVector**,
68                                  vtkInformationVector*);
69 
70   virtual int RequestData(vtkInformation*,
71                           vtkInformationVector**,
72                           vtkInformationVector*);
73 
74 
75   void LookupTimeAndValue(double &time, double &value);
76   double ValueFunction(double time);
77   double XFunction(double time);
78   double YFunction(double time);
79   int NumCellsFunction(double time);
80 
81   int Analytic;
82   double XAmplitude;
83   double YAmplitude;
84   int Growing;
85 
86   int NumSteps;
87   double *Steps;
88   double *Values;
89 private:
90   vtkTimeSourceExample(const vtkTimeSourceExample&);  // Not implemented.
91   void operator=(const vtkTimeSourceExample&);  // Not implemented.
92 };
93 
94 #endif
95 
96