00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00030 #ifndef __vtkPVClientServerModule_h
00031 #define __vtkPVClientServerModule_h
00032
00033 #include "vtkPVProcessModule.h"
00034
00035 class vtkMapper;
00036 class vtkMapper;
00037 class vtkMultiProcessController;
00038 class vtkPVPart;
00039 class vtkSocketController;
00040 class vtkSource;
00041 class vtkSocketCommunicator;
00042
00043 class VTK_EXPORT vtkPVClientServerModule : public vtkPVProcessModule
00044 {
00045 public:
00046 static vtkPVClientServerModule* New();
00047 vtkTypeRevisionMacro(vtkPVClientServerModule,vtkPVProcessModule);
00048 void PrintSelf(ostream& os, vtkIndent indent);
00049
00052 virtual int Start(int argc, char **argv);
00053
00056 void Initialize();
00057
00059 virtual void Exit();
00060
00063 virtual int GetPartitionId();
00064
00066
00067 virtual int GetNumberOfPartitions();
00068 vtkGetMacro(NumberOfProcesses, int);
00069 vtkSetMacro(NumberOfProcesses, int);
00070 vtkGetMacro(MultiProcessMode, int);
00071 vtkSetMacro(MultiProcessMode, int);
00072 vtkGetMacro(NumberOfServerProcesses, int);
00073 vtkSetMacro(NumberOfServerProcesses, int);
00075
00077
00079 vtkGetObjectMacro(SocketController, vtkSocketController);
00081
00084 vtkSocketController* GetRenderServerSocketController();
00085
00086
00088
00090 virtual void GatherInformation(vtkPVInformation* info,
00091 vtkClientServerID id);
00092 virtual void GatherInformationRenderServer(vtkPVInformation* info,
00093 vtkClientServerID id);
00094
00095 virtual void GatherInformationInternal(const char* infoClassName,
00096 vtkObject* object);
00098
00100
00102 virtual int GetDirectoryListing(const char* dir, vtkStringList* dirs,
00103 vtkStringList* files, int save);
00105
00106
00107 enum
00108 {
00109 SINGLE_PROCESS_MODE = 0,
00110 MPI_MODE
00111 };
00112
00113
00114 static void ErrorCallback(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata);
00115
00117 void ProcessMessage(unsigned char* arg, size_t len);
00118
00119 friend void vtkPVClientServerLastResultRMI( void *, void* , int ,int );
00120
00121
00123 virtual int LoadModuleInternal(const char* name, const char* directory);
00124
00129 virtual void SetProcessEnvironmentVariable(int processId, const char* var);
00130
00132
00133 vtkGetMacro(Enabled, int);
00135
00136 protected:
00137 vtkPVClientServerModule();
00138 ~vtkPVClientServerModule();
00139
00141
00144 virtual vtkTypeUInt32 CreateSendFlag(vtkTypeUInt32 servers);
00145
00146 virtual int SendStreamToClient(vtkClientServerStream&);
00147
00148 virtual int SendStreamToDataServer(vtkClientServerStream&);
00149
00150 virtual int SendStreamToDataServerRoot(vtkClientServerStream&);
00151
00152 virtual int SendStreamToRenderServer(vtkClientServerStream&);
00153
00154 virtual int SendStreamToRenderServerRoot(vtkClientServerStream&);
00156
00158
00160 virtual const vtkClientServerStream& GetLastDataServerResult();
00161 virtual const vtkClientServerStream& GetLastRenderServerResult();
00163
00165 void SendLastClientServerResult();
00166
00169 void Connect();
00170
00172 void ConnectToRemote();
00173
00176 void SetupWaitForConnection();
00177
00179 int ShouldWaitForConnection();
00180
00184 int OpenConnectionDialog(int* start);
00185
00187 void InitializeRenderServer();
00188
00189 virtual const char* DetermineLogFilePrefix();
00190
00191 int WaitForConnectionOnSocket(vtkSocketCommunicator* comm, int sock);
00192
00193 int NumberOfServerProcesses;
00194 vtkSocketController* SocketController;
00195 vtkSocketController* RenderServerSocket;
00196 int NumberOfRenderServerProcesses;
00197
00198 int ArgumentCount;
00199 char** Arguments;
00200 int ReturnValue;
00201
00202 int MultiProcessMode;
00203 int NumberOfProcesses;
00204 int GatherRenderServer;
00205 vtkClientServerStream* LastServerResultStream;
00206
00207 int Enabled;
00208 private:
00209 vtkPVClientServerModule(const vtkPVClientServerModule&);
00210 void operator=(const vtkPVClientServerModule&);
00211 };
00212
00213 #endif