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 
23 class VTKPVPYTHONCATALYST_EXPORT vtkCPPythonScriptV2Helper : public vtkObject
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 
71 
75  bool Import(vtkCPDataDescription* desc);
76  bool CatalystInitialize(vtkCPDataDescription* desc);
77  bool RequestDataDescription(vtkCPDataDescription* desc);
78  bool CatalystExecute(vtkCPDataDescription* desc);
80 
82 
87  static vtkCPPythonScriptV2Helper* GetActiveInstance();
88  void RegisterExtractor(vtkSMProxy* extractor);
89  void RegisterView(vtkSMProxy* view);
90  void SetOptions(vtkSMProxy* catalystOptions);
91  vtkGetObjectMacro(Options, vtkSMProxy);
92  vtkCPDataDescription* GetDataDescription() const { return this->DataDescription; }
93  vtkSMProxy* GetTrivialProducer(const char* inputname);
94  vtkStringList* GetArgumentsAsStringList() const;
95  vtkStringList* GetParametersAsStringList() const;
97 
98 protected:
100  ~vtkCPPythonScriptV2Helper() override;
101 
102  bool IsActivated(int timestep, double time);
103  bool IsLiveActivated();
104  void DoLive(int, double);
105 
106 private:
108  void operator=(const vtkCPPythonScriptV2Helper&) = delete;
109 
110  class vtkInternals;
111  vtkInternals* Internals;
112  vtkSMProxy* Options;
113  std::string Filename;
114  vtkCPDataDescription* DataDescription;
115 
116  static vtkCPPythonScriptV2Helper* ActiveInstance;
117 };
118 
119 #endif
vtkObjectBase::operator=
void operator=(const vtkObjectBase &)
vtkObject::New
static vtkObject * New()
vtkObject
vtkCPPythonScriptV2Helper::GetDataDescription
vtkCPDataDescription * GetDataDescription() const
Internal methods.
Definition: vtkCPPythonScriptV2Helper.h:92
vtkSMProxy
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:140
vtkCPDataDescription
Definition: vtkCPDataDescription.h:15
vtkIndent
vtkStringList
Manages allocation and freeing for a string list.
Definition: vtkStringList.h:18
vtkObject.h
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
vtkCPPythonScriptV2Helper
an internal class encapsulating logic for Catalyst Python scripts.
Definition: vtkCPPythonScriptV2Helper.h:23