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
38class vtkFloatArray;
39class vtkRenderWindow;
44class vtkPPixelExtentOps;
45
46#ifdef VTK_OPENGL2
47class vtkOpenGLHelper;
48#else
50#endif
51
52class VTKRENDERINGPARALLELLIC_EXPORT vtkPSurfaceLICComposite : public vtkSurfaceLICComposite
53{
54public:
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
99protected:
102
103private:
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
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
198private:
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
223VTKRENDERINGPARALLELLIC_EXPORT
224ostream &operator<<(ostream &os, vtkPSurfaceLICComposite &ss);
225
226#endif
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:42
Interface to OpenGL framebuffer object.
a simple class to control print indentation
Definition: vtkIndent.h:40
OpenGL rendering window.
This class decomposes the image space and shuffles image space data onto the new decomposition with t...
virtual void SetContext(vtkOpenGLRenderWindow *rwin)
Set the rendering context.
virtual int Gather(void *pSendPBO, int dataType, int nComps, vtkTextureObject *&newImage)
Move a single buffer from the geometry decomp to the LIC decomp.
virtual void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
virtual vtkOpenGLRenderWindow * GetContext()
virtual void SetCommunicator(vtkPainterCommunicator *comm)
Set the communicator for parallel communication.
static vtkPSurfaceLICComposite * New()
friend VTKRENDERINGPARALLELLIC_EXPORT ostream & operator<<(ostream &os, vtkPSurfaceLICComposite &ss)
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.
virtual int BuildProgram(float *vectors)
Build programs to move data to the new decomp THIS IS A COLLECTIVE OPERATION.
A communicator that can safely be used inside a painter.
Representation of a cartesian pixel plane and common operations on it.
create a window for renderers to draw into
This class decomposes the image space and shuffles image space data onto the new decomposition with t...
int AddGuardPixels(const std::deque< vtkPixelExtent > &exts, std::deque< vtkPixelExtent > &guardExts, std::deque< vtkPixelExtent > &disjointGuardExts, float *vectors)
Add guard pixels (Serial run)
static int MakeDecompDisjoint(std::deque< vtkPixelExtent > &in, std::deque< vtkPixelExtent > &out)
Make a decomposition disjoint with respect to itself.
abstracts an OpenGL texture object.
@ vector
Definition: vtkX3D.h:237
VTKRENDERINGPARALLELLIC_EXPORT ostream & operator<<(ostream &os, vtkPSurfaceLICComposite &ss)