VTK
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 "vtkRenderingLICOpenGL2Module.h" // for export macro
30 #include "vtkPixelExtent.h" // for pixel extent
31 #include <deque> // for deque
32 #include <vector> // for vector
33 
34 class vtkFloatArray;
36 class vtkTextureObject;
38 
39 class VTKRENDERINGLICOPENGL2_EXPORT vtkSurfaceLICComposite : public vtkObject
40 {
41 public:
42  static vtkSurfaceLICComposite *New();
44  void PrintSelf(ostream &os, vtkIndent indent) override;
45 
53  void Initialize(
54  const vtkPixelExtent &winExt,
55  const std::deque<vtkPixelExtent> &blockExts,
56  int strategy,
57  double stepSize,
58  int nSteps,
59  int normalizeVectors,
60  int enhancedLIC,
61  int anitalias);
62 
92  enum {
93  COMPOSITE_INPLACE=0,
96  COMPOSITE_AUTO
97  };
98  void SetStrategy(int val){ this->Strategy = val; }
99  int GetStrategy(){ return this->Strategy; }
100 
106  { return static_cast<int>(this->CompositeExt.size()); }
107 
112  const vtkPixelExtent &GetGuardExtent(int i=0) const
113  { return this->GuardExt[i]; }
114 
115  const std::deque<vtkPixelExtent> &GetGuardExtents() const
116  { return this->GuardExt; }
117 
123  { return this->DisjointGuardExt[i]; }
124 
125  const std::deque<vtkPixelExtent> &GetDisjointGuardExtents() const
126  { return this->GuardExt; }
127 
132  const vtkPixelExtent &GetCompositeExtent(int i=0) const
133  { return this->CompositeExt[i]; }
134 
135  const std::deque<vtkPixelExtent> &GetCompositeExtents() const
136  { return this->CompositeExt; }
137 
142  { return this->DataSetExt; }
143 
148  { return this->WindowExt; }
149 
154  int InitializeCompositeExtents(float *vectors);
155 
162  virtual vtkOpenGLRenderWindow *GetContext(){ return nullptr; }
163 
171 
175  virtual void RestoreDefaultCommunicator(){}
176 
181  virtual int BuildProgram(float*){ return -1; }
182 
187  virtual int Gather(void *, int, int, vtkTextureObject *&)
188  { return -1; }
189 
194  virtual int Scatter(void *, int, int, vtkTextureObject *&)
195  { return -1; }
196 
202  static
203  int MakeDecompDisjoint(
204  std::deque<vtkPixelExtent> &in,
205  std::deque<vtkPixelExtent> &out);
206 
207 protected:
209  ~vtkSurfaceLICComposite() override;
210 
219  int MakeDecompDisjoint(
220  const std::deque<vtkPixelExtent> &in,
221  std::deque<vtkPixelExtent> &out,
222  float *vectors);
223 
227  float VectorMax(
228  const vtkPixelExtent &ext,
229  float *vectors);
230 
235  int VectorMax(
236  const std::deque<vtkPixelExtent> &exts,
237  float *vectors,
238  std::vector<float> &vMax);
239 
243  int AddGuardPixels(
244  const std::deque<vtkPixelExtent> &exts,
245  std::deque<vtkPixelExtent> &guardExts,
246  std::deque<vtkPixelExtent> &disjointGuardExts,
247  float *vectors);
248 
252  void GetPixelBounds(
253  float *rgba,
254  int ni,
255  vtkPixelExtent &ext);
256 
262  float GetFudgeFactor(int nx[2]);
263 
264 protected:
265  int Pass; // id for mpi tagging
266 
267  vtkPixelExtent WindowExt; // screen extent (screen size)
268  vtkPixelExtent DataSetExt; // screen extent of the dataset
269  std::deque<vtkPixelExtent> BlockExts; // screen extents of blocks
270 
271  std::deque<vtkPixelExtent> CompositeExt; // screen extents after decomp
272  std::deque<vtkPixelExtent> GuardExt; // screen extents w/ guard cells
273  std::deque<vtkPixelExtent> DisjointGuardExt; // screen extents w/ guard cells
274 
275  int Strategy; // control for parallel composite
276 
277  double StepSize; // window coordinates step size
278  int NumberOfSteps; // number of integration steps
279  int NormalizeVectors; // does integrator normailze
280  int NumberOfGuardLevels; // 1.5 if enhanced LIC 1 otherwise
281  int NumberOfEEGuardPixels; // 1 if enhanced LIC 0 otherwise
282  int NumberOfAAGuardPixels; // n antialias passes
283 
284 private:
286  void operator=(const vtkSurfaceLICComposite&) = delete;
287 
288  friend
289  ostream &operator<<(ostream &os, vtkSurfaceLICComposite &ss);
290 };
291 
292 ostream &operator<<(ostream &os, vtkSurfaceLICComposite &ss);
293 
294 #endif
OpenGL rendering window.
std::deque< vtkPixelExtent > DisjointGuardExt
abstract base class for most VTK objects
Definition: vtkObject.h:59
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
std::deque< vtkPixelExtent > CompositeExt
std::deque< vtkPixelExtent > GuardExt
const vtkPixelExtent & GetGuardExtent(int i=0) const
Get the extent of the domain over which to compute the LIC.
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:41
virtual vtkOpenGLRenderWindow * GetContext()
const std::deque< vtkPixelExtent > & GetGuardExtents() const
const vtkPixelExtent & GetDisjointGuardExtent(int i=0) const
Get the extent of the domain over which to compute the LIC.
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.
const std::deque< vtkPixelExtent > & GetCompositeExtents() const
const vtkPixelExtent & GetWindowExtent() const
Get the whole window extent.
const std::deque< vtkPixelExtent > & GetDisjointGuardExtents() const
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual void SetContext(vtkOpenGLRenderWindow *)
Set the rendering context.
std::deque< vtkPixelExtent > BlockExts
abstracts an OpenGL texture object.
const vtkPixelExtent & GetDataSetExtent() const
Get the whole dataset extent (all blocks).
Representation of a cartesian pixel plane and common operations on it.
const vtkPixelExtent & GetCompositeExtent(int i=0) const
Get the extent of the domain over which to compute the LIC.
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...
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
virtual void RestoreDefaultCommunicator()
Set the communicator to the default communicator.
friend VTKCOMMONCORE_EXPORT ostream & operator<<(ostream &os, vtkObjectBase &o)
int GetNumberOfCompositeExtents() const
Get the number of new extents assigned to this rank after the decomposition.