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;
40 class vtkTextureObject;
43 class vtkPPixelExtentOps;
44 
45 class vtkOpenGLHelper;
47 
48 class VTKRENDERINGPARALLELLIC_EXPORT vtkPSurfaceLICComposite : public vtkSurfaceLICComposite
49 {
50 public:
51  static vtkPSurfaceLICComposite *New();
53  virtual void PrintSelf(ostream &os, vtkIndent indent) override;
54 
60  virtual void SetContext(vtkOpenGLRenderWindow *rwin) override;
61  virtual vtkOpenGLRenderWindow *GetContext() override { return this->Context; }
62 
67  virtual void SetCommunicator(vtkPainterCommunicator *comm) override;
68 
73  virtual int BuildProgram(float *vectors) override;
74 
79  virtual int Gather(
80  void *pSendPBO,
81  int dataType,
82  int nComps,
83  vtkTextureObject *&newImage) override;
84 
89  virtual int Scatter(
90  void *pSendPBO,
91  int dataType,
92  int nComps,
93  vtkTextureObject *&newImage) override;
94 
95 protected:
98 
99 private:
103  int InitializeCompositeShader(vtkOpenGLRenderWindow *context);
104 
108  int ExecuteShader(const vtkPixelExtent &ext, vtkTextureObject *tex);
109 
115  double EstimateCommunicationCost(
116  const std::deque<std::deque<vtkPixelExtent> > &srcExts,
117  const std::deque<std::deque<vtkPixelExtent> > &destExts);
118 
124  double EstimateDecompEfficiency(
125  const std::deque< std::deque<vtkPixelExtent> > &exts,
126  const std::deque< std::deque<vtkPixelExtent> > &guardExts);
127 
132  int DecomposeScreenExtent(
133  std::deque< std::deque<vtkPixelExtent> >&newExts,
134  float *vectors);
135 
140  int DecomposeExtent(
141  vtkPixelExtent &in,
142  int nPieces,
143  std::list<vtkPixelExtent> &out);
144 
153  int MakeDecompDisjoint(
154  const std::deque< std::deque< vtkPixelExtent> > &in,
155  std::deque< std::deque< vtkPixelExtent> > &out,
156  float *vectors);
157 
158 
159  // decomp set of extents
160  int MakeDecompLocallyDisjoint(
161  const std::deque< std::deque< vtkPixelExtent> > &in,
162  std::deque< std::deque< vtkPixelExtent> > &out);
163 
165 
171  int AllGatherExtents(
172  const std::deque<vtkPixelExtent> &localExts,
173  std::deque<std::deque<vtkPixelExtent> > &remoteExts,
174  vtkPixelExtent &dataSetExt);
175 
179  int AllReduceVectorMax(
180  const std::deque<vtkPixelExtent> &originalExts,
181  const std::deque<std::deque<vtkPixelExtent> > &newExts,
182  float *vectors,
183  std::vector<std::vector<float> > &vectorMax);
184 
188  int AddGuardPixels(
189  const std::deque<std::deque<vtkPixelExtent> > &exts,
190  std::deque<std::deque<vtkPixelExtent> > &guardExts,
191  std::deque<std::deque<vtkPixelExtent> > &disjointGuardExts,
192  float *vectors);
193 
194 private:
195  vtkPPainterCommunicator *PainterComm; // mpi state
196  vtkPPixelExtentOps *PixelOps;
197  int CommRank;
198  int CommSize;
199 
200  vtkWeakPointer<vtkOpenGLRenderWindow> Context; // rendering context
201 
202  vtkOpenGLFramebufferObject *FBO; // Framebuffer object
203  vtkOpenGLHelper *CompositeShader;
204 
205  std::deque<vtkPPixelTransfer> GatherProgram; // ordered steps required to move data to new decomp
206  std::deque<vtkPPixelTransfer> ScatterProgram; // ordered steps required to unmove data from new decomp
207 
208  friend VTKRENDERINGPARALLELLIC_EXPORT
209  ostream &operator<<(ostream &os, vtkPSurfaceLICComposite &ss);
210 
212  void operator=(const vtkPSurfaceLICComposite&) = delete;
213 };
214 
215 VTKRENDERINGPARALLELLIC_EXPORT
216 ostream &operator<<(ostream &os, vtkPSurfaceLICComposite &ss);
217 
218 #endif
OpenGL rendering window.
static vtkSurfaceLICComposite * New()
friend ostream & operator<<(ostream &os, vtkSurfaceLICComposite &ss)
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:41
virtual void SetCommunicator(vtkPainterCommunicator *)
Set the communicator for parallel communication.
virtual int Gather(void *, int, int, vtkTextureObject *&)
Move a single buffer from the geometry decomp to the LIC decomp.
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual void SetContext(vtkOpenGLRenderWindow *)
Set the rendering context.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Internal class which encapsulates OpenGL FramebufferObject.
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.
virtual vtkOpenGLRenderWindow * GetContext() override
create a window for renderers to draw into
Representation of a cartesian pixel plane and common operations on it.
This class decomposes the image space and shuffles image space data onto the new decomposition with t...
A communicator that can safely be used inside a painter.
virtual int Scatter(void *, int, int, vtkTextureObject *&)
Move a single buffer from the LIC decomp to the geometry decomp In parallel THIS IS A COLLECTIVE OPER...
virtual int BuildProgram(float *)
Build programs to move data to the new decomp In parallel THIS IS A COLLECTIVE OPERATION.
This class decomposes the image space and shuffles image space data onto the new decomposition with t...