VTK: Common/ExecutionModel/vtkExecutive.h Source File

| VTK 9.3.1

vtkExecutive.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
27 #ifndef vtkExecutive_h
28 #define vtkExecutive_h
29
30 #include "vtkCommonExecutionModelModule.h" // For export macro
31 #include "vtkObject.h"
32
33 VTK_ABI_NAMESPACE_BEGIN
34 class vtkAlgorithm;
35 class vtkAlgorithmOutput;
36 class vtkAlgorithmToExecutiveFriendship;
37 class vtkDataObject;
38 class vtkExecutiveInternals;
39 class vtkInformation;
40 class vtkInformationExecutivePortKey;
41 class vtkInformationExecutivePortVectorKey;
42 class vtkInformationIntegerKey;
43 class vtkInformationRequestKey;
44 class vtkInformationKeyVectorKey;
45 class vtkInformationVector;
46
47 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkExecutive : public vtkObject
48 {
49 public:
50 vtkTypeMacro(vtkExecutive, vtkObject);
51 void PrintSelf(ostream& os, vtkIndent indent) override;
52
56 vtkAlgorithm* GetAlgorithm();
57
62 virtual vtkTypeBool ProcessRequest(
63 vtkInformation* request, vtkInformationVector** inInfo, vtkInformationVector* outInfo);
64
77 virtual int ComputePipelineMTime(vtkInformation* request, vtkInformationVector** inInfoVec,
78 vtkInformationVector* outInfoVec, int requestFromOutputPort, vtkMTimeType* mtime);
79
83 virtual int UpdateInformation() { return 1; }
84
86
90 virtual vtkTypeBool Update();
91 virtual vtkTypeBool Update(int port);
93
95
99 int GetNumberOfInputPorts();
100 int GetNumberOfOutputPorts();
102
106 int GetNumberOfInputConnections(int port);
107
111 virtual vtkInformation* GetOutputInformation(int port);
112
116 vtkInformationVector* GetOutputInformation();
117
121 vtkInformation* GetInputInformation(int port, int connection);
122
126 vtkInformationVector* GetInputInformation(int port);
127
131 vtkInformationVector** GetInputInformation();
132
136 vtkExecutive* GetInputExecutive(int port, int connection);
137
139
142 virtual vtkDataObject* GetOutputData(int port);
143 virtual void SetOutputData(int port, vtkDataObject*, vtkInformation* info);
144 virtual void SetOutputData(int port, vtkDataObject*);
146
148
151 virtual vtkDataObject* GetInputData(int port, int connection);
152 virtual vtkDataObject* GetInputData(int port, int connection, vtkInformationVector** inInfoVec);
154
163
171 void SetSharedInputInformation(vtkInformationVector** inInfoVec);
172 void SetSharedOutputInformation(vtkInformationVector* outInfoVec);
174
176
179 bool UsesGarbageCollector() const override { return true; }
181
186 static vtkInformationExecutivePortKey* PRODUCER();
187
192 static vtkInformationExecutivePortVectorKey* CONSUMERS();
193
198 static vtkInformationIntegerKey* FROM_OUTPUT_PORT();
199
201
205 static vtkInformationIntegerKey* ALGORITHM_BEFORE_FORWARD();
206 static vtkInformationIntegerKey* ALGORITHM_AFTER_FORWARD();
207 static vtkInformationIntegerKey* ALGORITHM_DIRECTION();
208 static vtkInformationIntegerKey* FORWARD_DIRECTION();
209 static vtkInformationKeyVectorKey* KEYS_TO_COPY();
211
212 enum
213 {
214 RequestUpstream,
215 RequestDownstream
216 };
217 enum
218 {
219 BeforeForward,
220 AfterForward
221 };
222
227 virtual int CallAlgorithm(vtkInformation* request, int direction, vtkInformationVector** inInfo,
228 vtkInformationVector* outInfo);
229
230 protected:
231 vtkExecutive();
232 ~vtkExecutive() override;
233
234 // Helper methods for subclasses.
235 int InputPortIndexInRange(int port, const char* action);
236 int OutputPortIndexInRange(int port, const char* action);
237
238 // Called by methods to check for a recursive pipeline update. A
239 // request should be fulfilled without making another request. This
240 // is used to help enforce that behavior. Returns 1 if no recursive
241 // request is occurring, and 0 otherwise. An error message is
242 // produced automatically if 0 is returned. The first argument is
243 // the name of the calling method (the one that should not be
244 // invoked recursively during an update). The second argument is
245 // the recursive request information object, if any. It is used to
246 // construct the error message.
247 int CheckAlgorithm(const char* method, vtkInformation* request);
248
253 bool CheckAbortedInput(vtkInformationVector** inInfoVec);
254
255 virtual int ForwardDownstream(vtkInformation* request);
256 virtual int ForwardUpstream(vtkInformation* request);
257 virtual void CopyDefaultInformation(vtkInformation* request, int direction,
258 vtkInformationVector** inInfo, vtkInformationVector* outInfo);
259
260 // Reset the pipeline update values in the given output information object.
261 virtual void ResetPipelineInformation(int port, vtkInformation*) = 0;
262
263 // Bring the existence of output data objects up to date.
264 virtual int UpdateDataObject() = 0;
265
266 // Garbage collection support.
267 void ReportReferences(vtkGarbageCollector*) override;
268
269 virtual void SetAlgorithm(vtkAlgorithm* algorithm);
270
271 // The algorithm managed by this executive.
272 vtkAlgorithm* Algorithm;
273
274 // Flag set when the algorithm is processing a request.
275 int InAlgorithm;
276
277 // Pointers to an outside instance of input or output information.
278 // No references are held. These are used to implement internal
279 // pipelines.
280 vtkInformationVector** SharedInputInformation;
281 vtkInformationVector* SharedOutputInformation;
282
283 private:
284 // Store an information object for each output port of the algorithm.
285 vtkInformationVector* OutputInformation;
286
287 // Internal implementation details.
288 vtkExecutiveInternals* ExecutiveInternal;
289
290 friend class vtkAlgorithmToExecutiveFriendship;
291
292 vtkExecutive(const vtkExecutive&) = delete;
293 void operator=(const vtkExecutive&) = delete;
294 };
295
296 VTK_ABI_NAMESPACE_END
297 #endif
vtkAlgorithmOutput
Proxy object to connect input/output ports.
Definition: vtkAlgorithmOutput.h:41
vtkAlgorithm
Superclass for all sources, filters, and sinks in VTK.
Definition: vtkAlgorithm.h:61
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:64
vtkExecutive
Superclass for all pipeline executives in VTK.
Definition: vtkExecutive.h:48
vtkExecutive::CheckAlgorithm
int CheckAlgorithm(const char *method, vtkInformation *request)
vtkExecutive::ForwardDownstream
virtual int ForwardDownstream(vtkInformation *request)
vtkExecutive::Update
virtual vtkTypeBool Update()
Bring the algorithm's outputs up-to-date.
vtkExecutive::Update
virtual vtkTypeBool Update(int port)
Bring the algorithm's outputs up-to-date.
vtkExecutive::GetInputExecutive
vtkExecutive * GetInputExecutive(int port, int connection)
Get the executive managing the given input connection.
vtkExecutive::GetInputInformation
vtkInformationVector ** GetInputInformation()
Get the pipeline information vectors for all inputs.
vtkExecutive::ALGORITHM_BEFORE_FORWARD
static vtkInformationIntegerKey * ALGORITHM_BEFORE_FORWARD()
Keys to program vtkExecutive::ProcessRequest with the default behavior for unknown requests.
vtkExecutive::ForwardUpstream
virtual int ForwardUpstream(vtkInformation *request)
vtkExecutive::KEYS_TO_COPY
static vtkInformationKeyVectorKey * KEYS_TO_COPY()
Keys to program vtkExecutive::ProcessRequest with the default behavior for unknown requests.
vtkExecutive::ReportReferences
void ReportReferences(vtkGarbageCollector *) override
vtkExecutive::GetInputData
virtual vtkDataObject * GetInputData(int port, int connection)
Get the data object for an input port of the algorithm.
vtkExecutive::~vtkExecutive
~vtkExecutive() override
vtkExecutive::UpdateDataObject
virtual int UpdateDataObject()=0
vtkExecutive::SharedInputInformation
vtkInformationVector ** SharedInputInformation
Definition: vtkExecutive.h:280
vtkExecutive::RequestUpstream
@ RequestUpstream
Definition: vtkExecutive.h:214
vtkExecutive::Algorithm
vtkAlgorithm * Algorithm
Definition: vtkExecutive.h:272
vtkExecutive::FROM_OUTPUT_PORT
static vtkInformationIntegerKey * FROM_OUTPUT_PORT()
Information key to store the output port number from which a request is made.
vtkExecutive::vtkExecutive
vtkExecutive()
vtkExecutive::ProcessRequest
virtual vtkTypeBool ProcessRequest(vtkInformation *request, vtkInformationVector **inInfo, vtkInformationVector *outInfo)
Generalized interface for asking the executive to fulfill pipeline requests.
vtkExecutive::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkExecutive::CheckAbortedInput
bool CheckAbortedInput(vtkInformationVector **inInfoVec)
Checks to see if an inputs have ABORTED set.
vtkExecutive::GetAlgorithm
vtkAlgorithm * GetAlgorithm()
Get the algorithm to which this executive has been assigned.
vtkExecutive::SetSharedOutputInformation
void SetSharedOutputInformation(vtkInformationVector *outInfoVec)
Get the output port that produces the given data object.
vtkExecutive::SetAlgorithm
virtual void SetAlgorithm(vtkAlgorithm *algorithm)
vtkExecutive::BeforeForward
@ BeforeForward
Definition: vtkExecutive.h:219
vtkExecutive::UsesGarbageCollector
bool UsesGarbageCollector() const override
Participate in garbage collection.
Definition: vtkExecutive.h:179
vtkExecutive::ALGORITHM_AFTER_FORWARD
static vtkInformationIntegerKey * ALGORITHM_AFTER_FORWARD()
Keys to program vtkExecutive::ProcessRequest with the default behavior for unknown requests.
vtkExecutive::ALGORITHM_DIRECTION
static vtkInformationIntegerKey * ALGORITHM_DIRECTION()
Keys to program vtkExecutive::ProcessRequest with the default behavior for unknown requests.
vtkExecutive::GetInputInformation
vtkInformationVector * GetInputInformation(int port)
Get the pipeline information vectors for the given input port.
vtkExecutive::ComputePipelineMTime
virtual int ComputePipelineMTime(vtkInformation *request, vtkInformationVector **inInfoVec, vtkInformationVector *outInfoVec, int requestFromOutputPort, vtkMTimeType *mtime)
A special version of ProcessRequest meant specifically for the pipeline modified time request.
vtkExecutive::ResetPipelineInformation
virtual void ResetPipelineInformation(int port, vtkInformation *)=0
vtkExecutive::GetInputInformation
vtkInformation * GetInputInformation(int port, int connection)
Get the pipeline information for the given input connection.
vtkExecutive::GetOutputInformation
vtkInformationVector * GetOutputInformation()
Get the pipeline information object for all output ports.
vtkExecutive::GetOutputInformation
virtual vtkInformation * GetOutputInformation(int port)
Get the pipeline information object for the given output port.
vtkExecutive::SetOutputData
virtual void SetOutputData(int port, vtkDataObject *, vtkInformation *info)
Get/Set the data object for an output port of the algorithm.
vtkExecutive::PRODUCER
static vtkInformationExecutivePortKey * PRODUCER()
Information key to store the executive/port number producing an information object.
vtkExecutive::GetNumberOfInputPorts
int GetNumberOfInputPorts()
Get the number of input/output ports for the algorithm associated with this executive.
vtkExecutive::FORWARD_DIRECTION
static vtkInformationIntegerKey * FORWARD_DIRECTION()
Keys to program vtkExecutive::ProcessRequest with the default behavior for unknown requests.
vtkExecutive::SetSharedInputInformation
void SetSharedInputInformation(vtkInformationVector **inInfoVec)
Get the output port that produces the given data object.
vtkExecutive::OutputPortIndexInRange
int OutputPortIndexInRange(int port, const char *action)
vtkExecutive::SetOutputData
virtual void SetOutputData(int port, vtkDataObject *)
Get/Set the data object for an output port of the algorithm.
vtkExecutive::InAlgorithm
int InAlgorithm
Definition: vtkExecutive.h:275
vtkExecutive::UpdateInformation
virtual int UpdateInformation()
Bring the output information up to date.
Definition: vtkExecutive.h:83
vtkExecutive::SharedOutputInformation
vtkInformationVector * SharedOutputInformation
Definition: vtkExecutive.h:281
vtkExecutive::CallAlgorithm
virtual int CallAlgorithm(vtkInformation *request, int direction, vtkInformationVector **inInfo, vtkInformationVector *outInfo)
An API to CallAlgorithm that allows you to pass in the info objects to be used.
vtkExecutive::CopyDefaultInformation
virtual void CopyDefaultInformation(vtkInformation *request, int direction, vtkInformationVector **inInfo, vtkInformationVector *outInfo)
vtkExecutive::GetNumberOfOutputPorts
int GetNumberOfOutputPorts()
Get the number of input/output ports for the algorithm associated with this executive.
vtkExecutive::InputPortIndexInRange
int InputPortIndexInRange(int port, const char *action)
vtkExecutive::GetOutputData
virtual vtkDataObject * GetOutputData(int port)
Get/Set the data object for an output port of the algorithm.
vtkExecutive::GetInputData
virtual vtkDataObject * GetInputData(int port, int connection, vtkInformationVector **inInfoVec)
Get the data object for an input port of the algorithm.
vtkExecutive::CONSUMERS
static vtkInformationExecutivePortVectorKey * CONSUMERS()
Information key to store the executive/port number pairs consuming an information object.
vtkExecutive::GetNumberOfInputConnections
int GetNumberOfInputConnections(int port)
Get the number of input connections on the given port.
vtkGarbageCollector
Detect and break reference loops.
Definition: vtkGarbageCollector.h:80
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkInformationExecutivePortKey
Key for vtkExecutive/Port value pairs.
Definition: vtkInformationExecutivePortKey.h:24
vtkInformationExecutivePortVectorKey
Key for vtkExecutive/Port value pair vectors.
Definition: vtkInformationExecutivePortVectorKey.h:24
vtkInformationIntegerKey
Key for integer values in vtkInformation.
Definition: vtkInformationIntegerKey.h:24
vtkInformationKeyVectorKey
Key for vector-of-keys values.
Definition: vtkInformationKeyVectorKey.h:21
vtkInformationRequestKey
Key for pointer to pointer.
Definition: vtkInformationRequestKey.h:21
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:40
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:72
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:61
vtkX3D::info
@ info
Definition: vtkX3D.h:376
vtkX3D::direction
@ direction
Definition: vtkX3D.h:260
vtkX3D::port
@ port
Definition: vtkX3D.h:447
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:64
vtkObject.h
vtkMTimeType
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270