VTK  9.2.6
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:
66 
71  void PrintSelf(ostream& os, vtkIndent indent) override;
73 
75 
79  vtkSetMacro(DataType, int);
80  void SetDataTypeToBit() { this->SetDataType(VTK_BIT); }
81  void SetDataTypeToChar() { this->SetDataType(VTK_CHAR); }
82  void SetDataTypeToUnsignedChar() { this->SetDataType(VTK_UNSIGNED_CHAR); }
83  void SetDataTypeToShort() { this->SetDataType(VTK_SHORT); }
84  void SetDataTypeToUnsignedShort() { this->SetDataType(VTK_UNSIGNED_SHORT); }
85  void SetDataTypeToInt() { this->SetDataType(VTK_INT); }
86  void SetDataTypeToUnsignedInt() { this->SetDataType(VTK_UNSIGNED_INT); }
87  void SetDataTypeToLong() { this->SetDataType(VTK_LONG); }
88  void SetDataTypeToLongLong() { this->SetDataType(VTK_LONG_LONG); }
89  void SetDataTypeToUnsignedLong() { this->SetDataType(VTK_UNSIGNED_LONG); }
91  void SetDataTypeToIdType() { this->SetDataType(VTK_ID_TYPE); }
92  void SetDataTypeToFloat() { this->SetDataType(VTK_FLOAT); }
93  void SetDataTypeToDouble() { this->SetDataType(VTK_DOUBLE); }
94  vtkGetMacro(DataType, int);
96 
98 
104  vtkSetClampMacro(NumberOfComponents, int, 1, VTK_INT_MAX);
105  vtkGetMacro(NumberOfComponents, int);
107 
109 
114  vtkSetMacro(MinimumComponentValue, double);
115  vtkGetMacro(MinimumComponentValue, double);
116  void SetComponentRange(double minimumValue, double maximumValue)
117  {
118  this->SetMinimumComponentValue(minimumValue);
119  this->SetMaximumComponentValue(maximumValue);
120  }
122 
124 
129  vtkSetMacro(MaximumComponentValue, double);
130  vtkGetMacro(MaximumComponentValue, double);
132 
134 
139  vtkSetClampMacro(NumberOfTuples, vtkIdType, 0, VTK_INT_MAX);
140  vtkGetMacro(NumberOfTuples, vtkIdType);
142 
144 
148  vtkSetMacro(GeneratePointScalars, vtkTypeBool);
149  vtkGetMacro(GeneratePointScalars, vtkTypeBool);
150  vtkBooleanMacro(GeneratePointScalars, vtkTypeBool);
152 
154 
158  vtkSetMacro(GeneratePointVectors, vtkTypeBool);
159  vtkGetMacro(GeneratePointVectors, vtkTypeBool);
160  vtkBooleanMacro(GeneratePointVectors, vtkTypeBool);
162 
164 
168  vtkSetMacro(GeneratePointNormals, vtkTypeBool);
169  vtkGetMacro(GeneratePointNormals, vtkTypeBool);
170  vtkBooleanMacro(GeneratePointNormals, vtkTypeBool);
172 
174 
178  vtkSetMacro(GeneratePointTensors, vtkTypeBool);
179  vtkGetMacro(GeneratePointTensors, vtkTypeBool);
180  vtkBooleanMacro(GeneratePointTensors, vtkTypeBool);
182 
184 
189  vtkSetMacro(GeneratePointTCoords, vtkTypeBool);
190  vtkGetMacro(GeneratePointTCoords, vtkTypeBool);
191  vtkBooleanMacro(GeneratePointTCoords, vtkTypeBool);
193 
195 
202  vtkSetMacro(GeneratePointArray, vtkTypeBool);
203  vtkGetMacro(GeneratePointArray, vtkTypeBool);
204  vtkBooleanMacro(GeneratePointArray, vtkTypeBool);
206 
208 
212  vtkSetMacro(GenerateCellScalars, vtkTypeBool);
213  vtkGetMacro(GenerateCellScalars, vtkTypeBool);
214  vtkBooleanMacro(GenerateCellScalars, vtkTypeBool);
216 
218 
222  vtkSetMacro(GenerateCellVectors, vtkTypeBool);
223  vtkGetMacro(GenerateCellVectors, vtkTypeBool);
224  vtkBooleanMacro(GenerateCellVectors, vtkTypeBool);
226 
228 
232  vtkSetMacro(GenerateCellNormals, vtkTypeBool);
233  vtkGetMacro(GenerateCellNormals, vtkTypeBool);
234  vtkBooleanMacro(GenerateCellNormals, vtkTypeBool);
236 
238 
242  vtkSetMacro(GenerateCellTensors, vtkTypeBool);
243  vtkGetMacro(GenerateCellTensors, vtkTypeBool);
244  vtkBooleanMacro(GenerateCellTensors, vtkTypeBool);
246 
248 
253  vtkSetMacro(GenerateCellTCoords, vtkTypeBool);
254  vtkGetMacro(GenerateCellTCoords, vtkTypeBool);
255  vtkBooleanMacro(GenerateCellTCoords, vtkTypeBool);
257 
259 
266  vtkSetMacro(GenerateCellArray, vtkTypeBool);
267  vtkGetMacro(GenerateCellArray, vtkTypeBool);
268  vtkBooleanMacro(GenerateCellArray, vtkTypeBool);
270 
272 
276  vtkSetMacro(GenerateFieldArray, vtkTypeBool);
277  vtkGetMacro(GenerateFieldArray, vtkTypeBool);
278  vtkBooleanMacro(GenerateFieldArray, vtkTypeBool);
280 
282 
287  vtkSetMacro(AttributesConstantPerBlock, bool);
288  vtkGetMacro(AttributesConstantPerBlock, bool);
289  vtkBooleanMacro(AttributesConstantPerBlock, bool);
291 
293 
300  {
301  this->GeneratePointScalarsOn();
302  this->GeneratePointVectorsOn();
303  this->GeneratePointNormalsOn();
304  this->GeneratePointTCoordsOn();
305  this->GeneratePointTensorsOn();
306  this->GeneratePointArrayOn();
307  }
309  {
310  this->GeneratePointScalarsOff();
311  this->GeneratePointVectorsOff();
312  this->GeneratePointNormalsOff();
313  this->GeneratePointTCoordsOff();
314  this->GeneratePointTensorsOff();
315  this->GeneratePointArrayOff();
316  }
318  {
319  this->GenerateCellScalarsOn();
320  this->GenerateCellVectorsOn();
321  this->GenerateCellNormalsOn();
322  this->GenerateCellTCoordsOn();
323  this->GenerateCellTensorsOn();
324  this->GenerateCellArrayOn();
325  }
327  {
328  this->GenerateCellScalarsOff();
329  this->GenerateCellVectorsOff();
330  this->GenerateCellNormalsOff();
331  this->GenerateCellTCoordsOff();
332  this->GenerateCellTensorsOff();
333  this->GenerateCellArrayOff();
334  }
336  {
337  this->GenerateAllPointDataOn();
338  this->GenerateAllCellDataOn();
339  this->GenerateFieldArrayOn();
340  }
342  {
343  this->GenerateAllPointDataOff();
344  this->GenerateAllCellDataOff();
345  this->GenerateFieldArrayOff();
346  }
348 
349 protected:
351  ~vtkRandomAttributeGenerator() override = default;
352 
354  int FillInputPortInformation(int port, vtkInformation* info) override;
355 
356  int DataType;
361 
368 
375 
378 
379  // Helper functions
380  vtkDataArray* GenerateData(int dataType, vtkIdType numTuples, int numComp, int minComp,
381  int maxComp, double min, double max);
382  int RequestData(vtkDataSet* input, vtkDataSet* output);
384  template <class T>
385  void GenerateRandomTuples(
386  T* data, vtkIdType numTuples, int numComp, int minComp, int maxComp, double min, double max);
387 
388 private:
390  void operator=(const vtkRandomAttributeGenerator&) = delete;
391 };
392 
393 #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:51
Superclass for algorithms that produce output of the same type as input.
Store vtkAlgorithm input/output information.
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:49
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: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:332
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:63
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:55
#define VTK_FLOAT
Definition: vtkType.h:54
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:55
#define VTK_SHORT
Definition: vtkType.h:48
#define VTK_CHAR
Definition: vtkType.h:45
#define VTK_LONG
Definition: vtkType.h:52
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:47
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:44
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:56
#define VTK_UNSIGNED_LONG
Definition: vtkType.h:53
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:64
#define VTK_INT
Definition: vtkType.h:50
#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()