VTK
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 =========================================================================*/
25 #ifndef vtkPSurfaceLICComposite_h
26 #define vtkPSurfaceLICComposite_h
27 
28 #include "vtkSurfaceLICComposite.h"
29 #include "vtkWeakPointer.h" // for ren context
30 #include "vtkOpenGLRenderWindow.h" // for context
31 #include "vtkRenderingParallelLICModule.h" // for export macro
32 #include "vtkPixelExtent.h" // for pixel extent
33 #include "vtkPPixelTransfer.h" // for pixel transfer
34 #include <deque> // for deque
35 #include <vector> // for vector
36 #include <list> // for list
37 
38 class vtkFloatArray;
39 class vtkRenderWindow;
41 class vtkTextureObject;
44 class vtkPPixelExtentOps;
45 
46 #ifdef VTK_OPENGL2
47 class vtkOpenGLHelper;
48 #else
49 class vtkShaderProgram2;
50 #endif
51 
52 class VTKRENDERINGPARALLELLIC_EXPORT vtkPSurfaceLICComposite : public vtkSurfaceLICComposite
53 {
54 public:
57  virtual void PrintSelf(ostream &os, vtkIndent indent);
58 
64  virtual void SetContext(vtkOpenGLRenderWindow *rwin);
65  virtual vtkOpenGLRenderWindow *GetContext(){ return this->Context; }
66 
72 
77  virtual int BuildProgram(float *vectors);
78 
83  virtual int Gather(
84  void *pSendPBO,
85  int dataType,
86  int nComps,
87  vtkTextureObject *&newImage);
88 
93  virtual int Scatter(
94  void *pSendPBO,
95  int dataType,
96  int nComps,
97  vtkTextureObject *&newImage);
98 
99 protected:
102 
103 private:
107  int InitializeCompositeShader(vtkOpenGLRenderWindow *context);
108 
112  int ExecuteShader(const vtkPixelExtent &ext, vtkTextureObject *tex);
113 
119  double EstimateCommunicationCost(
120  const std::deque<std::deque<vtkPixelExtent> > &srcExts,
121  const std::deque<std::deque<vtkPixelExtent> > &destExts);
122 
128  double EstimateDecompEfficiency(
129  const std::deque< std::deque<vtkPixelExtent> > &exts,
130  const std::deque< std::deque<vtkPixelExtent> > &guardExts);
131 
136  int DecomposeScreenExtent(
137  std::deque< std::deque<vtkPixelExtent> >&newExts,
138  float *vectors);
139 
144  int DecomposeExtent(
145  vtkPixelExtent &in,
146  int nPieces,
147  std::list<vtkPixelExtent> &out);
148 
157  int MakeDecompDisjoint(
158  const std::deque< std::deque< vtkPixelExtent> > &in,
159  std::deque< std::deque< vtkPixelExtent> > &out,
160  float *vectors);
161 
162 
163  // decomp set of extents
164  int MakeDecompLocallyDisjoint(
165  const std::deque< std::deque< vtkPixelExtent> > &in,
166  std::deque< std::deque< vtkPixelExtent> > &out);
167 
169 
175  int AllGatherExtents(
176  const std::deque<vtkPixelExtent> &localExts,
177  std::deque<std::deque<vtkPixelExtent> > &remoteExts,
178  vtkPixelExtent &dataSetExt);
179 
183  int AllReduceVectorMax(
184  const std::deque<vtkPixelExtent> &originalExts,
185  const std::deque<std::deque<vtkPixelExtent> > &newExts,
186  float *vectors,
187  std::vector<std::vector<float> > &vectorMax);
188 
192  int AddGuardPixels(
193  const std::deque<std::deque<vtkPixelExtent> > &exts,
194  std::deque<std::deque<vtkPixelExtent> > &guardExts,
195  std::deque<std::deque<vtkPixelExtent> > &disjointGuardExts,
196  float *vectors);
197 
198 private:
199  vtkPPainterCommunicator *PainterComm; // mpi state
200  vtkPPixelExtentOps *PixelOps;
201  int CommRank;
202  int CommSize;
203 
204  vtkWeakPointer<vtkOpenGLRenderWindow> Context; // rendering context
205  vtkFrameBufferObject2 *FBO; // buffer object
206 
207 #ifdef VTK_OPENGL2
208  vtkOpenGLHelper *CompositeShader;
209 #else
210  vtkShaderProgram2 *CompositeShader; // shader program for compositing
211 #endif
212 
213  std::deque<vtkPPixelTransfer> GatherProgram; // ordered steps required to move data to new decomp
214  std::deque<vtkPPixelTransfer> ScatterProgram; // ordered steps required to unmove data from new decomp
215 
216  friend VTKRENDERINGPARALLELLIC_EXPORT
217  ostream &operator<<(ostream &os, vtkPSurfaceLICComposite &ss);
218 
219  vtkPSurfaceLICComposite(const vtkPSurfaceLICComposite&) VTK_DELETE_FUNCTION;
220  void operator=(const vtkPSurfaceLICComposite&) VTK_DELETE_FUNCTION;
221 };
222 
223 VTKRENDERINGPARALLELLIC_EXPORT
224 ostream &operator<<(ostream &os, vtkPSurfaceLICComposite &ss);
225 
226 #endif
vtkPPainterCommunicator
Definition: vtkPPainterCommunicator.h:36
vtkX3D::vector
@ vector
Definition: vtkX3D.h:237
vtkPSurfaceLICComposite::GetContext
virtual vtkOpenGLRenderWindow * GetContext()
Definition: vtkPSurfaceLICComposite.h:65
vtkFloatArray
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:42
vtkSurfaceLICComposite::MakeDecompDisjoint
static int MakeDecompDisjoint(std::deque< vtkPixelExtent > &in, std::deque< vtkPixelExtent > &out)
Make a decomposition disjoint with respect to itself.
vtkSurfaceLICComposite::AddGuardPixels
int AddGuardPixels(const std::deque< vtkPixelExtent > &exts, std::deque< vtkPixelExtent > &guardExts, std::deque< vtkPixelExtent > &disjointGuardExts, float *vectors)
Add guard pixels (Serial run)
vtkPSurfaceLICComposite
This class decomposes the image space and shuffles image space data onto the new decomposition with t...
Definition: vtkPSurfaceLICComposite.h:53
vtkPSurfaceLICComposite::~vtkPSurfaceLICComposite
~vtkPSurfaceLICComposite()
vtkPixelExtent
Representation of a cartesian pixel plane and common operations on it.
Definition: vtkPixelExtent.h:42
vtkPSurfaceLICComposite::PrintSelf
virtual void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkSurfaceLICComposite
This class decomposes the image space and shuffles image space data onto the new decomposition with t...
Definition: vtkSurfaceLICComposite.h:40
vtkPixelExtent.h
vtkOpenGLHelper
Definition: vtkOpenGLHelper.h:31
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:40
vtkTextureObject
abstracts an OpenGL texture object.
Definition: vtkTextureObject.h:44
vtkPSurfaceLICComposite::vtkPSurfaceLICComposite
vtkPSurfaceLICComposite()
vtkWeakPointer.h
vtkPSurfaceLICComposite::SetContext
virtual void SetContext(vtkOpenGLRenderWindow *rwin)
Set the rendering context.
vtkPSurfaceLICComposite::SetCommunicator
virtual void SetCommunicator(vtkPainterCommunicator *comm)
Set the communicator for parallel communication.
vtkPainterCommunicator
A communicator that can safely be used inside a painter.
Definition: vtkPainterCommunicator.h:31
vtkPSurfaceLICComposite::Scatter
virtual int Scatter(void *pSendPBO, int dataType, int nComps, vtkTextureObject *&newImage)
Move a single buffer from the LIC decomp to the geometry decomp THIS IS A COLLECTIVE OPERATION.
operator<<
VTKRENDERINGPARALLELLIC_EXPORT ostream & operator<<(ostream &os, vtkPSurfaceLICComposite &ss)
vtkPSurfaceLICComposite::operator<<
friend VTKRENDERINGPARALLELLIC_EXPORT ostream & operator<<(ostream &os, vtkPSurfaceLICComposite &ss)
vtkShaderProgram2
GLSL Program.
Definition: vtkShaderProgram2.h:69
vtkOpenGLRenderWindow
OpenGL rendering window.
Definition: vtkOpenGLRenderWindow.h:42
vtkRenderWindow
create a window for renderers to draw into
Definition: vtkRenderWindow.h:87
vtkFrameBufferObject2
Interface to OpenGL framebuffer object.
Definition: vtkFrameBufferObject2.h:87
vtkPSurfaceLICComposite::BuildProgram
virtual int BuildProgram(float *vectors)
Build programs to move data to the new decomp THIS IS A COLLECTIVE OPERATION.
vtkPSurfaceLICComposite::Gather
virtual int Gather(void *pSendPBO, int dataType, int nComps, vtkTextureObject *&newImage)
Move a single buffer from the geometry decomp to the LIC decomp.
vtkPPixelTransfer.h
vtkWeakPointer< vtkOpenGLRenderWindow >
vtkPSurfaceLICComposite::New
static vtkPSurfaceLICComposite * New()