VTK  9.3.1
vtkRandomAttributeGenerator.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
41 #ifndef vtkRandomAttributeGenerator_h
42 #define vtkRandomAttributeGenerator_h
43 
44 #include "vtkFiltersGeneralModule.h" // For export macro
46 
47 VTK_ABI_NAMESPACE_BEGIN
48 class vtkDataSet;
50 
51 class VTKFILTERSGENERAL_EXPORT vtkRandomAttributeGenerator : public vtkPassInputTypeAlgorithm
52 {
53 public:
55 
60  void PrintSelf(ostream& os, vtkIndent indent) override;
62 
64 
68  vtkSetMacro(DataType, int);
69  void SetDataTypeToBit() { this->SetDataType(VTK_BIT); }
70  void SetDataTypeToChar() { this->SetDataType(VTK_CHAR); }
71  void SetDataTypeToUnsignedChar() { this->SetDataType(VTK_UNSIGNED_CHAR); }
72  void SetDataTypeToShort() { this->SetDataType(VTK_SHORT); }
73  void SetDataTypeToUnsignedShort() { this->SetDataType(VTK_UNSIGNED_SHORT); }
74  void SetDataTypeToInt() { this->SetDataType(VTK_INT); }
75  void SetDataTypeToUnsignedInt() { this->SetDataType(VTK_UNSIGNED_INT); }
76  void SetDataTypeToLong() { this->SetDataType(VTK_LONG); }
77  void SetDataTypeToLongLong() { this->SetDataType(VTK_LONG_LONG); }
78  void SetDataTypeToUnsignedLong() { this->SetDataType(VTK_UNSIGNED_LONG); }
80  void SetDataTypeToIdType() { this->SetDataType(VTK_ID_TYPE); }
81  void SetDataTypeToFloat() { this->SetDataType(VTK_FLOAT); }
82  void SetDataTypeToDouble() { this->SetDataType(VTK_DOUBLE); }
83  vtkGetMacro(DataType, int);
85 
87 
93  vtkSetClampMacro(NumberOfComponents, int, 1, VTK_INT_MAX);
94  vtkGetMacro(NumberOfComponents, int);
96 
98 
103  vtkSetMacro(MinimumComponentValue, double);
104  vtkGetMacro(MinimumComponentValue, double);
105  void SetComponentRange(double minimumValue, double maximumValue)
106  {
107  this->SetMinimumComponentValue(minimumValue);
108  this->SetMaximumComponentValue(maximumValue);
109  }
111 
113 
118  vtkSetMacro(MaximumComponentValue, double);
119  vtkGetMacro(MaximumComponentValue, double);
121 
123 
128  vtkSetClampMacro(NumberOfTuples, vtkIdType, 0, VTK_INT_MAX);
129  vtkGetMacro(NumberOfTuples, vtkIdType);
131 
133 
137  vtkSetMacro(GeneratePointScalars, vtkTypeBool);
138  vtkGetMacro(GeneratePointScalars, vtkTypeBool);
139  vtkBooleanMacro(GeneratePointScalars, vtkTypeBool);
141 
143 
147  vtkSetMacro(GeneratePointVectors, vtkTypeBool);
148  vtkGetMacro(GeneratePointVectors, vtkTypeBool);
149  vtkBooleanMacro(GeneratePointVectors, vtkTypeBool);
151 
153 
157  vtkSetMacro(GeneratePointNormals, vtkTypeBool);
158  vtkGetMacro(GeneratePointNormals, vtkTypeBool);
159  vtkBooleanMacro(GeneratePointNormals, vtkTypeBool);
161 
163 
167  vtkSetMacro(GeneratePointTensors, vtkTypeBool);
168  vtkGetMacro(GeneratePointTensors, vtkTypeBool);
169  vtkBooleanMacro(GeneratePointTensors, vtkTypeBool);
171 
173 
178  vtkSetMacro(GeneratePointTCoords, vtkTypeBool);
179  vtkGetMacro(GeneratePointTCoords, vtkTypeBool);
180  vtkBooleanMacro(GeneratePointTCoords, vtkTypeBool);
182 
184 
191  vtkSetMacro(GeneratePointArray, vtkTypeBool);
192  vtkGetMacro(GeneratePointArray, vtkTypeBool);
193  vtkBooleanMacro(GeneratePointArray, vtkTypeBool);
195 
197 
201  vtkSetMacro(GenerateCellScalars, vtkTypeBool);
202  vtkGetMacro(GenerateCellScalars, vtkTypeBool);
203  vtkBooleanMacro(GenerateCellScalars, vtkTypeBool);
205 
207 
211  vtkSetMacro(GenerateCellVectors, vtkTypeBool);
212  vtkGetMacro(GenerateCellVectors, vtkTypeBool);
213  vtkBooleanMacro(GenerateCellVectors, vtkTypeBool);
215 
217 
221  vtkSetMacro(GenerateCellNormals, vtkTypeBool);
222  vtkGetMacro(GenerateCellNormals, vtkTypeBool);
223  vtkBooleanMacro(GenerateCellNormals, vtkTypeBool);
225 
227 
231  vtkSetMacro(GenerateCellTensors, vtkTypeBool);
232  vtkGetMacro(GenerateCellTensors, vtkTypeBool);
233  vtkBooleanMacro(GenerateCellTensors, vtkTypeBool);
235 
237 
242  vtkSetMacro(GenerateCellTCoords, vtkTypeBool);
243  vtkGetMacro(GenerateCellTCoords, vtkTypeBool);
244  vtkBooleanMacro(GenerateCellTCoords, vtkTypeBool);
246 
248 
255  vtkSetMacro(GenerateCellArray, vtkTypeBool);
256  vtkGetMacro(GenerateCellArray, vtkTypeBool);
257  vtkBooleanMacro(GenerateCellArray, vtkTypeBool);
259 
261 
265  vtkSetMacro(GenerateFieldArray, vtkTypeBool);
266  vtkGetMacro(GenerateFieldArray, vtkTypeBool);
267  vtkBooleanMacro(GenerateFieldArray, vtkTypeBool);
269 
271 
276  vtkSetMacro(AttributesConstantPerBlock, bool);
277  vtkGetMacro(AttributesConstantPerBlock, bool);
278  vtkBooleanMacro(AttributesConstantPerBlock, bool);
280 
282 
289  {
290  this->GeneratePointScalarsOn();
291  this->GeneratePointVectorsOn();
292  this->GeneratePointNormalsOn();
293  this->GeneratePointTCoordsOn();
294  this->GeneratePointTensorsOn();
295  this->GeneratePointArrayOn();
296  }
298  {
299  this->GeneratePointScalarsOff();
300  this->GeneratePointVectorsOff();
301  this->GeneratePointNormalsOff();
302  this->GeneratePointTCoordsOff();
303  this->GeneratePointTensorsOff();
304  this->GeneratePointArrayOff();
305  }
307  {
308  this->GenerateCellScalarsOn();
309  this->GenerateCellVectorsOn();
310  this->GenerateCellNormalsOn();
311  this->GenerateCellTCoordsOn();
312  this->GenerateCellTensorsOn();
313  this->GenerateCellArrayOn();
314  }
316  {
317  this->GenerateCellScalarsOff();
318  this->GenerateCellVectorsOff();
319  this->GenerateCellNormalsOff();
320  this->GenerateCellTCoordsOff();
321  this->GenerateCellTensorsOff();
322  this->GenerateCellArrayOff();
323  }
325  {
326  this->GenerateAllPointDataOn();
327  this->GenerateAllCellDataOn();
328  this->GenerateFieldArrayOn();
329  }
331  {
332  this->GenerateAllPointDataOff();
333  this->GenerateAllCellDataOff();
334  this->GenerateFieldArrayOff();
335  }
337 
338 protected:
340  ~vtkRandomAttributeGenerator() override = default;
341 
343  int FillInputPortInformation(int port, vtkInformation* info) override;
344 
345  int DataType;
350 
357 
364 
367 
368  // Helper functions
369  vtkDataArray* GenerateData(int dataType, vtkIdType numTuples, int numComp, int minComp,
370  int maxComp, double min, double max);
371  int RequestData(vtkDataSet* input, vtkDataSet* output);
373  template <class T>
374  void GenerateRandomTuples(
375  T* data, vtkIdType numTuples, int numComp, int minComp, int maxComp, double min, double max);
376 
377 private:
379  void operator=(const vtkRandomAttributeGenerator&) = delete;
380 };
381 
382 VTK_ABI_NAMESPACE_END
383 #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:39
Superclass for algorithms that produce output of the same type as input.
Store vtkAlgorithm input/output information.
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:37
abstract class to specify dataset behavior
Definition: vtkDataSet.h:52
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:144
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:315
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:51
void GenerateAllDataOn()
Convenience methods for generating data: all data, all point data, or all cell data.
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_DOUBLE
Definition: vtkType.h:43
#define VTK_FLOAT
Definition: vtkType.h:42
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:28
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
#define VTK_SHORT
Definition: vtkType.h:36
#define VTK_CHAR
Definition: vtkType.h:33
#define VTK_LONG
Definition: vtkType.h:40
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:35
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:32
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:44
#define VTK_UNSIGNED_LONG
Definition: vtkType.h:41
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:52
#define VTK_INT
Definition: vtkType.h:38
#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()