VTK  9.1.0
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:
348  ~vtkRandomAttributeGenerator() override = default;
349 
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>
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
abstract superclass for composite (multi-block or AMR) datasets
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:50
abstract class to specify dataset behavior
Definition: vtkDataSet.h:57
a simple class to control print indentation
Definition: vtkIndent.h:34
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Superclass for algorithms that produce output of the same type as input.
generate and create random data attributes
void SetDataTypeToUnsignedChar()
Specify the type of array to create (all components of this array are of this type).
int RequestData(vtkDataSet *input, vtkDataSet *output)
void SetDataTypeToUnsignedShort()
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 GenerateAllPointDataOff()
Convenience methods for generating data: all data, all point data, or all cell data.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called within ProcessRequest when a request asks the algorithm to do its work.
void GenerateAllDataOff()
Convenience methods for generating data: all data, all point data, or all cell data.
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.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
void SetDataTypeToIdType()
Specify the type of array to create (all components of this array are of this type).
void SetDataTypeToBit()
Specify the type of array to create (all components of this array are of this type).
void SetDataTypeToInt()
Specify the type of array to create (all components of this array are of this type).
void SetDataTypeToLong()
Specify the type of array to create (all components of this array are of this type).
void GenerateAllDataOn()
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 SetDataTypeToFloat()
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).
void SetDataTypeToDouble()
Specify the type of array to create (all components of this array are of this type).
int RequestData(vtkCompositeDataSet *input, vtkCompositeDataSet *output)
void SetDataTypeToUnsignedLong()
Specify the type of array to create (all components of this array are of this type).
vtkDataArray * GenerateData(int dataType, vtkIdType numTuples, int numComp, int minComp, int maxComp, double min, double max)
void GenerateRandomTuples(T *data, vtkIdType numTuples, int numComp, int minComp, int maxComp, double min, double max)
void SetDataTypeToChar()
Specify the type of array to create (all components of this array are of this type).
~vtkRandomAttributeGenerator() override=default
void SetDataTypeToUnsignedLongLong()
Specify the type of array to create (all components of this array are of this type).
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for construction, type info, and printing.
static vtkRandomAttributeGenerator * New()
Standard methods for construction, type info, and printing.
void SetComponentRange(double minimumValue, double maximumValue)
Set the minimum component value.
void GenerateAllPointDataOn()
Convenience methods for generating data: all data, all point data, or all cell data.
@ info
Definition: vtkX3D.h:382
@ port
Definition: vtkX3D.h:453
@ data
Definition: vtkX3D.h:321
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_SHORT
Definition: vtkType.h:48
int vtkIdType
Definition: vtkType.h:332
#define VTK_UNSIGNED_INT
Definition: vtkType.h:51
#define VTK_LONG_LONG
Definition: vtkType.h:63
#define VTK_DOUBLE
Definition: vtkType.h:55
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:47
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:49
#define VTK_INT
Definition: vtkType.h:50
#define VTK_FLOAT
Definition: vtkType.h:54
#define VTK_CHAR
Definition: vtkType.h:45
#define VTK_UNSIGNED_LONG
Definition: vtkType.h:53
#define VTK_BIT
Definition: vtkType.h:44
#define VTK_UNSIGNED_LONG_LONG
Definition: vtkType.h:64
#define VTK_INT_MAX
Definition: vtkType.h:155
#define VTK_LONG
Definition: vtkType.h:52
#define VTK_ID_TYPE
Definition: vtkType.h:56
#define max(a, b)