VTK  9.3.0
vtkPSurfaceLICComposite.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
13 #ifndef vtkPSurfaceLICComposite_h
14 #define vtkPSurfaceLICComposite_h
15 
16 #include "vtkOpenGLRenderWindow.h" // for context
17 #include "vtkPPixelTransfer.h" // for pixel transfer
18 #include "vtkPixelExtent.h" // for pixel extent
19 #include "vtkRenderingParallelLICModule.h" // for export macro
20 #include "vtkSurfaceLICComposite.h"
21 #include "vtkWeakPointer.h" // for ren context
22 #include <deque> // for deque
23 #include <list> // for list
24 #include <vector> // for vector
25 
26 VTK_ABI_NAMESPACE_BEGIN
27 class vtkFloatArray;
28 class vtkRenderWindow;
29 class vtkTextureObject;
32 class vtkPPixelExtentOps;
33 
34 class vtkOpenGLHelper;
36 
37 class VTKRENDERINGPARALLELLIC_EXPORT vtkPSurfaceLICComposite : public vtkSurfaceLICComposite
38 {
39 public:
42  void PrintSelf(ostream& os, vtkIndent indent) override;
43 
49  void SetContext(vtkOpenGLRenderWindow* rwin) override;
50  vtkOpenGLRenderWindow* GetContext() override { return this->Context; }
51 
57 
62  int BuildProgram(float* vectors) override;
63 
68  int Gather(void* pSendPBO, int dataType, int nComps, vtkTextureObject*& newImage) override;
69 
74  int Scatter(void* pSendPBO, int dataType, int nComps, vtkTextureObject*& newImage) override;
75 
76 protected:
79 
80 private:
84  int InitializeCompositeShader(vtkOpenGLRenderWindow* context);
85 
89  int ExecuteShader(const vtkPixelExtent& ext, vtkTextureObject* tex);
90 
96  double EstimateCommunicationCost(const std::deque<std::deque<vtkPixelExtent>>& srcExts,
97  const std::deque<std::deque<vtkPixelExtent>>& destExts);
98 
104  double EstimateDecompEfficiency(const std::deque<std::deque<vtkPixelExtent>>& exts,
105  const std::deque<std::deque<vtkPixelExtent>>& guardExts);
106 
111  int DecomposeScreenExtent(std::deque<std::deque<vtkPixelExtent>>& newExts, float* vectors);
112 
117  int DecomposeExtent(vtkPixelExtent& in, int nPieces, std::list<vtkPixelExtent>& out);
118 
127  int MakeDecompDisjoint(const std::deque<std::deque<vtkPixelExtent>>& in,
128  std::deque<std::deque<vtkPixelExtent>>& out, float* vectors);
129 
130  // decomp set of extents
131  int MakeDecompLocallyDisjoint(
132  const std::deque<std::deque<vtkPixelExtent>>& in, std::deque<std::deque<vtkPixelExtent>>& out);
133 
135 
141  int AllGatherExtents(const std::deque<vtkPixelExtent>& localExts,
142  std::deque<std::deque<vtkPixelExtent>>& remoteExts, vtkPixelExtent& dataSetExt);
143 
147  int AllReduceVectorMax(const std::deque<vtkPixelExtent>& originalExts,
148  const std::deque<std::deque<vtkPixelExtent>>& newExts, float* vectors,
149  std::vector<std::vector<float>>& vectorMax);
150 
154  int AddGuardPixels(const std::deque<std::deque<vtkPixelExtent>>& exts,
155  std::deque<std::deque<vtkPixelExtent>>& guardExts,
156  std::deque<std::deque<vtkPixelExtent>>& disjointGuardExts, float* vectors);
157 
158  vtkPPainterCommunicator* PainterComm; // mpi state
159  vtkPPixelExtentOps* PixelOps;
160  int CommRank;
161  int CommSize;
162 
163  vtkWeakPointer<vtkOpenGLRenderWindow> Context; // rendering context
164 
165  vtkOpenGLFramebufferObject* FBO; // Framebuffer object
166  vtkOpenGLHelper* CompositeShader;
167 
168  std::deque<vtkPPixelTransfer> GatherProgram; // ordered steps required to move data to new decomp
169  std::deque<vtkPPixelTransfer>
170  ScatterProgram; // ordered steps required to unmove data from new decomp
171 
172  friend VTKRENDERINGPARALLELLIC_EXPORT ostream& operator<<(
173  ostream& os, vtkPSurfaceLICComposite& ss);
174 
176  void operator=(const vtkPSurfaceLICComposite&) = delete;
177 };
178 
179 VTKRENDERINGPARALLELLIC_EXPORT
180 ostream& operator<<(ostream& os, vtkPSurfaceLICComposite& ss);
181 
182 VTK_ABI_NAMESPACE_END
183 #endif
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:31
a simple class to control print indentation
Definition: vtkIndent.h:29
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...
vtkOpenGLRenderWindow * GetContext() override
~vtkPSurfaceLICComposite() override
int Gather(void *pSendPBO, int dataType, int nComps, vtkTextureObject *&newImage) override
Move a single buffer from the geometry decomp to the LIC decomp.
void SetCommunicator(vtkPainterCommunicator *comm) override
Set the communicator for parallel communication.
void SetContext(vtkOpenGLRenderWindow *rwin) override
Set the rendering context.
int BuildProgram(float *vectors) override
Build programs to move data to the new decomp THIS IS A COLLECTIVE OPERATION.
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.
static vtkPSurfaceLICComposite * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
friend VTKRENDERINGPARALLELLIC_EXPORT ostream & operator<<(ostream &os, vtkPSurfaceLICComposite &ss)
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)