VTK  9.2.6
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  void PrintSelf(ostream& os, vtkIndent indent) override;
54 
60  void SetContext(vtkOpenGLRenderWindow* rwin) override;
61  vtkOpenGLRenderWindow* GetContext() override { return this->Context; }
62 
67  void SetCommunicator(vtkPainterCommunicator* comm) override;
68 
73  int BuildProgram(float* vectors) override;
74 
79  int Gather(void* pSendPBO, int dataType, int nComps, vtkTextureObject*& newImage) override;
80 
85  int Scatter(void* pSendPBO, int dataType, int nComps, vtkTextureObject*& newImage) override;
86 
87 protected:
89  ~vtkPSurfaceLICComposite() override;
90 
91 private:
95  int InitializeCompositeShader(vtkOpenGLRenderWindow* context);
96 
100  int ExecuteShader(const vtkPixelExtent& ext, vtkTextureObject* tex);
101 
107  double EstimateCommunicationCost(const std::deque<std::deque<vtkPixelExtent>>& srcExts,
108  const std::deque<std::deque<vtkPixelExtent>>& destExts);
109 
115  double EstimateDecompEfficiency(const std::deque<std::deque<vtkPixelExtent>>& exts,
116  const std::deque<std::deque<vtkPixelExtent>>& guardExts);
117 
122  int DecomposeScreenExtent(std::deque<std::deque<vtkPixelExtent>>& newExts, float* vectors);
123 
128  int DecomposeExtent(vtkPixelExtent& in, int nPieces, std::list<vtkPixelExtent>& out);
129 
138  int MakeDecompDisjoint(const std::deque<std::deque<vtkPixelExtent>>& in,
139  std::deque<std::deque<vtkPixelExtent>>& out, float* vectors);
140 
141  // decomp set of extents
142  int MakeDecompLocallyDisjoint(
143  const std::deque<std::deque<vtkPixelExtent>>& in, std::deque<std::deque<vtkPixelExtent>>& out);
144 
146 
152  int AllGatherExtents(const std::deque<vtkPixelExtent>& localExts,
153  std::deque<std::deque<vtkPixelExtent>>& remoteExts, vtkPixelExtent& dataSetExt);
154 
158  int AllReduceVectorMax(const std::deque<vtkPixelExtent>& originalExts,
159  const std::deque<std::deque<vtkPixelExtent>>& newExts, float* vectors,
160  std::vector<std::vector<float>>& vectorMax);
161 
165  int AddGuardPixels(const std::deque<std::deque<vtkPixelExtent>>& exts,
166  std::deque<std::deque<vtkPixelExtent>>& guardExts,
167  std::deque<std::deque<vtkPixelExtent>>& disjointGuardExts, float* vectors);
168 
169 private:
170  vtkPPainterCommunicator* PainterComm; // mpi state
171  vtkPPixelExtentOps* PixelOps;
172  int CommRank;
173  int CommSize;
174 
175  vtkWeakPointer<vtkOpenGLRenderWindow> Context; // rendering context
176 
177  vtkOpenGLFramebufferObject* FBO; // Framebuffer object
178  vtkOpenGLHelper* CompositeShader;
179 
180  std::deque<vtkPPixelTransfer> GatherProgram; // ordered steps required to move data to new decomp
181  std::deque<vtkPPixelTransfer>
182  ScatterProgram; // ordered steps required to unmove data from new decomp
183 
184  friend VTKRENDERINGPARALLELLIC_EXPORT ostream& operator<<(
185  ostream& os, vtkPSurfaceLICComposite& ss);
186 
188  void operator=(const vtkPSurfaceLICComposite&) = delete;
189 };
190 
191 VTKRENDERINGPARALLELLIC_EXPORT
192 ostream& operator<<(ostream& os, vtkPSurfaceLICComposite& ss);
193 
194 #endif
OpenGL rendering window.
vtkOpenGLRenderWindow * GetContext() override
static vtkSurfaceLICComposite * New()
VTKRENDERINGPARALLELLIC_EXPORT ostream & operator<<(ostream &os, vtkPSurfaceLICComposite &ss)
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.
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...