VTK
dox/Filtering/vtkComputingResources.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkComputingResources.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm 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   =========================================================================*/
00015 /*-------------------------------------------------------------------------
00016   Copyright (c) 2008, 2009 by SCI Institute, University of Utah.
00017   
00018   This is part of the Parallel Dataflow System originally developed by
00019   Huy T. Vo and Claudio T. Silva. For more information, see:
00020 
00021   "Parallel Dataflow Scheme for Streaming (Un)Structured Data" by Huy
00022   T. Vo, Daniel K. Osmari, Brian Summa, Joao L.D. Comba, Valerio
00023   Pascucci and Claudio T. Silva, SCI Institute, University of Utah,
00024   Technical Report #UUSCI-2009-004, 2009.
00025 
00026   "Multi-Threaded Streaming Pipeline For VTK" by Huy T. Vo and Claudio
00027   T. Silva, SCI Institute, University of Utah, Technical Report
00028   #UUSCI-2009-005, 2009.
00029   -------------------------------------------------------------------------*/
00040 #ifndef __vtkComputingResources_h
00041 #define __vtkComputingResources_h
00042 
00043 #include "vtkObject.h"
00044 
00045 class vtkInformation;
00046 class vtkProcessingUnitResource;
00047 class vtkThreadedStreamingPipeline;
00048 
00049 class VTK_FILTERING_EXPORT vtkComputingResources : public vtkObject 
00050 {
00051 public:
00052   static vtkComputingResources* New();
00053   vtkTypeMacro(vtkComputingResources,vtkObject);
00054   void PrintSelf(ostream &os, vtkIndent indent);
00055 
00057   void Clear();
00058 
00061   void ObtainMinimumResources();
00062 
00064   void ObtainMaximumResources();
00065 
00066   //BTX
00068 
00070   vtkProcessingUnitResource *GetResourceFor(int processingUnit);
00071   //ETX
00073 
00077   void Deploy(vtkThreadedStreamingPipeline *exec, vtkInformation *info);
00078   
00081   bool Reserve(vtkComputingResources *res);
00082 
00084   void Collect(vtkComputingResources *res);
00085 
00086 protected:
00087   vtkComputingResources();
00088   ~vtkComputingResources();
00089 
00090 //BTX
00091   class implementation;
00092   implementation* const Implementation;
00093 //ETX
00094 private:
00095   vtkComputingResources(const vtkComputingResources&);  // Not implemented.
00096   void operator=(const vtkComputingResources&);  // Not implemented.
00097 };
00098 
00099 //BTX
00100 //----------------------------------------------------------------------------
00101 // A basic resource class. It is put here for later inheritance for
00102 // any type of computing, e.g. CPU/GPU.
00103 //----------------------------------------------------------------------------
00104 class vtkProcessingUnitResource {
00105 public:
00106   virtual ~vtkProcessingUnitResource() {}
00107 
00109   virtual int ProcessingUnit() = 0;
00110 
00112   virtual bool HasResource() = 0;
00113 
00115   virtual void Clear() = 0;
00116 
00118   virtual void ObtainMinimum() = 0;
00119 
00121   virtual void ObtainMaximum() = 0;
00122 
00126   virtual void IncreaseByRatio(float ratio, vtkProcessingUnitResource *refResource) = 0;
00127 
00130   virtual void AllocateFor(vtkThreadedStreamingPipeline *exec) = 0;
00131 
00133   virtual bool CanAccommodate(vtkProcessingUnitResource *refResource) = 0;
00134 
00136   virtual void Reserve(vtkProcessingUnitResource *refResource) = 0;
00137 
00139 
00140   virtual void Collect(vtkProcessingUnitResource *refResource) = 0;
00141 };
00142 //ETX
00144 
00145 #endif