Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

Servers/Common/vtkProcessModule.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   ParaView
00004   Module:    $RCSfile: vtkProcessModule.h,v $
00005 
00006   Copyright (c) Kitware, Inc.
00007   All rights reserved.
00008   See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00022 #ifndef __vtkProcessModule_h
00023 #define __vtkProcessModule_h
00024 
00025 #include "vtkObject.h"
00026 
00027 #include "vtkClientServerID.h" // Needed for UniqueID ...
00028 
00029 class vtkAlgorithm;
00030 class vtkMultiProcessController;
00031 class vtkPVInformation;
00032 class vtkCallbackCommand;
00033 class vtkClientServerInterpreter;
00034 class vtkClientServerStream;
00035 class vtkDataObject;
00036 class vtkPVProgressHandler;
00037 class vtkProcessObject;
00038 class vtkProcessModuleGUIHelper;
00039 class vtkPVOptions;
00040 class vtkKWProcessStatistics;
00041 
00042 //BTX
00043 struct vtkProcessModuleInternals;
00044 //ETX
00045 
00046 class vtkProcessModuleObserver;
00047 
00048 class VTK_EXPORT vtkProcessModule : public vtkObject
00049 {
00050 public:
00051 //BTX
00053 
00055   enum ServerFlags
00056   {
00057     DATA_SERVER = 0x1,
00058     DATA_SERVER_ROOT = 0x2,
00059     RENDER_SERVER = 0x4,
00060     RENDER_SERVER_ROOT = 0x8,
00061     CLIENT = 0x10,
00062     CLIENT_AND_SERVERS = DATA_SERVER | CLIENT | RENDER_SERVER
00063   };
00065 
00066   enum ProgressEventEnum
00067     {
00068     PROGRESS_EVENT_TAG = 31415
00069     };
00070 
00071   static inline int GetRootId(int serverId)
00072     {
00073       if (serverId == ( DATA_SERVER | CLIENT) || serverId == ( RENDER_SERVER | CLIENT) || serverId == CLIENT_AND_SERVERS)
00074         {
00075         return CLIENT;
00076         }
00077       if (serverId > CLIENT)
00078         {
00079         vtkGenericWarningMacro("Server ID correspond to either data or "
00080                                "render server");
00081         return 0;
00082         }
00083       if (serverId == DATA_SERVER_ROOT || serverId == RENDER_SERVER_ROOT)
00084         {
00085         return serverId;
00086         }
00087       if (serverId == CLIENT)
00088         {
00089         return CLIENT;
00090         }
00091       return serverId << 1;
00092     }
00093 //ETX
00094   
00095   vtkTypeRevisionMacro(vtkProcessModule,vtkObject);
00096   void PrintSelf(ostream& os, vtkIndent indent);
00097 
00098   //BTX
00104   vtkDataObject* GetDataObjectOfType(const char* classname);
00105 
00107 
00109   virtual void GatherInformation(vtkPVInformation* info,
00110                                  vtkClientServerID id);
00111   // Description:
00112   // Same as GatherInformation but use render server.
00113   virtual void GatherInformationRenderServer(vtkPVInformation* info,
00114                                              vtkClientServerID id);
00115   //ETX
00116   virtual void GatherInformationInternal(const char* infoClassName,
00117                                          vtkObject* object);
00119   
00120 //BTX  
00121   // ParaView.cxx (main) calls this method to setup the processes.
00122   // It currently creates the application, but I will try to pass
00123   // the application as an argument.
00124   virtual int Start(int, char **) = 0;
00125   
00127   virtual void Exit() = 0;
00128 
00130 
00136   vtkClientServerID NewStreamObject(const char*, vtkClientServerStream& stream);
00137   void DeleteStreamObject(vtkClientServerID, vtkClientServerStream& stream);
00139 
00142   virtual vtkObjectBase* GetObjectFromID(vtkClientServerID);
00143 
00149   virtual const vtkClientServerStream& GetLastResult(vtkTypeUInt32 server);
00150 
00152 
00156   int SendStream(vtkTypeUInt32 server, vtkClientServerStream& stream,
00157                  int resetStream=1);
00159 
00161   virtual vtkClientServerInterpreter* GetInterpreter();
00162 
00164 
00165   virtual void InitializeInterpreter();
00166   virtual void FinalizeInterpreter();
00168 //ETX
00169 
00171 
00172   void Initialize();
00173   void Finalize();
00175 
00177 
00178   vtkGetMacro(ReportInterpreterErrors, int);
00179   vtkSetMacro(ReportInterpreterErrors, int);
00180   vtkBooleanMacro(ReportInterpreterErrors, int);
00182 
00184 
00185   vtkGetObjectMacro(Controller, vtkMultiProcessController);
00187 
00189   virtual int GetPartitionId() { return 0;} ;
00190 
00192   virtual int GetNumberOfPartitions() { return 1;} ;
00193   
00194   vtkClientServerID GetUniqueID();
00195   vtkClientServerID GetProcessModuleID();
00196 
00197   static vtkProcessModule* GetProcessModule();
00198   static void SetProcessModule(vtkProcessModule* pm);
00199 
00201   void RegisterProgressEvent(vtkObject* po, int id);
00202 
00204   virtual void SendPrepareProgress();
00205   virtual void SendCleanupPendingProgress();
00207 
00209   void PrepareProgress();
00210 
00213   void CleanupPendingProgress();
00214 
00216   void ExecuteEvent(vtkObject *o, unsigned long event, void* calldata);
00217 
00218   //BTX
00220 
00221   vtkCommand* GetObserver();
00222   //ETX
00224 
00226 
00227   virtual void SetLocalProgress(const char* filter, int progress) = 0;
00228   vtkGetMacro(ProgressRequests, int);
00229   vtkSetMacro(ProgressRequests, int);
00230   vtkGetObjectMacro(ProgressHandler, vtkPVProgressHandler);
00232 
00234   vtkSetMacro(ProgressEnabled, int);
00235   vtkGetMacro(ProgressEnabled, int);
00237   
00239 
00240   vtkGetObjectMacro(Options, vtkPVOptions);
00241   virtual void SetOptions(vtkPVOptions* op);
00243 
00245   void SetGUIHelper(vtkProcessModuleGUIHelper*);
00246 
00248   ofstream* GetLogFile();
00249 
00250   virtual void CreateLogFile();
00251 
00252 //BTX
00253   enum CommunicationIds
00254   {
00255     MultiDisplayDummy=948346,
00256     MultiDisplayRootRender,
00257     MultiDisplaySatelliteRender,
00258     MultiDisplayInfo,
00259     PickBestProc,
00260     PickBestDist2,
00261     IceTWinInfo,
00262     IceTNumTilesX,
00263     IceTNumTilesY,
00264     IceTTileRanks,
00265     IceTRenInfo,
00266     GlyphNPointsGather,
00267     GlyphNPointsScatter,
00268     TreeCompositeDataFlag,
00269     TreeCompositeStatus,
00270     DuplicatePDNProcs,
00271     DuplicatePDNRecLen,
00272     DuplicatePDNAllBuffers,
00273     IntegrateAttrInfo,
00274     IntegrateAttrData,
00275     PickMakeGIDs,
00276     TemporalPickHasData,
00277     TemporalPicksData
00278   };
00279 //ETX
00280 
00281 protected:
00282   vtkProcessModule();
00283   ~vtkProcessModule();
00284 
00286 
00289   virtual vtkTypeUInt32 CreateSendFlag(vtkTypeUInt32 servers);
00290   // send a stream to the client
00291   virtual int SendStreamToClient(vtkClientServerStream&);
00292   // send a stream to the data server
00293   virtual int SendStreamToDataServer(vtkClientServerStream&);
00294   // send a stream to the data server root mpi process
00295   virtual int SendStreamToDataServerRoot(vtkClientServerStream&);
00296   // send a stream to the render server
00297   virtual int SendStreamToRenderServer(vtkClientServerStream&);
00298   // send a stream to the render server root mpi process
00299   virtual int SendStreamToRenderServerRoot(vtkClientServerStream&);
00301 
00303 
00305   virtual const vtkClientServerStream& GetLastDataServerResult();
00306   virtual const vtkClientServerStream& GetLastRenderServerResult();
00307   virtual const vtkClientServerStream& GetLastClientResult();
00309   
00310   
00311   static void InterpreterCallbackFunction(vtkObject* caller,
00312                                           unsigned long eid,
00313                                           void* cd, void* d);
00314   virtual void InterpreterCallback(unsigned long eid, void*);
00315 
00316   virtual const char* DetermineLogFilePrefix() { return "NodeLog"; }
00317 
00318   vtkMultiProcessController *Controller;
00319   vtkPVInformation *TemporaryInformation;
00320 
00321   vtkClientServerInterpreter* Interpreter;
00322   vtkClientServerStream* ClientServerStream;
00323   vtkClientServerID UniqueID;
00324   vtkCallbackCommand* InterpreterObserver;
00325   int ReportInterpreterErrors;
00326 
00327   static vtkProcessModule* ProcessModule;
00328 
00329   vtkProcessModuleInternals* Internals;
00330 
00331   void ProgressEvent(vtkObject *o, int val, const char* filter);
00332 
00333   vtkPVProgressHandler* ProgressHandler;
00334   int ProgressRequests;
00335   int ProgressEnabled;
00336 
00337   vtkProcessModuleObserver* Observer;
00338   vtkPVOptions* Options;
00339   vtkProcessModuleGUIHelper* GUIHelper;
00340   ofstream *LogFile;
00341 
00342   vtkKWProcessStatistics *MemoryInformation;
00343 
00344 private:
00345   vtkProcessModule(const vtkProcessModule&); // Not implemented
00346   void operator=(const vtkProcessModule&); // Not implemented
00347 };
00348 
00349 #endif

Generated on Tue May 30 12:31:45 2006 for ParaView by doxygen 1.3.5