VTK  9.3.20240328
vtkSurfaceLICComposite.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 vtkSurfaceLICComposite_h
14 #define vtkSurfaceLICComposite_h
15 
16 #include "vtkObject.h"
17 #include "vtkPixelExtent.h" // for pixel extent
18 #include "vtkRenderingLICOpenGL2Module.h" // for export macro
19 #include <deque> // for deque
20 #include <vector> // for vector
21 
22 VTK_ABI_NAMESPACE_BEGIN
23 class vtkFloatArray;
25 class vtkTextureObject;
27 
28 class VTKRENDERINGLICOPENGL2_EXPORT vtkSurfaceLICComposite : public vtkObject
29 {
30 public:
33  void PrintSelf(ostream& os, vtkIndent indent) override;
34 
42  void Initialize(const vtkPixelExtent& winExt, const std::deque<vtkPixelExtent>& blockExts,
43  int strategy, double stepSize, int nSteps, int normalizeVectors, int enhancedLIC,
44  int anitalias);
45 
75  enum
76  {
77  COMPOSITE_INPLACE = 0,
80  COMPOSITE_AUTO
81  };
82  void SetStrategy(int val) { this->Strategy = val; }
83  int GetStrategy() { return this->Strategy; }
84 
89  int GetNumberOfCompositeExtents() const { return static_cast<int>(this->CompositeExt.size()); }
90 
95  const vtkPixelExtent& GetGuardExtent(int i = 0) const { return this->GuardExt[i]; }
96 
97  const std::deque<vtkPixelExtent>& GetGuardExtents() const { return this->GuardExt; }
98 
103  const vtkPixelExtent& GetDisjointGuardExtent(int i = 0) const
104  {
105  return this->DisjointGuardExt[i];
106  }
107 
108  const std::deque<vtkPixelExtent>& GetDisjointGuardExtents() const { return this->GuardExt; }
109 
114  const vtkPixelExtent& GetCompositeExtent(int i = 0) const { return this->CompositeExt[i]; }
115 
116  const std::deque<vtkPixelExtent>& GetCompositeExtents() const { return this->CompositeExt; }
117 
121  const vtkPixelExtent& GetDataSetExtent() const { return this->DataSetExt; }
122 
126  const vtkPixelExtent& GetWindowExtent() const { return this->WindowExt; }
127 
132  int InitializeCompositeExtents(float* vectors);
133 
140  virtual vtkOpenGLRenderWindow* GetContext() { return nullptr; }
141 
149 
153  virtual void RestoreDefaultCommunicator() {}
154 
159  virtual int BuildProgram(float*) { return -1; }
160 
165  virtual int Gather(void*, int, int, vtkTextureObject*&) { return -1; }
166 
171  virtual int Scatter(void*, int, int, vtkTextureObject*&) { return -1; }
172 
178  static int MakeDecompDisjoint(std::deque<vtkPixelExtent>& in, std::deque<vtkPixelExtent>& out);
179 
180 protected:
183 
193  const std::deque<vtkPixelExtent>& in, std::deque<vtkPixelExtent>& out, float* vectors);
194 
198  float VectorMax(const vtkPixelExtent& ext, float* vectors);
199 
204  int VectorMax(const std::deque<vtkPixelExtent>& exts, float* vectors, std::vector<float>& vMax);
205 
209  int AddGuardPixels(const std::deque<vtkPixelExtent>& exts, std::deque<vtkPixelExtent>& guardExts,
210  std::deque<vtkPixelExtent>& disjointGuardExts, float* vectors);
211 
215  void GetPixelBounds(float* rgba, int ni, vtkPixelExtent& ext);
216 
222  float GetFudgeFactor(int nx[2]);
223 
224  int Pass; // id for mpi tagging
225 
226  vtkPixelExtent WindowExt; // screen extent (screen size)
227  vtkPixelExtent DataSetExt; // screen extent of the dataset
228  std::deque<vtkPixelExtent> BlockExts; // screen extents of blocks
229 
230  std::deque<vtkPixelExtent> CompositeExt; // screen extents after decomp
231  std::deque<vtkPixelExtent> GuardExt; // screen extents w/ guard cells
232  std::deque<vtkPixelExtent> DisjointGuardExt; // screen extents w/ guard cells
233 
234  int Strategy; // control for parallel composite
235 
236  double StepSize; // window coordinates step size
237  int NumberOfSteps; // number of integration steps
238  int NormalizeVectors; // does integrator normailze
239  int NumberOfGuardLevels; // 1.5 if enhanced LIC 1 otherwise
240  int NumberOfEEGuardPixels; // 1 if enhanced LIC 0 otherwise
241  int NumberOfAAGuardPixels; // n antialias passes
242 
243 private:
245  void operator=(const vtkSurfaceLICComposite&) = delete;
246 
247  friend ostream& operator<<(ostream& os, vtkSurfaceLICComposite& ss);
248 };
249 
250 ostream& operator<<(ostream& os, vtkSurfaceLICComposite& ss);
251 
252 VTK_ABI_NAMESPACE_END
253 
254 #endif
dynamic, self-adjusting array of float
a simple class to control print indentation
Definition: vtkIndent.h:108
abstract base class for most VTK objects
Definition: vtkObject.h:161
OpenGL rendering window.
A communicator that can safely be used inside a painter.
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...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
float GetFudgeFactor(int nx[2])
factor for determining extra padding for guard pixels.
const vtkPixelExtent & GetGuardExtent(int i=0) const
Get the extent of the domain over which to compute the LIC.
void GetPixelBounds(float *rgba, int ni, vtkPixelExtent &ext)
shrink pixel extent based on non-zero alpha channel values
virtual void SetContext(vtkOpenGLRenderWindow *)
Set the rendering context.
~vtkSurfaceLICComposite() override
float VectorMax(const vtkPixelExtent &ext, float *vectors)
Compute max(V) on the given extent.
std::deque< vtkPixelExtent > BlockExts
virtual void RestoreDefaultCommunicator()
Set the communicator to the default communicator.
static vtkSurfaceLICComposite * New()
int MakeDecompDisjoint(const std::deque< vtkPixelExtent > &in, std::deque< vtkPixelExtent > &out, float *vectors)
For serial run.
std::deque< vtkPixelExtent > DisjointGuardExt
int AddGuardPixels(const std::deque< vtkPixelExtent > &exts, std::deque< vtkPixelExtent > &guardExts, std::deque< vtkPixelExtent > &disjointGuardExts, float *vectors)
Add guard pixels (Serial run)
int GetNumberOfCompositeExtents() const
Get the number of new extents assigned to this rank after the decomposition.
const std::deque< vtkPixelExtent > & GetGuardExtents() const
const vtkPixelExtent & GetWindowExtent() const
Get the whole window extent.
virtual int Gather(void *, int, int, vtkTextureObject *&)
Move a single buffer from the geometry decomp to the LIC decomp.
int VectorMax(const std::deque< vtkPixelExtent > &exts, float *vectors, std::vector< float > &vMax)
Compute max(V) on a set of extents.
const vtkPixelExtent & GetDisjointGuardExtent(int i=0) const
Get the extent of the domain over which to compute the LIC.
virtual vtkOpenGLRenderWindow * GetContext()
friend ostream & operator<<(ostream &os, vtkSurfaceLICComposite &ss)
const std::deque< vtkPixelExtent > & GetCompositeExtents() const
static int MakeDecompDisjoint(std::deque< vtkPixelExtent > &in, std::deque< vtkPixelExtent > &out)
Make a decomposition disjoint with respect to itself.
int InitializeCompositeExtents(float *vectors)
Set up for a serial run, makes the decomp disjoint and adds requisite guard pixles.
virtual void SetCommunicator(vtkPainterCommunicator *)
Set the communicator for parallel communication.
std::deque< vtkPixelExtent > CompositeExt
const std::deque< vtkPixelExtent > & GetDisjointGuardExtents() const
const vtkPixelExtent & GetCompositeExtent(int i=0) const
Get the extent of the domain over which to compute the LIC.
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...
const vtkPixelExtent & GetDataSetExtent() const
Get the whole dataset extent (all blocks).
virtual int BuildProgram(float *)
Build programs to move data to the new decomp In parallel THIS IS A COLLECTIVE OPERATION.
void Initialize(const vtkPixelExtent &winExt, const std::deque< vtkPixelExtent > &blockExts, int strategy, double stepSize, int nSteps, int normalizeVectors, int enhancedLIC, int anitalias)
Initialize the object based on the following description of the blocks projected onto the render wind...
std::deque< vtkPixelExtent > GuardExt
abstracts an OpenGL texture object.
ostream & operator<<(ostream &os, vtkSurfaceLICComposite &ss)