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:
44  virtual void PrintSelf(ostream &os, vtkIndent indent);
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,
94  COMPOSITE_INPLACE_DISJOINT,
95  COMPOSITE_BALANCED,
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 NULL; }
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
204  std::deque<vtkPixelExtent> &in,
205  std::deque<vtkPixelExtent> &out);
206 
207 protected:
210 
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 
236  const std::deque<vtkPixelExtent> &exts,
237  float *vectors,
238  std::vector<float> &vMax);
239 
244  const std::deque<vtkPixelExtent> &exts,
245  std::deque<vtkPixelExtent> &guardExts,
246  std::deque<vtkPixelExtent> &disjointGuardExts,
247  float *vectors);
248 
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:
285  vtkSurfaceLICComposite(const vtkSurfaceLICComposite&) VTK_DELETE_FUNCTION;
286  void operator=(const vtkSurfaceLICComposite&) VTK_DELETE_FUNCTION;
287 
288  friend
289  ostream &operator<<(ostream &os, vtkSurfaceLICComposite &ss);
290 };
291 
292 ostream &operator<<(ostream &os, vtkSurfaceLICComposite &ss);
293 
294 #endif
ostream & operator<<(ostream &os, vtkSurfaceLICComposite &ss)
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:42
a simple class to control print indentation
Definition: vtkIndent.h:40
abstract base class for most VTK objects
Definition: vtkObject.h:60
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...
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.
virtual void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
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.
float VectorMax(const vtkPixelExtent &ext, float *vectors)
Compute max(V) on the given extent.
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.
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.
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...
abstracts an OpenGL texture object.