VTK  9.0.1
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:
63 
68  void PrintSelf(ostream& os, vtkIndent indent) override;
70 
72 
76  vtkSetMacro(DataType, int);
77  void SetDataTypeToBit() { this->SetDataType(VTK_BIT); }
78  void SetDataTypeToChar() { this->SetDataType(VTK_CHAR); }
79  void SetDataTypeToUnsignedChar() { this->SetDataType(VTK_UNSIGNED_CHAR); }
80  void SetDataTypeToShort() { this->SetDataType(VTK_SHORT); }
81  void SetDataTypeToUnsignedShort() { this->SetDataType(VTK_UNSIGNED_SHORT); }
82  void SetDataTypeToInt() { this->SetDataType(VTK_INT); }
83  void SetDataTypeToUnsignedInt() { this->SetDataType(VTK_UNSIGNED_INT); }
84  void SetDataTypeToLong() { this->SetDataType(VTK_LONG); }
85  void SetDataTypeToLongLong() { this->SetDataType(VTK_LONG_LONG); }
86  void SetDataTypeToUnsignedLong() { this->SetDataType(VTK_UNSIGNED_LONG); }
88  void SetDataTypeToIdType() { this->SetDataType(VTK_ID_TYPE); }
89  void SetDataTypeToFloat() { this->SetDataType(VTK_FLOAT); }
90  void SetDataTypeToDouble() { this->SetDataType(VTK_DOUBLE); }
91  vtkGetMacro(DataType, int);
93 
95 
101  vtkSetClampMacro(NumberOfComponents, int, 1, VTK_INT_MAX);
102  vtkGetMacro(NumberOfComponents, int);
104 
106 
111  vtkSetMacro(MinimumComponentValue, double);
112  vtkGetMacro(MinimumComponentValue, double);
113  void SetComponentRange(double minimumValue, double maximumValue)
114  {
115  this->SetMinimumComponentValue(minimumValue);
116  this->SetMaximumComponentValue(maximumValue);
117  }
119 
121 
126  vtkSetMacro(MaximumComponentValue, double);
127  vtkGetMacro(MaximumComponentValue, double);
129 
131 
136  vtkSetClampMacro(NumberOfTuples, vtkIdType, 0, VTK_INT_MAX);
137  vtkGetMacro(NumberOfTuples, vtkIdType);
139 
141 
145  vtkSetMacro(GeneratePointScalars, vtkTypeBool);
146  vtkGetMacro(GeneratePointScalars, vtkTypeBool);
147  vtkBooleanMacro(GeneratePointScalars, vtkTypeBool);
149 
151 
155  vtkSetMacro(GeneratePointVectors, vtkTypeBool);
156  vtkGetMacro(GeneratePointVectors, vtkTypeBool);
157  vtkBooleanMacro(GeneratePointVectors, vtkTypeBool);
159 
161 
165  vtkSetMacro(GeneratePointNormals, vtkTypeBool);
166  vtkGetMacro(GeneratePointNormals, vtkTypeBool);
167  vtkBooleanMacro(GeneratePointNormals, vtkTypeBool);
169 
171 
175  vtkSetMacro(GeneratePointTensors, vtkTypeBool);
176  vtkGetMacro(GeneratePointTensors, vtkTypeBool);
177  vtkBooleanMacro(GeneratePointTensors, vtkTypeBool);
179 
181 
186  vtkSetMacro(GeneratePointTCoords, vtkTypeBool);
187  vtkGetMacro(GeneratePointTCoords, vtkTypeBool);
188  vtkBooleanMacro(GeneratePointTCoords, vtkTypeBool);
190 
192 
199  vtkSetMacro(GeneratePointArray, vtkTypeBool);
200  vtkGetMacro(GeneratePointArray, vtkTypeBool);
201  vtkBooleanMacro(GeneratePointArray, vtkTypeBool);
203 
205 
209  vtkSetMacro(GenerateCellScalars, vtkTypeBool);
210  vtkGetMacro(GenerateCellScalars, vtkTypeBool);
211  vtkBooleanMacro(GenerateCellScalars, vtkTypeBool);
213 
215 
219  vtkSetMacro(GenerateCellVectors, vtkTypeBool);
220  vtkGetMacro(GenerateCellVectors, vtkTypeBool);
221  vtkBooleanMacro(GenerateCellVectors, vtkTypeBool);
223 
225 
229  vtkSetMacro(GenerateCellNormals, vtkTypeBool);
230  vtkGetMacro(GenerateCellNormals, vtkTypeBool);
231  vtkBooleanMacro(GenerateCellNormals, vtkTypeBool);
233 
235 
239  vtkSetMacro(GenerateCellTensors, vtkTypeBool);
240  vtkGetMacro(GenerateCellTensors, vtkTypeBool);
241  vtkBooleanMacro(GenerateCellTensors, vtkTypeBool);
243 
245 
250  vtkSetMacro(GenerateCellTCoords, vtkTypeBool);
251  vtkGetMacro(GenerateCellTCoords, vtkTypeBool);
252  vtkBooleanMacro(GenerateCellTCoords, vtkTypeBool);
254 
256 
263  vtkSetMacro(GenerateCellArray, vtkTypeBool);
264  vtkGetMacro(GenerateCellArray, vtkTypeBool);
265  vtkBooleanMacro(GenerateCellArray, vtkTypeBool);
267 
269 
273  vtkSetMacro(GenerateFieldArray, vtkTypeBool);
274  vtkGetMacro(GenerateFieldArray, vtkTypeBool);
275  vtkBooleanMacro(GenerateFieldArray, vtkTypeBool);
277 
279 
284  vtkSetMacro(AttributesConstantPerBlock, bool);
285  vtkGetMacro(AttributesConstantPerBlock, bool);
286  vtkBooleanMacro(AttributesConstantPerBlock, bool);
288 
290 
297  {
298  this->GeneratePointScalarsOn();
299  this->GeneratePointVectorsOn();
300  this->GeneratePointNormalsOn();
301  this->GeneratePointTCoordsOn();
302  this->GeneratePointTensorsOn();
303  this->GeneratePointArrayOn();
304  }
306  {
307  this->GeneratePointScalarsOff();
308  this->GeneratePointVectorsOff();
309  this->GeneratePointNormalsOff();
310  this->GeneratePointTCoordsOff();
311  this->GeneratePointTensorsOff();
312  this->GeneratePointArrayOff();
313  }
315  {
316  this->GenerateCellScalarsOn();
317  this->GenerateCellVectorsOn();
318  this->GenerateCellNormalsOn();
319  this->GenerateCellTCoordsOn();
320  this->GenerateCellTensorsOn();
321  this->GenerateCellArrayOn();
322  }
324  {
325  this->GenerateCellScalarsOff();
326  this->GenerateCellVectorsOff();
327  this->GenerateCellNormalsOff();
328  this->GenerateCellTCoordsOff();
329  this->GenerateCellTensorsOff();
330  this->GenerateCellArrayOff();
331  }
333  {
334  this->GenerateAllPointDataOn();
335  this->GenerateAllCellDataOn();
336  this->GenerateFieldArrayOn();
337  }
339  {
340  this->GenerateAllPointDataOff();
341  this->GenerateAllCellDataOff();
342  this->GenerateFieldArrayOff();
343  }
345 
346 protected:
349 
351  int FillInputPortInformation(int port, vtkInformation* info) override;
352 
353  int DataType;
358 
365 
372 
375 
376  // Helper functions
377  vtkDataArray* GenerateData(int dataType, vtkIdType numTuples, int numComp, int minComp,
378  int maxComp, double min, double max);
379  int RequestData(vtkDataSet* input, vtkDataSet* output);
381  template <class T>
382  void GenerateRandomTuples(
383  T* data, vtkIdType numTuples, int numComp, int minComp, int maxComp, double min, double max);
384 
385 private:
387  void operator=(const vtkRandomAttributeGenerator&) = delete;
388 };
389 
390 #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:49
Superclass for algorithms that produce output of the same type as input.
Store vtkAlgorithm input/output information.
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:47
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:155
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:338
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:61
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:53
#define VTK_FLOAT
Definition: vtkType.h:52
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:49
#define VTK_SHORT
Definition: vtkType.h:46
#define VTK_CHAR
Definition: vtkType.h:43
#define VTK_LONG
Definition: vtkType.h:50
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:45
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:42
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:54
#define VTK_UNSIGNED_LONG
Definition: vtkType.h:51
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:62
#define VTK_INT
Definition: vtkType.h:48
#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()