VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vtkPSurfaceLICComposite.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPSurfaceLICComposite.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
24 #ifndef __vtkPSurfaceLICComposite_h
25 #define __vtkPSurfaceLICComposite_h
26 
27 #include "vtkSurfaceLICComposite.h"
28 #include "vtkWeakPointer.h" // for ren context
29 #include "vtkOpenGLRenderWindow.h" // for context
30 #include "vtkRenderingParallelLICModule.h" // for export macro
31 #include "vtkPixelExtent.h" // for pixel extent
32 #include "vtkPPixelTransfer.h" // for pixel transfer
33 #include <deque> // for deque
34 #include <vector> // for vector
35 #include <list> // for list
36 
37 class vtkFloatArray;
38 class vtkRenderWindow;
40 class vtkTextureObject;
41 class vtkShaderProgram2;
44 class vtkPPixelExtentOps;
45 
47 {
48 public:
49  static vtkPSurfaceLICComposite *New();
51  virtual void PrintSelf(ostream &os, vtkIndent indent);
52 
54 
57  virtual void SetContext(vtkOpenGLRenderWindow *rwin);
58  virtual vtkOpenGLRenderWindow *GetContext(){ return this->Context; }
60 
63  virtual void SetCommunicator(vtkPainterCommunicator *comm);
64 
67  virtual int BuildProgram(float *vectors);
68 
70 
72  virtual int Gather(
73  void *pSendPBO,
74  int dataType,
75  int nComps,
76  vtkTextureObject *&newImage);
78 
80 
82  virtual int Scatter(
83  void *pSendPBO,
84  int dataType,
85  int nComps,
86  vtkTextureObject *&newImage);
88 
89 protected:
92 
93 private:
95  int InitializeCompositeShader(vtkOpenGLRenderWindow *context);
96 
98  int ExecuteShader(const vtkPixelExtent &ext, vtkTextureObject *tex);
99 
101 
104  double EstimateCommunicationCost(
105  const std::deque<std::deque<vtkPixelExtent> > &srcExts,
106  const std::deque<std::deque<vtkPixelExtent> > &destExts);
108 
110 
112  double EstimateDecompEfficiency(
113  const std::deque< std::deque<vtkPixelExtent> > &exts,
114  const std::deque< std::deque<vtkPixelExtent> > &guardExts);
116 
118 
119  int DecomposeScreenExtent(
120  std::deque< std::deque<vtkPixelExtent> >&newExts,
121  float *vectors);
123 
125 
126  int DecomposeExtent(
128  int nPieces,
129  std::list<vtkPixelExtent> &out);
131 
133 
139  int MakeDecompDisjoint(
140  const std::deque< std::deque< vtkPixelExtent> > &in,
141  std::deque< std::deque< vtkPixelExtent> > &out,
142  float *vectors);
144 
145 
146  // decomp set of extents
147  int MakeDecompLocallyDisjoint(
148  const std::deque< std::deque< vtkPixelExtent> > &in,
149  std::deque< std::deque< vtkPixelExtent> > &out);
150 
152 
154 
157  int AllGatherExtents(
158  const std::deque<vtkPixelExtent> &localExts,
159  std::deque<std::deque<vtkPixelExtent> > &remoteExts,
160  vtkPixelExtent &dataSetExt);
162 
164 
165  int AllReduceVectorMax(
166  const std::deque<vtkPixelExtent> &originalExts,
167  const std::deque<std::deque<vtkPixelExtent> > &newExts,
168  float *vectors,
169  std::vector<std::vector<float> > &vectorMax);
171 
173 
174  int AddGuardPixels(
175  const std::deque<std::deque<vtkPixelExtent> > &exts,
176  std::deque<std::deque<vtkPixelExtent> > &guardExts,
177  std::deque<std::deque<vtkPixelExtent> > &disjointGuardExts,
178  float *vectors);
180 
181 private:
182  vtkPPainterCommunicator *PainterComm; // mpi state
183  vtkPPixelExtentOps *PixelOps;
184  int CommRank;
185  int CommSize;
186 
187  vtkWeakPointer<vtkOpenGLRenderWindow> Context; // rendering context
188  vtkFrameBufferObject2 *FBO; // buffer object
189  vtkShaderProgram2 *CompositeShader; // shader program for compositing
190 
191  std::deque<vtkPPixelTransfer> GatherProgram; // ordered steps required to move data to new decomp
192  std::deque<vtkPPixelTransfer> ScatterProgram; // ordered steps required to unmove data from new decomp
193 
194  friend
195  ostream &operator<<(ostream &os, vtkPSurfaceLICComposite &ss);
196 
197  vtkPSurfaceLICComposite(const vtkPSurfaceLICComposite&); // Not implemented
198  void operator=(const vtkPSurfaceLICComposite&); // Not implemented
199 };
200 
201 ostream &operator<<(ostream &os, vtkPSurfaceLICComposite &ss);
202 
203 #endif
OpenGL rendering window.
static vtkSurfaceLICComposite * New()
friend ostream & operator<<(ostream &os, vtkSurfaceLICComposite &ss)
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:45
virtual vtkOpenGLRenderWindow * GetContext()
GLuint in
Definition: vtkgl.h:16905
#define VTKRENDERINGPARALLELLIC_EXPORT
virtual void SetCommunicator(vtkPainterCommunicator *)
virtual int Gather(void *, int, int, vtkTextureObject *&)
virtual void PrintSelf(ostream &os, vtkIndent indent)
GLSL Program.
a simple class to control print indentation
Definition: vtkIndent.h:38
virtual void SetContext(vtkOpenGLRenderWindow *)
int AddGuardPixels(const std::deque< vtkPixelExtent > &exts, std::deque< vtkPixelExtent > &guardExts, std::deque< vtkPixelExtent > &disjointGuardExts, float *vectors)
static int MakeDecompDisjoint(std::deque< vtkPixelExtent > &in, std::deque< vtkPixelExtent > &out)
abstracts an OpenGL texture object.
create a window for renderers to draw into
virtual int Scatter(void *, int, int, vtkTextureObject *&)
virtual int BuildProgram(float *)
ostream & operator<<(ostream &os, vtkPSurfaceLICComposite &ss)
Interface to OpenGL framebuffer object.