VTK  9.0.2
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 "vtkOpenGLRenderWindow.h" // for context
29 #include "vtkPPixelTransfer.h" // for pixel transfer
30 #include "vtkPixelExtent.h" // for pixel extent
31 #include "vtkRenderingParallelLICModule.h" // for export macro
32 #include "vtkSurfaceLICComposite.h"
33 #include "vtkWeakPointer.h" // for ren context
34 #include <deque> // for deque
35 #include <list> // for list
36 #include <vector> // for vector
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:
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, int dataType, int nComps, vtkTextureObject*& newImage) override;
81 
86  virtual int Scatter(
87  void* pSendPBO, int dataType, int nComps, vtkTextureObject*& newImage) override;
88 
89 protected:
92 
93 private:
97  int InitializeCompositeShader(vtkOpenGLRenderWindow* context);
98 
102  int ExecuteShader(const vtkPixelExtent& ext, vtkTextureObject* tex);
103 
109  double EstimateCommunicationCost(const std::deque<std::deque<vtkPixelExtent> >& srcExts,
110  const std::deque<std::deque<vtkPixelExtent> >& destExts);
111 
117  double EstimateDecompEfficiency(const std::deque<std::deque<vtkPixelExtent> >& exts,
118  const std::deque<std::deque<vtkPixelExtent> >& guardExts);
119 
124  int DecomposeScreenExtent(std::deque<std::deque<vtkPixelExtent> >& newExts, float* vectors);
125 
130  int DecomposeExtent(vtkPixelExtent& in, int nPieces, std::list<vtkPixelExtent>& out);
131 
140  int MakeDecompDisjoint(const std::deque<std::deque<vtkPixelExtent> >& in,
141  std::deque<std::deque<vtkPixelExtent> >& out, float* vectors);
142 
143  // decomp set of extents
144  int MakeDecompLocallyDisjoint(const std::deque<std::deque<vtkPixelExtent> >& in,
145  std::deque<std::deque<vtkPixelExtent> >& out);
146 
148 
154  int AllGatherExtents(const std::deque<vtkPixelExtent>& localExts,
155  std::deque<std::deque<vtkPixelExtent> >& remoteExts, vtkPixelExtent& dataSetExt);
156 
160  int AllReduceVectorMax(const std::deque<vtkPixelExtent>& originalExts,
161  const std::deque<std::deque<vtkPixelExtent> >& newExts, float* vectors,
162  std::vector<std::vector<float> >& vectorMax);
163 
167  int AddGuardPixels(const std::deque<std::deque<vtkPixelExtent> >& exts,
168  std::deque<std::deque<vtkPixelExtent> >& guardExts,
169  std::deque<std::deque<vtkPixelExtent> >& disjointGuardExts, float* vectors);
170 
171 private:
172  vtkPPainterCommunicator* PainterComm; // mpi state
173  vtkPPixelExtentOps* PixelOps;
174  int CommRank;
175  int CommSize;
176 
177  vtkWeakPointer<vtkOpenGLRenderWindow> Context; // rendering context
178 
179  vtkOpenGLFramebufferObject* FBO; // Framebuffer object
180  vtkOpenGLHelper* CompositeShader;
181 
182  std::deque<vtkPPixelTransfer> GatherProgram; // ordered steps required to move data to new decomp
183  std::deque<vtkPPixelTransfer>
184  ScatterProgram; // ordered steps required to unmove data from new decomp
185 
186  friend VTKRENDERINGPARALLELLIC_EXPORT ostream& operator<<(
187  ostream& os, vtkPSurfaceLICComposite& ss);
188 
190  void operator=(const vtkPSurfaceLICComposite&) = delete;
191 };
192 
193 VTKRENDERINGPARALLELLIC_EXPORT
194 ostream& operator<<(ostream& os, vtkPSurfaceLICComposite& ss);
195 
196 #endif
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:36
a simple class to control print indentation
Definition: vtkIndent.h:34
Internal class which encapsulates OpenGL FramebufferObject.
OpenGL rendering window.
This class decomposes the image space and shuffles image space data onto the new decomposition with t...
virtual int Scatter(void *pSendPBO, int dataType, int nComps, vtkTextureObject *&newImage) override
Move a single buffer from the LIC decomp to the geometry decomp THIS IS A COLLECTIVE OPERATION.
virtual vtkOpenGLRenderWindow * GetContext() override
~vtkPSurfaceLICComposite() override
virtual void SetContext(vtkOpenGLRenderWindow *rwin) override
Set the rendering context.
virtual void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual int Gather(void *pSendPBO, int dataType, int nComps, vtkTextureObject *&newImage) override
Move a single buffer from the geometry decomp to the LIC decomp.
virtual int BuildProgram(float *vectors) override
Build programs to move data to the new decomp THIS IS A COLLECTIVE OPERATION.
static vtkPSurfaceLICComposite * New()
friend VTKRENDERINGPARALLELLIC_EXPORT ostream & operator<<(ostream &os, vtkPSurfaceLICComposite &ss)
virtual void SetCommunicator(vtkPainterCommunicator *comm) override
Set the communicator for parallel communication.
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:243
VTKRENDERINGPARALLELLIC_EXPORT ostream & operator<<(ostream &os, vtkPSurfaceLICComposite &ss)