1 /*=========================================================================
2 
3   Program:   Visualization Toolkit
4   Module:    vtkThreadedCompositeDataPipeline.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 /**
16  * @class   vtkThreadedCompositeDataPipeline
17  * @brief   Executive that works in parallel
18  *
19  * vtkThreadedCompositeDataPipeline processes a composite data object in
20  * parallel using the SMP framework. It does this by creating a vector of
21  * data objects (the pieces of the composite data) and processing them
22  * using vtkSMPTools::For. Note that this requires that the
23  * algorithm implement all pipeline passes in a re-entrant way. It should
24  * store/retrieve all state changes using input and output information
25  * objects, which are unique to each thread.
26 */
27 
28 #ifndef vtkThreadedCompositeDataPipeline_h
29 #define vtkThreadedCompositeDataPipeline_h
30 
31 #include "vtkCommonExecutionModelModule.h" // For export macro
32 #include "vtkCompositeDataPipeline.h"
33 
34 class vtkInformationVector;
35 class vtkInformation;
36 
37 class VTKCOMMONEXECUTIONMODEL_EXPORT vtkThreadedCompositeDataPipeline : public vtkCompositeDataPipeline
38 {
39  public:
40   static vtkThreadedCompositeDataPipeline* New();
41   vtkTypeMacro(vtkThreadedCompositeDataPipeline,vtkCompositeDataPipeline);
42   void PrintSelf(ostream &os, vtkIndent indent) override;
43 
44   /**
45    * An API to CallAlgorithm that allows you to pass in the info objects to
46    * be used
47    */
48   int CallAlgorithm(vtkInformation* request, int direction,
49                             vtkInformationVector** inInfo,
50                             vtkInformationVector* outInfo) override;
51 
52  protected:
53   vtkThreadedCompositeDataPipeline();
54   ~vtkThreadedCompositeDataPipeline() override;
55   void ExecuteEach(vtkCompositeDataIterator* iter,
56                            vtkInformationVector** inInfoVec,
57                            vtkInformationVector* outInfoVec,
58                            int compositePort,
59                            int connection,
60                            vtkInformation* request,
61                            std::vector<vtkSmartPointer<vtkCompositeDataSet>>& compositeOutput) override;
62 
63  private:
64   vtkThreadedCompositeDataPipeline(const vtkThreadedCompositeDataPipeline&) = delete;
65   void operator=(const vtkThreadedCompositeDataPipeline&) = delete;
66   friend class ProcessBlock;
67 };
68 
69 #endif
70