~ubuntu-branches/ubuntu/karmic/paraview/karmic

« back to all changes in this revision

Viewing changes to VTK/Filtering/vtkSource.h

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme
  • Date: 2008-06-15 22:04:41 UTC
  • Revision ID: james.westby@ubuntu.com-20080615220441-8us51vf6ra2umcov
Tags: upstream-3.2.2
ImportĀ upstreamĀ versionĀ 3.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*=========================================================================
 
2
 
 
3
  Program:   Visualization Toolkit
 
4
  Module:    $RCSfile: vtkSource.h,v $
 
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 vtkSource - abstract class specifies interface for visualization network source
 
16
// .SECTION Description
 
17
// vtkSource is an abstract object that specifies behavior and interface
 
18
// of source objects. Source objects are objects that begin visualization
 
19
// pipeline. Sources include readers (read data from file or communications
 
20
// port) and procedural sources (generate data programmatically). vtkSource 
 
21
// objects are also objects that generate output data. In this sense
 
22
// vtkSource is used as a superclass to vtkFilter.
 
23
//
 
24
// Concrete subclasses of vtkSource must define Update() and Execute() 
 
25
// methods. The public method Update() invokes network execution and will
 
26
// bring the network up-to-date. The protected Execute() method actually
 
27
// does the work of data creation/generation. The difference between the two
 
28
// methods is that Update() implements input consistency checks and modified
 
29
// time comparisons and then invokes the Execute() which is an implementation 
 
30
// of a particular algorithm.
 
31
//
 
32
// An important feature of subclasses of vtkSource is that it is possible 
 
33
// to control the memory-management model (i.e., retain output versus delete
 
34
// output data). If enabled the ReleaseDataFlag enables the deletion of the
 
35
// output data once the downstream process object finishes processing the
 
36
// data (please see text).
 
37
 
 
38
// .SECTION See Also
 
39
// vtkProcessObject vtkDataSetReader vtkFilter vtkPolyDataSource 
 
40
// vtkStructuredGridSource vtkStructuredPointsSource vtkUnstructuredGridSource
 
41
 
 
42
#ifndef __vtkSource_h
 
43
#define __vtkSource_h
 
44
 
 
45
#include "vtkProcessObject.h"
 
46
 
 
47
class vtkDataObject;
 
48
class vtkDataObjectToSourceFriendship;
 
49
 
 
50
class VTK_FILTERING_EXPORT vtkSource : public vtkProcessObject
 
51
{
 
52
public:
 
53
  vtkTypeRevisionMacro(vtkSource,vtkProcessObject);
 
54
  void PrintSelf(ostream& os, vtkIndent indent);
 
55
 
 
56
  // Description:
 
57
  // Bring object up-to-date before execution. Update() checks modified
 
58
  // time against last execution time, and re-executes object if necessary.
 
59
  virtual void Update();
 
60
 
 
61
  // Description:
 
62
  // Like update, but make sure the update extent is the whole extent in
 
63
  // the output.
 
64
  virtual void UpdateWholeExtent();
 
65
 
 
66
  // Description:
 
67
  // Updates any global information about the data 
 
68
  // (like spacing for images)
 
69
  virtual void UpdateInformation();
 
70
 
 
71
  // Description:
 
72
  virtual void PropagateUpdateExtent(vtkDataObject *output);
 
73
 
 
74
  // Description:
 
75
  virtual void TriggerAsynchronousUpdate();
 
76
 
 
77
  // Description:
 
78
  virtual void UpdateData(vtkDataObject *output);
 
79
 
 
80
  // Description:
 
81
  // What is the input update extent that is required to produce the
 
82
  // desired output? By default, the whole input is always required but
 
83
  // this is overridden in many subclasses. 
 
84
  virtual void ComputeInputUpdateExtents( vtkDataObject *output );
 
85
 
 
86
  // Description:
 
87
  // Turn on/off flag to control whether this object's data is released
 
88
  // after being used by a source.
 
89
  virtual void SetReleaseDataFlag(int);
 
90
  virtual int GetReleaseDataFlag();
 
91
  vtkBooleanMacro(ReleaseDataFlag,int);
 
92
 
 
93
  // Description:
 
94
  // Return an array with all the inputs of this process object.
 
95
  // This is useful for tracing back in the pipeline to construct
 
96
  // graphs etc.
 
97
  vtkDataObject **GetOutputs();
 
98
  vtkGetMacro(NumberOfOutputs,int);
 
99
 
 
100
  // Description:
 
101
  // Release/disconnect all outputs of this source. This is intended to be
 
102
  // called prior to Delete() if the user is concerned about outputs holding
 
103
  // on to the filter/source.
 
104
  void UnRegisterAllOutputs(void);
 
105
 
 
106
  // Description:
 
107
  // Return what index output the passed in output is, return -1 if it
 
108
  // does not match any of the outputs
 
109
  int GetOutputIndex(vtkDataObject *out);
 
110
 
 
111
  // Description:
 
112
  // Set this algorithm's executive.  This algorithm is removed from
 
113
  // any executive to which it has previously been assigned and then
 
114
  // assigned to the given executive.
 
115
  virtual void SetExecutive(vtkExecutive* executive);
 
116
 
 
117
  // Description:
 
118
  // Transform pipeline requests from executives into old-style
 
119
  // pipeline calls.  This works with the
 
120
  // vtkStreamingDemandDrivenPipeline executive to maintain backward
 
121
  // compatibility for filters written as subclasses of vtkSource.
 
122
  virtual int ProcessRequest(vtkInformation*,
 
123
                             vtkInformationVector**,
 
124
                             vtkInformationVector*);
 
125
 
 
126
protected:
 
127
  vtkSource();
 
128
  ~vtkSource();
 
129
 
 
130
  // Description:
 
131
  // This method is the one that should be used by subclasses, right now the 
 
132
  // default implementation is to call the backwards compatibility method
 
133
  virtual void ExecuteData(vtkDataObject *output);
 
134
 
 
135
  // Description:
 
136
  // This method is the old style execute method
 
137
  virtual void Execute();
 
138
 
 
139
  // By default, UpdateInformation calls this method to copy information
 
140
  // unmodified from the input to the output.
 
141
  virtual void ExecuteInformation();
 
142
 
 
143
  // Called after ExecuteData to call DataHasBeenGenerated on the
 
144
  // outputs.  It can be overridden by subclasses to call
 
145
  // DataHasBeenGenerated on only a subset of the outputs.  The
 
146
  // argument is the pointer to the output data object that was passed
 
147
  // to ExecuteData.
 
148
  virtual void MarkGeneratedOutputs(vtkDataObject*);
 
149
 
 
150
  // Called to allocate the input array.  Copies old inputs.
 
151
  void SetNumberOfOutputs(int num);
 
152
 
 
153
  // method used internally for getting an output.
 
154
  vtkDataObject *GetOutput(int idx);
 
155
 
 
156
  // protected methods for setting inputs.
 
157
  virtual void SetNthOutput(int num, vtkDataObject *output);
 
158
  virtual void AddOutput(vtkDataObject *output);
 
159
  virtual void RemoveOutput(vtkDataObject *output);
 
160
  
 
161
  vtkDataObject **Outputs;     // An Array of the outputs to the filter
 
162
  int NumberOfOutputs;
 
163
  int Updating;
 
164
  // Time when ExecuteInformation was last called.
 
165
  vtkTimeStamp InformationTime;
 
166
 
 
167
  virtual void ReportReferences(vtkGarbageCollector*);
 
168
 
 
169
  // Output port information must match the current outputs.
 
170
  int FillOutputPortInformation(int, vtkInformation*);
 
171
 
 
172
  // Reimplemented from vtkAlgorithm to maintain backward
 
173
  // compatibility for vtkProcessObject.
 
174
  virtual void SetNumberOfOutputPorts(int n);
 
175
 
 
176
  //BTX
 
177
  friend class vtkDataObjectToSourceFriendship;
 
178
  //ETX
 
179
 
 
180
private:
 
181
  vtkSource(const vtkSource&);  // Not implemented.
 
182
  void operator=(const vtkSource&);  // Not implemented.
 
183
};
 
184
 
 
185
#endif
 
186
 
 
187
 
 
188