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) 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 SetDataTypeToLongLong() {this->SetDataType(VTK_LONG_LONG);}
88  void SetDataTypeToUnsignedLong() {this->SetDataType(VTK_UNSIGNED_LONG);}
90  void SetDataTypeToIdType() {this->SetDataType(VTK_ID_TYPE);}
91  void SetDataTypeToFloat() {this->SetDataType(VTK_FLOAT);}
92  void SetDataTypeToDouble() {this->SetDataType(VTK_DOUBLE);}
93  vtkGetMacro(DataType,int);
95 
97 
103  vtkSetClampMacro(NumberOfComponents,int,1,VTK_INT_MAX);
104  vtkGetMacro(NumberOfComponents,int);
106 
108 
113  vtkSetMacro(MinimumComponentValue,double);
114  vtkGetMacro(MinimumComponentValue,double);
115  void SetComponentRange (double minimumValue, double maximumValue)
116  {
117  this->SetMinimumComponentValue (minimumValue);
118  this->SetMaximumComponentValue (maximumValue);
119  }
121 
123 
128  vtkSetMacro(MaximumComponentValue,double);
129  vtkGetMacro(MaximumComponentValue,double);
131 
133 
138  vtkSetClampMacro(NumberOfTuples,vtkIdType,0,VTK_INT_MAX);
139  vtkGetMacro(NumberOfTuples,vtkIdType);
141 
143 
147  vtkSetMacro(GeneratePointScalars,vtkTypeBool);
148  vtkGetMacro(GeneratePointScalars,vtkTypeBool);
149  vtkBooleanMacro(GeneratePointScalars,vtkTypeBool);
151 
153 
157  vtkSetMacro(GeneratePointVectors,vtkTypeBool);
158  vtkGetMacro(GeneratePointVectors,vtkTypeBool);
159  vtkBooleanMacro(GeneratePointVectors,vtkTypeBool);
161 
163 
167  vtkSetMacro(GeneratePointNormals,vtkTypeBool);
168  vtkGetMacro(GeneratePointNormals,vtkTypeBool);
169  vtkBooleanMacro(GeneratePointNormals,vtkTypeBool);
171 
173 
177  vtkSetMacro(GeneratePointTensors,vtkTypeBool);
178  vtkGetMacro(GeneratePointTensors,vtkTypeBool);
179  vtkBooleanMacro(GeneratePointTensors,vtkTypeBool);
181 
183 
188  vtkSetMacro(GeneratePointTCoords,vtkTypeBool);
189  vtkGetMacro(GeneratePointTCoords,vtkTypeBool);
190  vtkBooleanMacro(GeneratePointTCoords,vtkTypeBool);
192 
194 
198  vtkSetMacro(GeneratePointArray,vtkTypeBool);
199  vtkGetMacro(GeneratePointArray,vtkTypeBool);
200  vtkBooleanMacro(GeneratePointArray,vtkTypeBool);
202 
204 
208  vtkSetMacro(GenerateCellScalars,vtkTypeBool);
209  vtkGetMacro(GenerateCellScalars,vtkTypeBool);
210  vtkBooleanMacro(GenerateCellScalars,vtkTypeBool);
212 
214 
218  vtkSetMacro(GenerateCellVectors,vtkTypeBool);
219  vtkGetMacro(GenerateCellVectors,vtkTypeBool);
220  vtkBooleanMacro(GenerateCellVectors,vtkTypeBool);
222 
224 
228  vtkSetMacro(GenerateCellNormals,vtkTypeBool);
229  vtkGetMacro(GenerateCellNormals,vtkTypeBool);
230  vtkBooleanMacro(GenerateCellNormals,vtkTypeBool);
232 
234 
238  vtkSetMacro(GenerateCellTensors,vtkTypeBool);
239  vtkGetMacro(GenerateCellTensors,vtkTypeBool);
240  vtkBooleanMacro(GenerateCellTensors,vtkTypeBool);
242 
244 
249  vtkSetMacro(GenerateCellTCoords,vtkTypeBool);
250  vtkGetMacro(GenerateCellTCoords,vtkTypeBool);
251  vtkBooleanMacro(GenerateCellTCoords,vtkTypeBool);
253 
255 
259  vtkSetMacro(GenerateCellArray,vtkTypeBool);
260  vtkGetMacro(GenerateCellArray,vtkTypeBool);
261  vtkBooleanMacro(GenerateCellArray,vtkTypeBool);
263 
265 
269  vtkSetMacro(GenerateFieldArray,vtkTypeBool);
270  vtkGetMacro(GenerateFieldArray,vtkTypeBool);
271  vtkBooleanMacro(GenerateFieldArray,vtkTypeBool);
273 
275 
280  vtkSetMacro(AttributesConstantPerBlock,bool);
281  vtkGetMacro(AttributesConstantPerBlock,bool);
282  vtkBooleanMacro(AttributesConstantPerBlock,bool);
284 
285 
287 
294  {
295  this->GeneratePointScalarsOn();
296  this->GeneratePointVectorsOn();
297  this->GeneratePointNormalsOn();
298  this->GeneratePointTCoordsOn();
299  this->GeneratePointTensorsOn();
300  this->GeneratePointArrayOn();
301  }
303  {
304  this->GeneratePointScalarsOff();
305  this->GeneratePointVectorsOff();
306  this->GeneratePointNormalsOff();
307  this->GeneratePointTCoordsOff();
308  this->GeneratePointTensorsOff();
309  this->GeneratePointArrayOff();
310  }
312  {
313  this->GenerateCellScalarsOn();
314  this->GenerateCellVectorsOn();
315  this->GenerateCellNormalsOn();
316  this->GenerateCellTCoordsOn();
317  this->GenerateCellTensorsOn();
318  this->GenerateCellArrayOn();
319  }
321  {
322  this->GenerateCellScalarsOff();
323  this->GenerateCellVectorsOff();
324  this->GenerateCellNormalsOff();
325  this->GenerateCellTCoordsOff();
326  this->GenerateCellTensorsOff();
327  this->GenerateCellArrayOff();
328  }
330  {
331  this->GenerateAllPointDataOn();
332  this->GenerateAllCellDataOn();
333  this->GenerateFieldArrayOn();
334  }
336  {
337  this->GenerateAllPointDataOff();
338  this->GenerateAllCellDataOff();
339  this->GenerateFieldArrayOff();
340  }
342 
343 protected:
346 
348  vtkInformationVector *) override;
349  int FillInputPortInformation(int port, vtkInformation* info) override;
350 
351  int DataType;
356 
363 
370 
373 
374  // Helper functions
375  vtkDataArray *GenerateData(int dataType, vtkIdType numTuples, int numComp,
376  int minComp, int maxComp, double min, double max);
377  int RequestData(vtkDataSet *input, vtkDataSet *output);
379  template <class T>
380  void GenerateRandomTuples(T *data,
381  vtkIdType numTuples,
382  int numComp,
383  int minComp,
384  int maxComp,
385  double min,
386  double max);
387 
388 
389 private:
391  void operator=(const vtkRandomAttributeGenerator&) = delete;
392 };
393 
394 #endif
void SetDataTypeToUnsignedLongLong()
Specify the type of array to create (all components of this array are of this type).
#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:159
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:347
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.
#define VTK_LONG_LONG
Definition: vtkType.h:67
void GenerateAllDataOn()
Convenience methods for generating data: all data, all point data, or all cell data.
int vtkTypeBool
Definition: vtkABI.h:69
#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).
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
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).
#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 SetDataTypeToLongLong()
Specify the type of array to create (all components of this array are of this type).
void GenerateAllCellDataOn()
Convenience methods for generating data: all data, all point data, or all cell data.
#define VTK_BIT
Definition: vtkType.h:48
void SetDataTypeToIdType()
Specify the type of array to create (all components of this array are of this type).
Store zero or more vtkInformation instances.
#define VTK_ID_TYPE
Definition: vtkType.h:60
#define VTK_UNSIGNED_LONG
Definition: vtkType.h:57
generate and create random data attributes
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_UNSIGNED_LONG_LONG
Definition: vtkType.h:68
#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()