VTK: Rendering/ParallelLIC/vtkPSurfaceLICComposite.h Source File

| VTK 9.3.1

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;
30 class vtkPainterCommunicator;
31 class vtkPPainterCommunicator;
32 class vtkPPixelExtentOps;
33
34 class vtkOpenGLHelper;
35 class vtkOpenGLFramebufferObject;
36
37 class VTKRENDERINGPARALLELLIC_EXPORT vtkPSurfaceLICComposite : public vtkSurfaceLICComposite
38 {
39 public:
40 static vtkPSurfaceLICComposite* New();
41 vtkTypeMacro(vtkPSurfaceLICComposite, vtkSurfaceLICComposite);
42 void PrintSelf(ostream& os, vtkIndent indent) override;
43
49 void SetContext(vtkOpenGLRenderWindow* rwin) override;
50 vtkOpenGLRenderWindow* GetContext() override { return this->Context; }
51
56 void SetCommunicator(vtkPainterCommunicator* comm) override;
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:
77 vtkPSurfaceLICComposite();
78 ~vtkPSurfaceLICComposite() override;
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
134 using vtkSurfaceLICComposite::MakeDecompDisjoint;
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
175 vtkPSurfaceLICComposite(const vtkPSurfaceLICComposite&) = delete;
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
vtkFloatArray
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:40
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:38
vtkOpenGLFramebufferObject
Internal class which encapsulates OpenGL FramebufferObject.
Definition: vtkOpenGLFramebufferObject.h:174
vtkOpenGLHelper
Definition: vtkOpenGLHelper.h:21
vtkOpenGLRenderWindow
OpenGL rendering window.
Definition: vtkOpenGLRenderWindow.h:53
vtkPPainterCommunicator
Definition: vtkPPainterCommunicator.h:25
vtkPSurfaceLICComposite
This class decomposes the image space and shuffles image space data onto the new decomposition with t...
Definition: vtkPSurfaceLICComposite.h:38
vtkPSurfaceLICComposite::GetContext
vtkOpenGLRenderWindow * GetContext() override
Definition: vtkPSurfaceLICComposite.h:50
vtkPSurfaceLICComposite::~vtkPSurfaceLICComposite
~vtkPSurfaceLICComposite() override
vtkPSurfaceLICComposite::Gather
int Gather(void *pSendPBO, int dataType, int nComps, vtkTextureObject *&newImage) override
Move a single buffer from the geometry decomp to the LIC decomp.
vtkPSurfaceLICComposite::SetCommunicator
void SetCommunicator(vtkPainterCommunicator *comm) override
Set the communicator for parallel communication.
vtkPSurfaceLICComposite::SetContext
void SetContext(vtkOpenGLRenderWindow *rwin) override
Set the rendering context.
vtkPSurfaceLICComposite::BuildProgram
int BuildProgram(float *vectors) override
Build programs to move data to the new decomp THIS IS A COLLECTIVE OPERATION.
vtkPSurfaceLICComposite::vtkPSurfaceLICComposite
vtkPSurfaceLICComposite()
vtkPSurfaceLICComposite::Scatter
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.
vtkPSurfaceLICComposite::New
static vtkPSurfaceLICComposite * New()
vtkPSurfaceLICComposite::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkPSurfaceLICComposite::operator<<
friend VTKRENDERINGPARALLELLIC_EXPORT ostream & operator<<(ostream &os, vtkPSurfaceLICComposite &ss)
vtkPainterCommunicator
A communicator that can safely be used inside a painter.
Definition: vtkPainterCommunicator.h:20
vtkPixelExtent
Representation of a cartesian pixel plane and common operations on it.
Definition: vtkPixelExtent.h:31
vtkRenderWindow
create a window for renderers to draw into
Definition: vtkRenderWindow.h:95
vtkSurfaceLICComposite
This class decomposes the image space and shuffles image space data onto the new decomposition with t...
Definition: vtkSurfaceLICComposite.h:29
vtkSurfaceLICComposite::AddGuardPixels
int AddGuardPixels(const std::deque< vtkPixelExtent > &exts, std::deque< vtkPixelExtent > &guardExts, std::deque< vtkPixelExtent > &disjointGuardExts, float *vectors)
Add guard pixels (Serial run)
vtkSurfaceLICComposite::MakeDecompDisjoint
static int MakeDecompDisjoint(std::deque< vtkPixelExtent > &in, std::deque< vtkPixelExtent > &out)
Make a decomposition disjoint with respect to itself.
vtkTextureObject
abstracts an OpenGL texture object.
Definition: vtkTextureObject.h:33
vtkWeakPointer< vtkOpenGLRenderWindow >
vtkX3D::vector
@ vector
Definition: vtkX3D.h:237
vtkOpenGLRenderWindow.h
vtkPPixelTransfer.h
operator<<
VTKRENDERINGPARALLELLIC_EXPORT ostream & operator<<(ostream &os, vtkPSurfaceLICComposite &ss)
vtkPixelExtent.h
vtkSurfaceLICComposite.h
vtkWeakPointer.h