vtkCPPythonScriptV2Helper.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
11 #ifndef vtkCPPythonScriptV2Helper_h
12 #define vtkCPPythonScriptV2Helper_h
13 
14 #include "vtkObject.h"
15 #include "vtkPVPythonCatalystModule.h" // For windows import/export of shared libraries
16 #include <string> // for std::string
17 #include <vector> //for std::string
18 
19 class vtkSMProxy;
21 class vtkStringList;
22 
24 {
25 public:
28  void PrintSelf(ostream& os, vtkIndent indent) override;
29 
34  bool PrepareFromScript(const std::string& fname);
35 
39  const std::string& GetScriptFileName() const;
40 
44  bool IsImported() const;
45 
53  bool Import(const std::vector<std::string>& args = {});
54 
58  bool CatalystInitialize();
59 
63  bool CatalystFinalize();
64 
68  bool CatalystExecute(int timestep, double time, const std::vector<std::string>& params = {});
69 
73  bool CatalystResults();
74 
76 
80  bool Import(vtkCPDataDescription* desc);
81  bool CatalystInitialize(vtkCPDataDescription* desc);
82  bool RequestDataDescription(vtkCPDataDescription* desc);
83  bool CatalystExecute(vtkCPDataDescription* desc);
85 
87 
92  static vtkCPPythonScriptV2Helper* GetActiveInstance();
93  void RegisterExtractor(vtkSMProxy* extractor);
94  void RegisterView(vtkSMProxy* view);
95  void SetOptions(vtkSMProxy* catalystOptions);
96  vtkGetObjectMacro(Options, vtkSMProxy);
97  vtkCPDataDescription* GetDataDescription() const { return this->DataDescription; }
98  vtkSMProxy* GetTrivialProducer(const char* inputname);
99  vtkStringList* GetArgumentsAsStringList() const;
100  vtkStringList* GetParametersAsStringList() const;
102 
103 protected:
105  ~vtkCPPythonScriptV2Helper() override;
106 
107  bool IsActivated(int timestep, double time);
108  bool IsLiveActivated();
109  void DoLive(int, double);
110 
111 private:
113  void operator=(const vtkCPPythonScriptV2Helper&) = delete;
114 
115  class vtkInternals;
116  vtkInternals* Internals;
117  vtkSMProxy* Options;
118  std::string Filename;
119  vtkCPDataDescription* DataDescription;
120 
121  static vtkCPPythonScriptV2Helper* ActiveInstance;
122 };
123 
124 #endif
#define VTKPVPYTHONCATALYST_EXPORT
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
an internal class encapsulating logic for Catalyst Python scripts.
vtkCPDataDescription * GetDataDescription() const
Internal methods.
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:140
static vtkObject * New()
void operator=(const vtkObjectBase &)
Manages allocation and freeing for a string list.
Definition: vtkStringList.h:18
This class provides the description of the data for the coprocessor pipelines.