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

dox/Parallel/vtkCompositeManager.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkCompositeManager.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00041 #ifndef __vtkCompositeManager_h
00042 #define __vtkCompositeManager_h
00043 
00044 #include "vtkObject.h"
00045 
00046 class vtkTimerLog;
00047 class vtkFloatArray;
00048 class vtkDataArray;
00049 class vtkRenderWindow;
00050 class vtkRenderWindowInteractor;
00051 class vtkMultiProcessController;
00052 class vtkRenderer;
00053 class vtkCompositer;
00054 class vtkUnsignedCharArray;
00055 
00056 class VTK_PARALLEL_EXPORT vtkCompositeManager : public vtkObject
00057 {
00058 public:
00059   static vtkCompositeManager *New();
00060   vtkTypeRevisionMacro(vtkCompositeManager,vtkObject);
00061   void PrintSelf(ostream& os, vtkIndent indent);
00062 
00064 
00066   vtkGetObjectMacro(RenderWindow, vtkRenderWindow);
00067   virtual void SetRenderWindow(vtkRenderWindow *renWin);
00069 
00073   void InitializePieces();
00074   
00076   void InitializeOffScreen();
00077   
00079 
00080   void StartInteractor();
00081   void ExitInteractor();
00082   virtual void StartRender();
00083   virtual void EndRender();
00084   virtual void SatelliteStartRender();
00085   virtual void SatelliteEndRender();
00086   void RenderRMI();
00087   void ResetCamera(vtkRenderer *ren);
00088   void ResetCameraClippingRange(vtkRenderer *ren);
00089   void ComputeVisiblePropBoundsRMI();
00091   
00094   virtual void InitializeRMIs();
00095   
00097 
00102   void SetReductionFactor(int factor);
00103   vtkGetMacro(ReductionFactor, int);
00105 
00107 
00110   void SetUseChar(int useChar);
00111   vtkGetMacro(UseChar, int);
00112   vtkBooleanMacro(UseChar, int);
00114 
00116 
00121   void SetUseRGB(int useRGB);
00122   vtkGetMacro(UseRGB, int);
00123   vtkBooleanMacro(UseRGB, int);
00125 
00127 
00128   vtkSetMacro(UseCompositing, int);
00129   vtkGetMacro(UseCompositing, int);
00130   vtkBooleanMacro(UseCompositing, int);
00132   
00134 
00136   vtkGetMacro(GetBuffersTime, double);
00137   vtkGetMacro(SetBuffersTime, double);
00138   vtkGetMacro(CompositeTime, double);
00139   vtkGetMacro(MaxRenderTime, double);
00141 
00143   float GetZ(int x, int y);
00144 
00146 
00149   void SetController(vtkMultiProcessController* controller);
00150   vtkGetObjectMacro(Controller, vtkMultiProcessController);
00152 
00153 //BTX
00154 
00155   enum Tags {
00156     RENDER_RMI_TAG=12721,
00157     COMPUTE_VISIBLE_PROP_BOUNDS_RMI_TAG=56563,
00158     WIN_INFO_TAG=22134,
00159     REN_INFO_TAG=22135,
00160     BOUNDS_TAG=94135
00161   };
00162 
00164 
00167   virtual void CheckForAbortRender() {}
00168   virtual int CheckForAbortComposite() {return 0;}  
00170 //ETX
00171 
00173   virtual void ComputeVisiblePropBounds(vtkRenderer *ren, float bounds[6]);
00174 
00176 
00180   vtkSetMacro(Manual, int);
00181   vtkGetMacro(Manual, int);
00182   vtkBooleanMacro(Manual, int);
00183   void Composite();
00185 
00187 
00189   virtual void SetCompositer(vtkCompositer*);
00190   vtkGetObjectMacro(Compositer, vtkCompositer);
00192 
00194 
00195   static void DeleteArray(vtkDataArray* da);
00196   static void ResizeFloatArray(vtkFloatArray* fa, int numComp,
00197                                vtkIdType size);
00198   static void ResizeUnsignedCharArray(vtkUnsignedCharArray* uca, 
00199                                       int numComp, vtkIdType size);
00201 
00203 
00206   void SetNumberOfProcesses(int numProcs);
00207   vtkGetMacro(NumberOfProcesses, int);
00209 
00210 protected:
00211   vtkCompositeManager();
00212   ~vtkCompositeManager();
00213   
00214   void SetRendererSize(int x, int y);
00215   void MagnifyBuffer(vtkDataArray *localPdata, vtkDataArray* magPdata,
00216                      int windowSize[2]);
00217 
00218   void ReallocPDataArrays();
00219   
00220   vtkRenderWindow* RenderWindow;
00221   vtkRenderWindowInteractor* RenderWindowInteractor;
00222   vtkMultiProcessController* Controller;
00223 
00224   unsigned long StartInteractorTag;
00225   unsigned long EndInteractorTag;
00226   unsigned long StartTag;
00227   unsigned long EndTag;
00228   unsigned long ResetCameraTag;
00229   unsigned long ResetCameraClippingRangeTag;
00230   int UseChar;
00231   int UseRGB;
00232   int UseCompositing;
00233   
00234   // Convenience method used internally. It set up the start observer
00235   // and allows the render window's interactor to be set before or after
00236   // the compositer's render window (not exactly true).
00237   void SetRenderWindowInteractor(vtkRenderWindowInteractor *iren);
00238 
00239   // This object does the parallel communication for compositing.
00240   vtkCompositer *Compositer;
00241   int NumberOfProcesses;
00242 
00243   // Arrays for compositing.
00244   vtkDataArray *PData;
00245   vtkFloatArray *ZData;
00246   vtkDataArray *LocalPData;
00247   vtkFloatArray *LocalZData;
00248   int RendererSize[2];
00249 
00250   // Reduction factor (For fast interactive compositing).
00251   int ReductionFactor;
00252   
00253   // This cause me a head ache while trying to debug a lockup.
00254   // I am taking it out in retaliation.  I do not think nested
00255   // RMI's can occur anyway.
00256   // This flag stops nested RMIs from occuring.  Some rmis send 
00257   // and receive information. Nesting them can lock up the processes.
00258   int Lock;
00259 
00260   double GetBuffersTime;
00261   double SetBuffersTime;
00262   double CompositeTime;
00263   double MaxRenderTime;
00264 
00265   // Needed to compute the MaxRenderTime.
00266   vtkTimerLog *Timer;
00267 
00268   // For manual compositing.
00269   int Manual;
00270 
00271   int FirstRender;
00272 
00273 private:
00274   vtkCompositeManager(const vtkCompositeManager&); // Not implemented
00275   void operator=(const vtkCompositeManager&); // Not implemented
00276 };
00277 
00278 #endif