vtkLiveInsituLink.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: $RCSfile$
5 
6  Copyright (c) Kitware, Inc.
7  All rights reserved.
8  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html 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 =========================================================================*/
38 #ifndef vtkLiveInsituLink_h
39 #define vtkLiveInsituLink_h
40 
41 #include "vtkRemotingLiveModule.h" //needed for exports
42 
43 #include "vtkSMObject.h"
44 #include "vtkSmartPointer.h" // Needed for Smart pointer
45 #include "vtkWeakPointer.h" // Needed for Weak pointer
46 
49 class vtkPVXMLElement;
50 class vtkPVSessionBase;
51 class vtkTrivialProducer;
53 
55 {
56 public:
57  static vtkLiveInsituLink* New();
59  void PrintSelf(ostream& os, vtkIndent indent) override;
60 
62 
66  vtkSetMacro(InsituPort, int);
67  vtkGetMacro(InsituPort, int);
69 
71 
74  vtkSetStringMacro(Hostname);
75  vtkGetStringMacro(Hostname);
77 
79 
83  enum
84  {
85  LIVE = 0,
86  INSITU = 1
87  };
88  vtkSetClampMacro(ProcessType, int, LIVE, INSITU);
89  vtkGetMacro(ProcessType, int);
91 
93 
99  vtkSetMacro(ProxyId, unsigned int);
100  vtkGetMacro(ProxyId, unsigned int);
102 
104 
108  vtkGetMacro(SimulationPaused, int);
109  void SetSimulationPaused(int paused);
111 
116  bool Initialize() { return this->Initialize(NULL); }
117  bool Initialize(vtkSMSessionProxyManager*);
118 
119  // **************************************************************************
120  // *** API to be used from the insitu library ***
121 
131  void InsituUpdate(double time, vtkIdType timeStep);
132 
140  void InsituPostProcess(double time, vtkIdType timeStep);
141 
143 
149  int WaitForLiveChange();
151  void OnLiveChanged();
153 
154  // **************************************************************************
155 
156  // **************************************************************************
157  // API to be used from the LIVE side.
158  // Register/unregister a producer for an extract.
159  void RegisterExtract(
160  vtkTrivialProducer* producer, const char* groupname, const char* proxyname, int portnumber);
161  void UnRegisterExtract(vtkTrivialProducer* producer);
162 
163  void OnInsituUpdate(double time, vtkIdType timeStep);
164  void OnInsituPostProcess(double time, vtkIdType timeStep);
170  void LiveChanged();
171  // **************************************************************************
172 
174  {
175  CONNECTED = 1200,
176  NEXT_TIMESTEP_AVAILABLE = 1201,
177  DISCONNECTED = 1202
178  };
179 
180  void UpdateInsituXMLState(const char* txt);
181 
186  static bool FilterXMLState(vtkPVXMLElement* xmlState);
187 
188  // ***************************************************************
189  // Internal methods, public for callbacks.
190  void InsituConnect(vtkMultiProcessController* proc0NodesController);
191 
195  void DropLiveInsituConnection();
196 
197 protected:
199  ~vtkLiveInsituLink() override;
200 
201  enum RMITags
202  {
203  UPDATE_RMI_TAG = 8800,
204  POSTPROCESS_RMI_TAG = 8801,
205  INITIALIZE_CONNECTION = 8802,
206  DROP_CAT2PV_CONNECTION = 8803,
207  // Message from LIVE, sent when simulation is paused,
208  // signalling a change. INSITU wakes up and checks for new
209  // simulation state, changed extracts or if it should continue the
210  // simulation
211  LIVE_CHANGED = 8804
212  };
213 
217  void InitializeLive();
218 
223  bool InitializeInsitu();
224 
228  void OnConnectionCreatedEvent();
229 
234  void OnConnectionClosedEvent(vtkObject*, unsigned long eventid, void* calldata);
235 
236  char* Hostname;
239  unsigned int ProxyId;
240 
244 
253 
254 private:
255  vtkLiveInsituLink(const vtkLiveInsituLink&) = delete;
256  void operator=(const vtkLiveInsituLink&) = delete;
257 
258  vtkWeakPointer<vtkSMSessionProxyManager> InsituProxyManager;
259 
260  vtkSetStringMacro(URL);
261  char* URL;
262 
263  vtkSetStringMacro(InsituXMLState);
264 
265  class vtkInternals;
266  vtkInternals* Internals;
267 };
268 
269 #endif
#define VTKREMOTINGLIVE_EXPORT
int vtkIdType
superclass for most server manager classes
Definition: vtkSMObject.h:29
time
The vtkSMSessionProxyManager is esponsible for creating and managing proxies for a given session...
static vtkSMObject * New()
Abstract class used to provide the main implementation of the ParaView session methods for the follow...
This is used by vtkPVXMLParser to represent an XML document starting at the root element.
void PrintSelf(ostream &os, vtkIndent indent) override