VTK  9.0.1
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:
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, 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:
91  ~vtkPSurfaceLICComposite() override;
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
vtkPPainterCommunicator
Definition: vtkPPainterCommunicator.h:35
vtkX3D::vector
@ vector
Definition: vtkX3D.h:243
vtkSurfaceLICComposite::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSurfaceLICComposite.h
vtkSurfaceLICComposite::SetContext
virtual void SetContext(vtkOpenGLRenderWindow *)
Set the rendering context.
Definition: vtkSurfaceLICComposite.h:150
vtkFloatArray
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:35
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)
vtkOpenGLFramebufferObject
Internal class which encapsulates OpenGL FramebufferObject.
Definition: vtkOpenGLFramebufferObject.h:181
vtkSurfaceLICComposite::Scatter
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...
Definition: vtkSurfaceLICComposite.h:182
vtkPSurfaceLICComposite
Definition: vtkPSurfaceLICComposite.h:48
vtkPixelExtent
Definition: vtkPixelExtent.h:38
vtkSurfaceLICComposite::BuildProgram
virtual int BuildProgram(float *)
Build programs to move data to the new decomp In parallel THIS IS A COLLECTIVE OPERATION.
Definition: vtkSurfaceLICComposite.h:170
vtkSurfaceLICComposite
Definition: vtkSurfaceLICComposite.h:39
vtkPixelExtent.h
vtkOpenGLHelper
Definition: vtkOpenGLHelper.h:30
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkTextureObject
abstracts an OpenGL texture object.
Definition: vtkTextureObject.h:40
vtkWeakPointer.h
vtkSurfaceLICComposite::operator<<
friend ostream & operator<<(ostream &os, vtkSurfaceLICComposite &ss)
vtkPainterCommunicator
A communicator that can safely be used inside a painter.
Definition: vtkPainterCommunicator.h:30
operator<<
VTKRENDERINGPARALLELLIC_EXPORT ostream & operator<<(ostream &os, vtkPSurfaceLICComposite &ss)
vtkSurfaceLICComposite::New
static vtkSurfaceLICComposite * New()
vtkOpenGLRenderWindow
OpenGL rendering window.
Definition: vtkOpenGLRenderWindow.h:51
vtkPSurfaceLICComposite::GetContext
virtual vtkOpenGLRenderWindow * GetContext() override
Definition: vtkPSurfaceLICComposite.h:61
vtkRenderWindow
create a window for renderers to draw into
Definition: vtkRenderWindow.h:93
vtkPPixelTransfer.h
vtkWeakPointer< vtkOpenGLRenderWindow >
vtkSurfaceLICComposite::Gather
virtual int Gather(void *, int, int, vtkTextureObject *&)
Move a single buffer from the geometry decomp to the LIC decomp.
Definition: vtkSurfaceLICComposite.h:176
vtkOpenGLRenderWindow.h
vtkSurfaceLICComposite::SetCommunicator
virtual void SetCommunicator(vtkPainterCommunicator *)
Set the communicator for parallel communication.
Definition: vtkSurfaceLICComposite.h:159