VTK  9.2.20230527
vtkSurfaceLICComposite.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSurfaceLICComposite.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 vtkSurfaceLICComposite_h
26 #define vtkSurfaceLICComposite_h
27 
28 #include "vtkObject.h"
29 #include "vtkPixelExtent.h" // for pixel extent
30 #include "vtkRenderingLICOpenGL2Module.h" // for export macro
31 #include <deque> // for deque
32 #include <vector> // for vector
33 
34 VTK_ABI_NAMESPACE_BEGIN
35 class vtkFloatArray;
37 class vtkTextureObject;
39 
40 class VTKRENDERINGLICOPENGL2_EXPORT vtkSurfaceLICComposite : public vtkObject
41 {
42 public:
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
54  void Initialize(const vtkPixelExtent& winExt, const std::deque<vtkPixelExtent>& blockExts,
55  int strategy, double stepSize, int nSteps, int normalizeVectors, int enhancedLIC,
56  int anitalias);
57 
87  enum
88  {
89  COMPOSITE_INPLACE = 0,
92  COMPOSITE_AUTO
93  };
94  void SetStrategy(int val) { this->Strategy = val; }
95  int GetStrategy() { return this->Strategy; }
96 
101  int GetNumberOfCompositeExtents() const { return static_cast<int>(this->CompositeExt.size()); }
102 
107  const vtkPixelExtent& GetGuardExtent(int i = 0) const { return this->GuardExt[i]; }
108 
109  const std::deque<vtkPixelExtent>& GetGuardExtents() const { return this->GuardExt; }
110 
115  const vtkPixelExtent& GetDisjointGuardExtent(int i = 0) const
116  {
117  return this->DisjointGuardExt[i];
118  }
119 
120  const std::deque<vtkPixelExtent>& GetDisjointGuardExtents() const { return this->GuardExt; }
121 
126  const vtkPixelExtent& GetCompositeExtent(int i = 0) const { return this->CompositeExt[i]; }
127 
128  const std::deque<vtkPixelExtent>& GetCompositeExtents() const { return this->CompositeExt; }
129 
133  const vtkPixelExtent& GetDataSetExtent() const { return this->DataSetExt; }
134 
138  const vtkPixelExtent& GetWindowExtent() const { return this->WindowExt; }
139 
144  int InitializeCompositeExtents(float* vectors);
145 
152  virtual vtkOpenGLRenderWindow* GetContext() { return nullptr; }
153 
161 
165  virtual void RestoreDefaultCommunicator() {}
166 
171  virtual int BuildProgram(float*) { return -1; }
172 
177  virtual int Gather(void*, int, int, vtkTextureObject*&) { return -1; }
178 
183  virtual int Scatter(void*, int, int, vtkTextureObject*&) { return -1; }
184 
190  static int MakeDecompDisjoint(std::deque<vtkPixelExtent>& in, std::deque<vtkPixelExtent>& out);
191 
192 protected:
195 
205  const std::deque<vtkPixelExtent>& in, std::deque<vtkPixelExtent>& out, float* vectors);
206 
210  float VectorMax(const vtkPixelExtent& ext, float* vectors);
211 
216  int VectorMax(const std::deque<vtkPixelExtent>& exts, float* vectors, std::vector<float>& vMax);
217 
221  int AddGuardPixels(const std::deque<vtkPixelExtent>& exts, std::deque<vtkPixelExtent>& guardExts,
222  std::deque<vtkPixelExtent>& disjointGuardExts, float* vectors);
223 
227  void GetPixelBounds(float* rgba, int ni, vtkPixelExtent& ext);
228 
234  float GetFudgeFactor(int nx[2]);
235 
236  int Pass; // id for mpi tagging
237 
238  vtkPixelExtent WindowExt; // screen extent (screen size)
239  vtkPixelExtent DataSetExt; // screen extent of the dataset
240  std::deque<vtkPixelExtent> BlockExts; // screen extents of blocks
241 
242  std::deque<vtkPixelExtent> CompositeExt; // screen extents after decomp
243  std::deque<vtkPixelExtent> GuardExt; // screen extents w/ guard cells
244  std::deque<vtkPixelExtent> DisjointGuardExt; // screen extents w/ guard cells
245 
246  int Strategy; // control for parallel composite
247 
248  double StepSize; // window coordinates step size
249  int NumberOfSteps; // number of integration steps
250  int NormalizeVectors; // does integrator normailze
251  int NumberOfGuardLevels; // 1.5 if enhanced LIC 1 otherwise
252  int NumberOfEEGuardPixels; // 1 if enhanced LIC 0 otherwise
253  int NumberOfAAGuardPixels; // n antialias passes
254 
255 private:
257  void operator=(const vtkSurfaceLICComposite&) = delete;
258 
259  friend ostream& operator<<(ostream& os, vtkSurfaceLICComposite& ss);
260 };
261 
262 ostream& operator<<(ostream& os, vtkSurfaceLICComposite& ss);
263 
264 VTK_ABI_NAMESPACE_END
265 
266 #endif
dynamic, self-adjusting array of float
a simple class to control print indentation
Definition: vtkIndent.h:120
abstract base class for most VTK objects
Definition: vtkObject.h:83
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)