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
vtkRandomAttributeGenerator::SetDataTypeToUnsignedInt
void SetDataTypeToUnsignedInt()
Definition: vtkRandomAttributeGenerator.h:83
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:155
vtkRandomAttributeGenerator::SetDataTypeToLongLong
void SetDataTypeToLongLong()
Definition: vtkRandomAttributeGenerator.h:85
VTK_UNSIGNED_LONG_LONG
#define VTK_UNSIGNED_LONG_LONG
Definition: vtkType.h:62
vtkPassInputTypeAlgorithm.h
vtkIdType
int vtkIdType
Definition: vtkType.h:338
VTK_UNSIGNED_INT
#define VTK_UNSIGNED_INT
Definition: vtkType.h:49
vtkRandomAttributeGenerator::GeneratePointArray
vtkTypeBool GeneratePointArray
Definition: vtkRandomAttributeGenerator.h:364
vtkX3D::data
@ data
Definition: vtkX3D.h:321
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
VTK_UNSIGNED_SHORT
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:47
vtkRandomAttributeGenerator::SetDataTypeToFloat
void SetDataTypeToFloat()
Definition: vtkRandomAttributeGenerator.h:89
vtkRandomAttributeGenerator::GenerateCellScalars
vtkTypeBool GenerateCellScalars
Definition: vtkRandomAttributeGenerator.h:366
vtkRandomAttributeGenerator::GenerateAllCellDataOff
void GenerateAllCellDataOff()
Definition: vtkRandomAttributeGenerator.h:323
vtkRandomAttributeGenerator::SetDataTypeToShort
void SetDataTypeToShort()
Definition: vtkRandomAttributeGenerator.h:80
vtkPassInputTypeAlgorithm::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:49
VTK_LONG_LONG
#define VTK_LONG_LONG
Definition: vtkType.h:61
vtkRandomAttributeGenerator::SetDataTypeToDouble
void SetDataTypeToDouble()
Definition: vtkRandomAttributeGenerator.h:90
vtkRandomAttributeGenerator::GenerateCellVectors
vtkTypeBool GenerateCellVectors
Definition: vtkRandomAttributeGenerator.h:367
vtkRandomAttributeGenerator::MaximumComponentValue
double MaximumComponentValue
Definition: vtkRandomAttributeGenerator.h:357
vtkCompositeDataSet
abstract superclass for composite (multi-block or AMR) datasets
Definition: vtkCompositeDataSet.h:45
max
#define max(a, b)
Definition: vtkX3DExporterFIWriterHelper.h:31
vtkRandomAttributeGenerator::GenerateCellTensors
vtkTypeBool GenerateCellTensors
Definition: vtkRandomAttributeGenerator.h:370
vtkX3D::port
@ port
Definition: vtkX3D.h:453
vtkRandomAttributeGenerator::SetDataTypeToUnsignedChar
void SetDataTypeToUnsignedChar()
Definition: vtkRandomAttributeGenerator.h:79
vtkRandomAttributeGenerator::GeneratePointNormals
vtkTypeBool GeneratePointNormals
Definition: vtkRandomAttributeGenerator.h:361
vtkRandomAttributeGenerator::GenerateFieldArray
vtkTypeBool GenerateFieldArray
Definition: vtkRandomAttributeGenerator.h:373
vtkPassInputTypeAlgorithm::RequestData
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called within ProcessRequest when a request asks the algorithm to do its work.
Definition: vtkPassInputTypeAlgorithm.h:171
vtkRandomAttributeGenerator::MinimumComponentValue
double MinimumComponentValue
Definition: vtkRandomAttributeGenerator.h:356
VTK_CHAR
#define VTK_CHAR
Definition: vtkType.h:43
vtkRandomAttributeGenerator::GenerateCellNormals
vtkTypeBool GenerateCellNormals
Definition: vtkRandomAttributeGenerator.h:368
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkRandomAttributeGenerator::GeneratePointScalars
vtkTypeBool GeneratePointScalars
Definition: vtkRandomAttributeGenerator.h:359
VTK_FLOAT
#define VTK_FLOAT
Definition: vtkType.h:52
VTK_DOUBLE
#define VTK_DOUBLE
Definition: vtkType.h:53
vtkRandomAttributeGenerator::DataType
int DataType
Definition: vtkRandomAttributeGenerator.h:353
VTK_UNSIGNED_CHAR
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:45
VTK_LONG
#define VTK_LONG
Definition: vtkType.h:50
vtkRandomAttributeGenerator::~vtkRandomAttributeGenerator
~vtkRandomAttributeGenerator() override
Definition: vtkRandomAttributeGenerator.h:348
vtkRandomAttributeGenerator::SetDataTypeToUnsignedShort
void SetDataTypeToUnsignedShort()
Definition: vtkRandomAttributeGenerator.h:81
vtkRandomAttributeGenerator::GenerateAllDataOn
void GenerateAllDataOn()
Definition: vtkRandomAttributeGenerator.h:332
vtkRandomAttributeGenerator::NumberOfComponents
int NumberOfComponents
Definition: vtkRandomAttributeGenerator.h:354
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
vtkRandomAttributeGenerator::SetDataTypeToBit
void SetDataTypeToBit()
Definition: vtkRandomAttributeGenerator.h:77
VTK_UNSIGNED_LONG
#define VTK_UNSIGNED_LONG
Definition: vtkType.h:51
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:73
vtkRandomAttributeGenerator
generate and create random data attributes
Definition: vtkRandomAttributeGenerator.h:59
vtkX3D::info
@ info
Definition: vtkX3D.h:382
vtkRandomAttributeGenerator::GenerateAllCellDataOn
void GenerateAllCellDataOn()
Definition: vtkRandomAttributeGenerator.h:314
VTK_SHORT
#define VTK_SHORT
Definition: vtkType.h:46
vtkRandomAttributeGenerator::SetDataTypeToIdType
void SetDataTypeToIdType()
Definition: vtkRandomAttributeGenerator.h:88
vtkRandomAttributeGenerator::SetDataTypeToUnsignedLong
void SetDataTypeToUnsignedLong()
Definition: vtkRandomAttributeGenerator.h:86
vtkRandomAttributeGenerator::GenerateCellTCoords
vtkTypeBool GenerateCellTCoords
Definition: vtkRandomAttributeGenerator.h:369
vtkRandomAttributeGenerator::GenerateAllPointDataOn
void GenerateAllPointDataOn()
Convenience methods for generating data: all data, all point data, or all cell data.
Definition: vtkRandomAttributeGenerator.h:296
vtkRandomAttributeGenerator::GenerateAllPointDataOff
void GenerateAllPointDataOff()
Definition: vtkRandomAttributeGenerator.h:305
vtkRandomAttributeGenerator::AttributesConstantPerBlock
bool AttributesConstantPerBlock
Definition: vtkRandomAttributeGenerator.h:374
vtkRandomAttributeGenerator::GenerateAllDataOff
void GenerateAllDataOff()
Definition: vtkRandomAttributeGenerator.h:338
vtkRandomAttributeGenerator::SetDataTypeToUnsignedLongLong
void SetDataTypeToUnsignedLongLong()
Definition: vtkRandomAttributeGenerator.h:87
vtkRandomAttributeGenerator::GenerateCellArray
vtkTypeBool GenerateCellArray
Definition: vtkRandomAttributeGenerator.h:371
vtkPassInputTypeAlgorithm::New
static vtkPassInputTypeAlgorithm * New()
vtkRandomAttributeGenerator::SetComponentRange
void SetComponentRange(double minimumValue, double maximumValue)
Definition: vtkRandomAttributeGenerator.h:113
VTK_ID_TYPE
#define VTK_ID_TYPE
Definition: vtkType.h:54
vtkPassInputTypeAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkRandomAttributeGenerator::SetDataTypeToChar
void SetDataTypeToChar()
Definition: vtkRandomAttributeGenerator.h:78
vtkRandomAttributeGenerator::GeneratePointTCoords
vtkTypeBool GeneratePointTCoords
Definition: vtkRandomAttributeGenerator.h:362
VTK_BIT
#define VTK_BIT
Definition: vtkType.h:42
VTK_INT
#define VTK_INT
Definition: vtkType.h:48
vtkRandomAttributeGenerator::GeneratePointVectors
vtkTypeBool GeneratePointVectors
Definition: vtkRandomAttributeGenerator.h:360
vtkRandomAttributeGenerator::NumberOfTuples
vtkIdType NumberOfTuples
Definition: vtkRandomAttributeGenerator.h:355
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkPassInputTypeAlgorithm
Superclass for algorithms that produce output of the same type as input.
Definition: vtkPassInputTypeAlgorithm.h:51
vtkRandomAttributeGenerator::SetDataTypeToLong
void SetDataTypeToLong()
Definition: vtkRandomAttributeGenerator.h:84
vtkRandomAttributeGenerator::GeneratePointTensors
vtkTypeBool GeneratePointTensors
Definition: vtkRandomAttributeGenerator.h:363
vtkRandomAttributeGenerator::SetDataTypeToInt
void SetDataTypeToInt()
Definition: vtkRandomAttributeGenerator.h:82