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 =========================================================================*/
50 #ifndef vtkRandomAttributeGenerator_h
51 #define vtkRandomAttributeGenerator_h
52 
53 #include "vtkFiltersGeneralModule.h" // For export macro
55 
56 class vtkDataSet;
58 
59 class VTKFILTERSGENERAL_EXPORT vtkRandomAttributeGenerator : public vtkPassInputTypeAlgorithm
60 {
61 public:
66 
68  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
69 
71 
75  vtkSetMacro(DataType,int);
76  void SetDataTypeToBit() {this->SetDataType(VTK_BIT);}
77  void SetDataTypeToChar() {this->SetDataType(VTK_CHAR);}
78  void SetDataTypeToUnsignedChar() {this->SetDataType(VTK_UNSIGNED_CHAR);}
79  void SetDataTypeToShort() {this->SetDataType(VTK_SHORT);}
80  void SetDataTypeToUnsignedShort() {this->SetDataType(VTK_UNSIGNED_SHORT);}
81  void SetDataTypeToInt() {this->SetDataType(VTK_INT);}
82  void SetDataTypeToUnsignedInt() {this->SetDataType(VTK_UNSIGNED_INT);}
83  void SetDataTypeToLong() {this->SetDataType(VTK_LONG);}
84  void SetDataTypeToUnsignedLong() {this->SetDataType(VTK_UNSIGNED_LONG);}
85  void SetDataTypeToFloat() {this->SetDataType(VTK_FLOAT);}
86  void SetDataTypeToDouble() {this->SetDataType(VTK_DOUBLE);}
87  vtkGetMacro(DataType,int);
89 
91 
97  vtkSetClampMacro(NumberOfComponents,int,1,VTK_INT_MAX);
98  vtkGetMacro(NumberOfComponents,int);
100 
102 
107  vtkSetMacro(MinimumComponentValue,double);
108  vtkGetMacro(MinimumComponentValue,double);
109  void SetComponentRange (double minimumValue, double maximumValue)
110  {
111  this->SetMinimumComponentValue (minimumValue);
112  this->SetMaximumComponentValue (maximumValue);
113  }
115 
117 
122  vtkSetMacro(MaximumComponentValue,double);
123  vtkGetMacro(MaximumComponentValue,double);
125 
127 
132  vtkSetClampMacro(NumberOfTuples,vtkIdType,0,VTK_INT_MAX);
133  vtkGetMacro(NumberOfTuples,vtkIdType);
135 
137 
141  vtkSetMacro(GeneratePointScalars,int);
142  vtkGetMacro(GeneratePointScalars,int);
143  vtkBooleanMacro(GeneratePointScalars,int);
145 
147 
151  vtkSetMacro(GeneratePointVectors,int);
152  vtkGetMacro(GeneratePointVectors,int);
153  vtkBooleanMacro(GeneratePointVectors,int);
155 
157 
161  vtkSetMacro(GeneratePointNormals,int);
162  vtkGetMacro(GeneratePointNormals,int);
163  vtkBooleanMacro(GeneratePointNormals,int);
165 
167 
171  vtkSetMacro(GeneratePointTensors,int);
172  vtkGetMacro(GeneratePointTensors,int);
173  vtkBooleanMacro(GeneratePointTensors,int);
175 
177 
182  vtkSetMacro(GeneratePointTCoords,int);
183  vtkGetMacro(GeneratePointTCoords,int);
184  vtkBooleanMacro(GeneratePointTCoords,int);
186 
188 
192  vtkSetMacro(GeneratePointArray,int);
193  vtkGetMacro(GeneratePointArray,int);
194  vtkBooleanMacro(GeneratePointArray,int);
196 
198 
202  vtkSetMacro(GenerateCellScalars,int);
203  vtkGetMacro(GenerateCellScalars,int);
204  vtkBooleanMacro(GenerateCellScalars,int);
206 
208 
212  vtkSetMacro(GenerateCellVectors,int);
213  vtkGetMacro(GenerateCellVectors,int);
214  vtkBooleanMacro(GenerateCellVectors,int);
216 
218 
222  vtkSetMacro(GenerateCellNormals,int);
223  vtkGetMacro(GenerateCellNormals,int);
224  vtkBooleanMacro(GenerateCellNormals,int);
226 
228 
232  vtkSetMacro(GenerateCellTensors,int);
233  vtkGetMacro(GenerateCellTensors,int);
234  vtkBooleanMacro(GenerateCellTensors,int);
236 
238 
243  vtkSetMacro(GenerateCellTCoords,int);
244  vtkGetMacro(GenerateCellTCoords,int);
245  vtkBooleanMacro(GenerateCellTCoords,int);
247 
249 
253  vtkSetMacro(GenerateCellArray,int);
254  vtkGetMacro(GenerateCellArray,int);
255  vtkBooleanMacro(GenerateCellArray,int);
257 
259 
263  vtkSetMacro(GenerateFieldArray,int);
264  vtkGetMacro(GenerateFieldArray,int);
265  vtkBooleanMacro(GenerateFieldArray,int);
267 
269 
274  vtkSetMacro(AttributesConstantPerBlock,bool);
275  vtkGetMacro(AttributesConstantPerBlock,bool);
276  vtkBooleanMacro(AttributesConstantPerBlock,bool);
278 
279 
281 
288  {
289  this->GeneratePointScalarsOn();
290  this->GeneratePointVectorsOn();
291  this->GeneratePointNormalsOn();
292  this->GeneratePointTCoordsOn();
293  this->GeneratePointTensorsOn();
294  this->GeneratePointArrayOn();
295  }
297  {
298  this->GeneratePointScalarsOff();
299  this->GeneratePointVectorsOff();
300  this->GeneratePointNormalsOff();
301  this->GeneratePointTCoordsOff();
302  this->GeneratePointTensorsOff();
303  this->GeneratePointArrayOff();
304  }
306  {
307  this->GenerateCellScalarsOn();
308  this->GenerateCellVectorsOn();
309  this->GenerateCellNormalsOn();
310  this->GenerateCellTCoordsOn();
311  this->GenerateCellTensorsOn();
312  this->GenerateCellArrayOn();
313  }
315  {
316  this->GenerateCellScalarsOff();
317  this->GenerateCellVectorsOff();
318  this->GenerateCellNormalsOff();
319  this->GenerateCellTCoordsOff();
320  this->GenerateCellTensorsOff();
321  this->GenerateCellArrayOff();
322  }
324  {
325  this->GenerateAllPointDataOn();
326  this->GenerateAllCellDataOn();
327  this->GenerateFieldArrayOn();
328  }
330  {
331  this->GenerateAllPointDataOff();
332  this->GenerateAllCellDataOff();
333  this->GenerateFieldArrayOff();
334  }
336 
337 protected:
340 
342  vtkInformationVector *) VTK_OVERRIDE;
343  int FillInputPortInformation(int port, vtkInformation* info) VTK_OVERRIDE;
344 
345  int DataType;
346  int NumberOfComponents;
347  vtkIdType NumberOfTuples;
348  double MinimumComponentValue;
349  double MaximumComponentValue;
350 
351  int GeneratePointScalars;
352  int GeneratePointVectors;
353  int GeneratePointNormals;
354  int GeneratePointTCoords;
355  int GeneratePointTensors;
356  int GeneratePointArray;
357 
358  int GenerateCellScalars;
359  int GenerateCellVectors;
360  int GenerateCellNormals;
361  int GenerateCellTCoords;
362  int GenerateCellTensors;
363  int GenerateCellArray;
364 
365  int GenerateFieldArray;
366  bool AttributesConstantPerBlock;
367 
368  // Helper functions
369  vtkDataArray *GenerateData(int dataType, vtkIdType numTuples, int numComp,
370  int minComp, int maxComp, double min, double max);
371  int RequestData(vtkDataSet *input, vtkDataSet *output);
372  int RequestData(vtkCompositeDataSet *input, vtkCompositeDataSet *output);
373  template <class T>
374  void GenerateRandomTuples(T *data,
375  vtkIdType numTuples,
376  int numComp,
377  int minComp,
378  int maxComp,
379  double min,
380  double max);
381 
382 
383 private:
384  vtkRandomAttributeGenerator(const vtkRandomAttributeGenerator&) VTK_DELETE_FUNCTION;
385  void operator=(const vtkRandomAttributeGenerator&) VTK_DELETE_FUNCTION;
386 };
387 
388 #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:56
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:157
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:345
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:33
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:48
#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()