VTK
vtkRandomAttributeGenerator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkRandomAttributeGenerator.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 =========================================================================*/
53 #ifndef vtkRandomAttributeGenerator_h
54 #define vtkRandomAttributeGenerator_h
55 
56 #include "vtkFiltersGeneralModule.h" // For export macro
58 
59 class vtkDataSet;
61 
62 class VTKFILTERSGENERAL_EXPORT vtkRandomAttributeGenerator : public vtkPassInputTypeAlgorithm
63 {
64 public:
69 
71  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
72 
74 
78  vtkSetMacro(DataType,int);
79  void SetDataTypeToBit() {this->SetDataType(VTK_BIT);}
80  void SetDataTypeToChar() {this->SetDataType(VTK_CHAR);}
81  void SetDataTypeToUnsignedChar() {this->SetDataType(VTK_UNSIGNED_CHAR);}
82  void SetDataTypeToShort() {this->SetDataType(VTK_SHORT);}
83  void SetDataTypeToUnsignedShort() {this->SetDataType(VTK_UNSIGNED_SHORT);}
84  void SetDataTypeToInt() {this->SetDataType(VTK_INT);}
85  void SetDataTypeToUnsignedInt() {this->SetDataType(VTK_UNSIGNED_INT);}
86  void SetDataTypeToLong() {this->SetDataType(VTK_LONG);}
87  void SetDataTypeToUnsignedLong() {this->SetDataType(VTK_UNSIGNED_LONG);}
88  void SetDataTypeToFloat() {this->SetDataType(VTK_FLOAT);}
89  void SetDataTypeToDouble() {this->SetDataType(VTK_DOUBLE);}
90  vtkGetMacro(DataType,int);
92 
94 
100  vtkSetClampMacro(NumberOfComponents,int,1,VTK_INT_MAX);
101  vtkGetMacro(NumberOfComponents,int);
103 
105 
110  vtkSetMacro(MinimumComponentValue,double);
111  vtkGetMacro(MinimumComponentValue,double);
112  void SetComponentRange (double minimumValue, double maximumValue)
113  {
114  this->SetMinimumComponentValue (minimumValue);
115  this->SetMaximumComponentValue (maximumValue);
116  }
118 
120 
125  vtkSetMacro(MaximumComponentValue,double);
126  vtkGetMacro(MaximumComponentValue,double);
128 
130 
135  vtkSetClampMacro(NumberOfTuples,vtkIdType,0,VTK_INT_MAX);
136  vtkGetMacro(NumberOfTuples,vtkIdType);
138 
140 
144  vtkSetMacro(GeneratePointScalars,int);
145  vtkGetMacro(GeneratePointScalars,int);
146  vtkBooleanMacro(GeneratePointScalars,int);
148 
150 
154  vtkSetMacro(GeneratePointVectors,int);
155  vtkGetMacro(GeneratePointVectors,int);
156  vtkBooleanMacro(GeneratePointVectors,int);
158 
160 
164  vtkSetMacro(GeneratePointNormals,int);
165  vtkGetMacro(GeneratePointNormals,int);
166  vtkBooleanMacro(GeneratePointNormals,int);
168 
170 
174  vtkSetMacro(GeneratePointTensors,int);
175  vtkGetMacro(GeneratePointTensors,int);
176  vtkBooleanMacro(GeneratePointTensors,int);
178 
180 
185  vtkSetMacro(GeneratePointTCoords,int);
186  vtkGetMacro(GeneratePointTCoords,int);
187  vtkBooleanMacro(GeneratePointTCoords,int);
189 
191 
195  vtkSetMacro(GeneratePointArray,int);
196  vtkGetMacro(GeneratePointArray,int);
197  vtkBooleanMacro(GeneratePointArray,int);
199 
201 
205  vtkSetMacro(GenerateCellScalars,int);
206  vtkGetMacro(GenerateCellScalars,int);
207  vtkBooleanMacro(GenerateCellScalars,int);
209 
211 
215  vtkSetMacro(GenerateCellVectors,int);
216  vtkGetMacro(GenerateCellVectors,int);
217  vtkBooleanMacro(GenerateCellVectors,int);
219 
221 
225  vtkSetMacro(GenerateCellNormals,int);
226  vtkGetMacro(GenerateCellNormals,int);
227  vtkBooleanMacro(GenerateCellNormals,int);
229 
231 
235  vtkSetMacro(GenerateCellTensors,int);
236  vtkGetMacro(GenerateCellTensors,int);
237  vtkBooleanMacro(GenerateCellTensors,int);
239 
241 
246  vtkSetMacro(GenerateCellTCoords,int);
247  vtkGetMacro(GenerateCellTCoords,int);
248  vtkBooleanMacro(GenerateCellTCoords,int);
250 
252 
256  vtkSetMacro(GenerateCellArray,int);
257  vtkGetMacro(GenerateCellArray,int);
258  vtkBooleanMacro(GenerateCellArray,int);
260 
262 
266  vtkSetMacro(GenerateFieldArray,int);
267  vtkGetMacro(GenerateFieldArray,int);
268  vtkBooleanMacro(GenerateFieldArray,int);
270 
272 
277  vtkSetMacro(AttributesConstantPerBlock,bool);
278  vtkGetMacro(AttributesConstantPerBlock,bool);
279  vtkBooleanMacro(AttributesConstantPerBlock,bool);
281 
282 
284 
291  {
292  this->GeneratePointScalarsOn();
293  this->GeneratePointVectorsOn();
294  this->GeneratePointNormalsOn();
295  this->GeneratePointTCoordsOn();
296  this->GeneratePointTensorsOn();
297  this->GeneratePointArrayOn();
298  }
300  {
301  this->GeneratePointScalarsOff();
302  this->GeneratePointVectorsOff();
303  this->GeneratePointNormalsOff();
304  this->GeneratePointTCoordsOff();
305  this->GeneratePointTensorsOff();
306  this->GeneratePointArrayOff();
307  }
309  {
310  this->GenerateCellScalarsOn();
311  this->GenerateCellVectorsOn();
312  this->GenerateCellNormalsOn();
313  this->GenerateCellTCoordsOn();
314  this->GenerateCellTensorsOn();
315  this->GenerateCellArrayOn();
316  }
318  {
319  this->GenerateCellScalarsOff();
320  this->GenerateCellVectorsOff();
321  this->GenerateCellNormalsOff();
322  this->GenerateCellTCoordsOff();
323  this->GenerateCellTensorsOff();
324  this->GenerateCellArrayOff();
325  }
327  {
328  this->GenerateAllPointDataOn();
329  this->GenerateAllCellDataOn();
330  this->GenerateFieldArrayOn();
331  }
333  {
334  this->GenerateAllPointDataOff();
335  this->GenerateAllCellDataOff();
336  this->GenerateFieldArrayOff();
337  }
339 
340 protected:
343 
345  vtkInformationVector *) VTK_OVERRIDE;
346  int FillInputPortInformation(int port, vtkInformation* info) VTK_OVERRIDE;
347 
348  int DataType;
349  int NumberOfComponents;
350  vtkIdType NumberOfTuples;
351  double MinimumComponentValue;
352  double MaximumComponentValue;
353 
354  int GeneratePointScalars;
355  int GeneratePointVectors;
356  int GeneratePointNormals;
357  int GeneratePointTCoords;
358  int GeneratePointTensors;
359  int GeneratePointArray;
360 
361  int GenerateCellScalars;
362  int GenerateCellVectors;
363  int GenerateCellNormals;
364  int GenerateCellTCoords;
365  int GenerateCellTensors;
366  int GenerateCellArray;
367 
368  int GenerateFieldArray;
369  bool AttributesConstantPerBlock;
370 
371  // Helper functions
372  vtkDataArray *GenerateData(int dataType, vtkIdType numTuples, int numComp,
373  int minComp, int maxComp, double min, double max);
374  int RequestData(vtkDataSet *input, vtkDataSet *output);
375  int RequestData(vtkCompositeDataSet *input, vtkCompositeDataSet *output);
376  template <class T>
377  void GenerateRandomTuples(T *data,
378  vtkIdType numTuples,
379  int numComp,
380  int minComp,
381  int maxComp,
382  double min,
383  double max);
384 
385 
386 private:
387  vtkRandomAttributeGenerator(const vtkRandomAttributeGenerator&) VTK_DELETE_FUNCTION;
388  void operator=(const vtkRandomAttributeGenerator&) VTK_DELETE_FUNCTION;
389 };
390 
391 #endif
#define VTK_UNSIGNED_INT
Definition: vtkType.h:55
Superclass for algorithms that produce output of the same type as input.
Store vtkAlgorithm input/output information.
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:53
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
void SetDataTypeToUnsignedShort()
Specify the type of array to create (all components of this array are of this type).
#define VTK_INT_MAX
Definition: vtkType.h:153
void GenerateAllPointDataOff()
Convenience methods for generating data: all data, all point data, or all cell data.
void SetDataTypeToLong()
Specify the type of array to create (all components of this array are of this type).
int vtkIdType
Definition: vtkType.h:287
void GenerateAllPointDataOn()
Convenience methods for generating data: all data, all point data, or all cell data.
void GenerateAllCellDataOff()
Convenience methods for generating data: all data, all point data, or all cell data.
void GenerateAllDataOn()
Convenience methods for generating data: all data, all point data, or all cell data.
#define VTK_DOUBLE
Definition: vtkType.h:59
#define VTK_FLOAT
Definition: vtkType.h:58
void SetDataTypeToInt()
Specify the type of array to create (all components of this array are of this type).
void GenerateAllDataOff()
Convenience methods for generating data: all data, all point data, or all cell data.
abstract superclass for composite (multi-block or AMR) datasets
void SetDataTypeToUnsignedChar()
Specify the type of array to create (all components of this array are of this type).
a simple class to control print indentation
Definition: vtkIndent.h:39
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
#define VTK_SHORT
Definition: vtkType.h:52
#define VTK_CHAR
Definition: vtkType.h:49
#define VTK_LONG
Definition: vtkType.h:56
void SetDataTypeToFloat()
Specify the type of array to create (all components of this array are of this type).
void SetDataTypeToUnsignedInt()
Specify the type of array to create (all components of this array are of this type).
void SetDataTypeToUnsignedLong()
Specify the type of array to create (all components of this array are of this type).
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:51
void SetDataTypeToBit()
Specify the type of array to create (all components of this array are of this type).
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void GenerateAllCellDataOn()
Convenience methods for generating data: all data, all point data, or all cell data.
#define VTK_BIT
Definition: vtkType.h:48
Store zero or more vtkInformation instances.
#define VTK_UNSIGNED_LONG
Definition: vtkType.h:57
generate and create random data attributes
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
void SetComponentRange(double minimumValue, double maximumValue)
Set the minimum component value.
void SetDataTypeToChar()
Specify the type of array to create (all components of this array are of this type).
void SetDataTypeToShort()
Specify the type of array to create (all components of this array are of this type).
#define VTK_INT
Definition: vtkType.h:54
#define max(a, b)
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called within ProcessRequest when a request asks the algorithm to do its work.
void SetDataTypeToDouble()
Specify the type of array to create (all components of this array are of this type).
static vtkPassInputTypeAlgorithm * New()