VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Rendering/LIC/vtkSurfaceLICComposite.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkSurfaceLICComposite.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 =========================================================================*/
00024 #ifndef vtkSurfaceLICComposite_h
00025 #define vtkSurfaceLICComposite_h
00026 
00027 #include "vtkObject.h"
00028 #include "vtkRenderingLICModule.h" // for export macro
00029 #include "vtkPixelExtent.h" // for pixel extent
00030 #include <deque> // for deque
00031 #include <vector> // for vector
00032 
00033 class vtkFloatArray;
00034 class vtkOpenGLRenderWindow;
00035 class vtkPainterCommunicator;
00036 class vtkTextureObject;
00037 
00038 class VTKRENDERINGLIC_EXPORT vtkSurfaceLICComposite : public vtkObject
00039 {
00040 public:
00041   static vtkSurfaceLICComposite *New();
00042   vtkTypeMacro(vtkSurfaceLICComposite, vtkObject);
00043   virtual void PrintSelf(ostream &os, vtkIndent indent);
00044 
00046 
00051   void Initialize(
00052         const vtkPixelExtent &winExt,
00053         const std::deque<vtkPixelExtent> &blockExts,
00054         int strategy,
00055         double stepSize,
00056         int nSteps,
00057         int normalizeVectors,
00058         int enhancedLIC,
00059         int anitalias);
00061 
00063 
00080   enum {
00081     COMPOSITE_INPLACE=0,
00082     COMPOSITE_INPLACE_DISJOINT,
00083     COMPOSITE_BALANCED,
00084     COMPOSITE_AUTO
00085     };
00086   void SetStrategy(int val){ this->Strategy = val; }
00087   int GetStrategy(){ return this->Strategy; }
00089 
00091 
00093   int GetNumberOfCompositeExtents() const
00094     { return static_cast<int>(this->CompositeExt.size()); }
00096 
00098 
00100   const vtkPixelExtent &GetGuardExtent(int i=0) const
00101     { return this->GuardExt[i]; }
00103 
00104   const std::deque<vtkPixelExtent> &GetGuardExtents() const
00105     { return this->GuardExt; }
00106 
00108 
00110   const vtkPixelExtent &GetDisjointGuardExtent(int i=0) const
00111     { return this->DisjointGuardExt[i]; }
00113 
00114   const std::deque<vtkPixelExtent> &GetDisjointGuardExtents() const
00115     { return this->GuardExt; }
00116 
00118 
00120   const vtkPixelExtent &GetCompositeExtent(int i=0) const
00121     { return this->CompositeExt[i]; }
00123 
00124   const std::deque<vtkPixelExtent> &GetCompositeExtents() const
00125     { return this->CompositeExt; }
00126 
00128 
00129   const vtkPixelExtent &GetDataSetExtent() const
00130     { return this->DataSetExt; }
00132 
00134 
00135   const vtkPixelExtent &GetWindowExtent() const
00136     { return this->WindowExt; }
00138 
00141   int InitializeCompositeExtents(float *vectors);
00142 
00144 
00147   virtual void SetContext(vtkOpenGLRenderWindow *){}
00148   virtual vtkOpenGLRenderWindow *GetContext(){ return NULL; }
00150 
00155   virtual void SetCommunicator(vtkPainterCommunicator*){}
00156 
00158   virtual void RestoreDefaultCommunicator(){}
00159 
00162   virtual int BuildProgram(float*){ return -1; }
00163 
00165 
00167   virtual int Gather(void *, int, int, vtkTextureObject *&)
00168     { return -1; }
00170 
00172 
00174   virtual int Scatter(void *, int, int, vtkTextureObject *&)
00175     { return -1; }
00177 
00179 
00182   static
00183   int MakeDecompDisjoint(
00184         std::deque<vtkPixelExtent> &in,
00185         std::deque<vtkPixelExtent> &out);
00187 
00188 protected:
00189   vtkSurfaceLICComposite();
00190   ~vtkSurfaceLICComposite();
00191 
00193 
00199   int MakeDecompDisjoint(
00200         const std::deque<vtkPixelExtent> &in,
00201         std::deque<vtkPixelExtent> &out,
00202         float *vectors);
00204 
00206 
00207   float VectorMax(
00208         const vtkPixelExtent &ext,
00209         float *vectors);
00211 
00213 
00215   int VectorMax(
00216         const std::deque<vtkPixelExtent> &exts,
00217         float *vectors,
00218         std::vector<float> &vMax);
00220 
00222 
00223   int AddGuardPixels(
00224       const std::deque<vtkPixelExtent> &exts,
00225       std::deque<vtkPixelExtent> &guardExts,
00226       std::deque<vtkPixelExtent> &disjointGuardExts,
00227       float *vectors);
00229 
00231 
00232   void GetPixelBounds(
00233       float *rgba,
00234       int ni,
00235       vtkPixelExtent &ext);
00237 
00241   float GetFudgeFactor(int nx[2]);
00242 
00243 protected:
00244   int Pass;                                    // id for mpi tagging
00245 
00246   vtkPixelExtent WindowExt;                    // screen extent (screen size)
00247   vtkPixelExtent DataSetExt;                   // screen extent of the dataset
00248   std::deque<vtkPixelExtent> BlockExts;        // screen extents of blocks
00249 
00250   std::deque<vtkPixelExtent> CompositeExt;     // screen extents after decomp
00251   std::deque<vtkPixelExtent> GuardExt;         // screen extents w/ guard cells
00252   std::deque<vtkPixelExtent> DisjointGuardExt; // screen extents w/ guard cells
00253 
00254   int Strategy;                                // control for parallel composite
00255 
00256   double StepSize;                             // window coordinates step size
00257   int NumberOfSteps;                           // number of integration steps
00258   int NormalizeVectors;                        // does integrator normailze
00259   int NumberOfGuardLevels;                     // 1.5 if enhanced LIC 1 otherwise
00260   int NumberOfEEGuardPixels;                   // 1 if enhanced LIC 0 otherwise
00261   int NumberOfAAGuardPixels;                   // n antialias passes
00262 
00263 private:
00264   vtkSurfaceLICComposite(const vtkSurfaceLICComposite&); // Not implemented
00265   void operator=(const vtkSurfaceLICComposite&); // Not implemented
00266 
00267   friend
00268   ostream &operator<<(ostream &os, vtkSurfaceLICComposite &ss);
00269 };
00270 
00271 ostream &operator<<(ostream &os, vtkSurfaceLICComposite &ss);
00272 
00273 #endif