VTK
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:
66 
68  void PrintSelf(ostream& os, vtkIndent indent) override;
69 
71 
75  vtkSetMacro(DataType,int);
76  void SetDataTypeToBit() {this->SetDataType(VTK_BIT);}
77  void SetDataTypeToChar() {this->SetDataType(VTK_CHAR);}
78  void SetDataTypeToUnsignedChar() {this->SetDataType(VTK_UNSIGNED_CHAR);}
79  void SetDataTypeToShort() {this->SetDataType(VTK_SHORT);}
80  void SetDataTypeToUnsignedShort() {this->SetDataType(VTK_UNSIGNED_SHORT);}
81  void SetDataTypeToInt() {this->SetDataType(VTK_INT);}
82  void SetDataTypeToUnsignedInt() {this->SetDataType(VTK_UNSIGNED_INT);}
83  void SetDataTypeToLong() {this->SetDataType(VTK_LONG);}
84  void SetDataTypeToUnsignedLong() {this->SetDataType(VTK_UNSIGNED_LONG);}
85  void SetDataTypeToFloat() {this->SetDataType(VTK_FLOAT);}
86  void SetDataTypeToDouble() {this->SetDataType(VTK_DOUBLE);}
87  vtkGetMacro(DataType,int);
89 
91 
97  vtkSetClampMacro(NumberOfComponents,int,1,VTK_INT_MAX);
98  vtkGetMacro(NumberOfComponents,int);
100 
102 
107  vtkSetMacro(MinimumComponentValue,double);
108  vtkGetMacro(MinimumComponentValue,double);
109  void SetComponentRange (double minimumValue, double maximumValue)
110  {
111  this->SetMinimumComponentValue (minimumValue);
112  this->SetMaximumComponentValue (maximumValue);
113  }
115 
117 
122  vtkSetMacro(MaximumComponentValue,double);
123  vtkGetMacro(MaximumComponentValue,double);
125 
127 
132  vtkSetClampMacro(NumberOfTuples,vtkIdType,0,VTK_INT_MAX);
133  vtkGetMacro(NumberOfTuples,vtkIdType);
135 
137 
141  vtkSetMacro(GeneratePointScalars,vtkTypeBool);
142  vtkGetMacro(GeneratePointScalars,vtkTypeBool);
143  vtkBooleanMacro(GeneratePointScalars,vtkTypeBool);
145 
147 
151  vtkSetMacro(GeneratePointVectors,vtkTypeBool);
152  vtkGetMacro(GeneratePointVectors,vtkTypeBool);
153  vtkBooleanMacro(GeneratePointVectors,vtkTypeBool);
155 
157 
161  vtkSetMacro(GeneratePointNormals,vtkTypeBool);
162  vtkGetMacro(GeneratePointNormals,vtkTypeBool);
163  vtkBooleanMacro(GeneratePointNormals,vtkTypeBool);
165 
167 
171  vtkSetMacro(GeneratePointTensors,vtkTypeBool);
172  vtkGetMacro(GeneratePointTensors,vtkTypeBool);
173  vtkBooleanMacro(GeneratePointTensors,vtkTypeBool);
175 
177 
182  vtkSetMacro(GeneratePointTCoords,vtkTypeBool);
183  vtkGetMacro(GeneratePointTCoords,vtkTypeBool);
184  vtkBooleanMacro(GeneratePointTCoords,vtkTypeBool);
186 
188 
192  vtkSetMacro(GeneratePointArray,vtkTypeBool);
193  vtkGetMacro(GeneratePointArray,vtkTypeBool);
194  vtkBooleanMacro(GeneratePointArray,vtkTypeBool);
196 
198 
202  vtkSetMacro(GenerateCellScalars,vtkTypeBool);
203  vtkGetMacro(GenerateCellScalars,vtkTypeBool);
204  vtkBooleanMacro(GenerateCellScalars,vtkTypeBool);
206 
208 
212  vtkSetMacro(GenerateCellVectors,vtkTypeBool);
213  vtkGetMacro(GenerateCellVectors,vtkTypeBool);
214  vtkBooleanMacro(GenerateCellVectors,vtkTypeBool);
216 
218 
222  vtkSetMacro(GenerateCellNormals,vtkTypeBool);
223  vtkGetMacro(GenerateCellNormals,vtkTypeBool);
224  vtkBooleanMacro(GenerateCellNormals,vtkTypeBool);
226 
228 
232  vtkSetMacro(GenerateCellTensors,vtkTypeBool);
233  vtkGetMacro(GenerateCellTensors,vtkTypeBool);
234  vtkBooleanMacro(GenerateCellTensors,vtkTypeBool);
236 
238 
243  vtkSetMacro(GenerateCellTCoords,vtkTypeBool);
244  vtkGetMacro(GenerateCellTCoords,vtkTypeBool);
245  vtkBooleanMacro(GenerateCellTCoords,vtkTypeBool);
247 
249 
253  vtkSetMacro(GenerateCellArray,vtkTypeBool);
254  vtkGetMacro(GenerateCellArray,vtkTypeBool);
255  vtkBooleanMacro(GenerateCellArray,vtkTypeBool);
257 
259 
263  vtkSetMacro(GenerateFieldArray,vtkTypeBool);
264  vtkGetMacro(GenerateFieldArray,vtkTypeBool);
265  vtkBooleanMacro(GenerateFieldArray,vtkTypeBool);
267 
269 
274  vtkSetMacro(AttributesConstantPerBlock,bool);
275  vtkGetMacro(AttributesConstantPerBlock,bool);
276  vtkBooleanMacro(AttributesConstantPerBlock,bool);
278 
279 
281 
288  {
289  this->GeneratePointScalarsOn();
290  this->GeneratePointVectorsOn();
291  this->GeneratePointNormalsOn();
292  this->GeneratePointTCoordsOn();
293  this->GeneratePointTensorsOn();
294  this->GeneratePointArrayOn();
295  }
297  {
298  this->GeneratePointScalarsOff();
299  this->GeneratePointVectorsOff();
300  this->GeneratePointNormalsOff();
301  this->GeneratePointTCoordsOff();
302  this->GeneratePointTensorsOff();
303  this->GeneratePointArrayOff();
304  }
306  {
307  this->GenerateCellScalarsOn();
308  this->GenerateCellVectorsOn();
309  this->GenerateCellNormalsOn();
310  this->GenerateCellTCoordsOn();
311  this->GenerateCellTensorsOn();
312  this->GenerateCellArrayOn();
313  }
315  {
316  this->GenerateCellScalarsOff();
317  this->GenerateCellVectorsOff();
318  this->GenerateCellNormalsOff();
319  this->GenerateCellTCoordsOff();
320  this->GenerateCellTensorsOff();
321  this->GenerateCellArrayOff();
322  }
324  {
325  this->GenerateAllPointDataOn();
326  this->GenerateAllCellDataOn();
327  this->GenerateFieldArrayOn();
328  }
330  {
331  this->GenerateAllPointDataOff();
332  this->GenerateAllCellDataOff();
333  this->GenerateFieldArrayOff();
334  }
336 
337 protected:
340 
342  vtkInformationVector *) override;
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,
370  int minComp, int maxComp, double min, double max);
371  int RequestData(vtkDataSet *input, vtkDataSet *output);
373  template <class T>
374  void GenerateRandomTuples(T *data,
375  vtkIdType numTuples,
376  int numComp,
377  int minComp,
378  int maxComp,
379  double min,
380  double max);
381 
382 
383 private:
385  void operator=(const vtkRandomAttributeGenerator&) = delete;
386 };
387 
388 #endif
vtkRandomAttributeGenerator::SetDataTypeToUnsignedInt
void SetDataTypeToUnsignedInt()
Definition: vtkRandomAttributeGenerator.h:82
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:159
vtkPassInputTypeAlgorithm.h
vtkIdType
int vtkIdType
Definition: vtkType.h:347
VTK_UNSIGNED_INT
#define VTK_UNSIGNED_INT
Definition: vtkType.h:55
vtkRandomAttributeGenerator::GeneratePointArray
vtkTypeBool GeneratePointArray
Definition: vtkRandomAttributeGenerator.h:356
vtkX3D::data
Definition: vtkX3D.h:315
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
VTK_UNSIGNED_SHORT
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:53
vtkRandomAttributeGenerator::SetDataTypeToFloat
void SetDataTypeToFloat()
Definition: vtkRandomAttributeGenerator.h:85
vtkRandomAttributeGenerator::GenerateCellScalars
vtkTypeBool GenerateCellScalars
Definition: vtkRandomAttributeGenerator.h:358
vtkRandomAttributeGenerator::GenerateAllCellDataOff
void GenerateAllCellDataOff()
Definition: vtkRandomAttributeGenerator.h:314
vtkRandomAttributeGenerator::SetDataTypeToShort
void SetDataTypeToShort()
Definition: vtkRandomAttributeGenerator.h:79
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:48
vtkRandomAttributeGenerator::SetDataTypeToDouble
void SetDataTypeToDouble()
Definition: vtkRandomAttributeGenerator.h:86
vtkRandomAttributeGenerator::GenerateCellVectors
vtkTypeBool GenerateCellVectors
Definition: vtkRandomAttributeGenerator.h:359
vtkRandomAttributeGenerator::MaximumComponentValue
double MaximumComponentValue
Definition: vtkRandomAttributeGenerator.h:349
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:362
vtkX3D::port
Definition: vtkX3D.h:447
vtkRandomAttributeGenerator::SetDataTypeToUnsignedChar
void SetDataTypeToUnsignedChar()
Definition: vtkRandomAttributeGenerator.h:78
vtkRandomAttributeGenerator::GeneratePointNormals
vtkTypeBool GeneratePointNormals
Definition: vtkRandomAttributeGenerator.h:353
vtkRandomAttributeGenerator::GenerateFieldArray
vtkTypeBool GenerateFieldArray
Definition: vtkRandomAttributeGenerator.h:365
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:175
vtkRandomAttributeGenerator::MinimumComponentValue
double MinimumComponentValue
Definition: vtkRandomAttributeGenerator.h:348
VTK_CHAR
#define VTK_CHAR
Definition: vtkType.h:49
vtkRandomAttributeGenerator::GenerateCellNormals
vtkTypeBool GenerateCellNormals
Definition: vtkRandomAttributeGenerator.h:360
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkRandomAttributeGenerator::GeneratePointScalars
vtkTypeBool GeneratePointScalars
Definition: vtkRandomAttributeGenerator.h:351
VTK_FLOAT
#define VTK_FLOAT
Definition: vtkType.h:58
VTK_DOUBLE
#define VTK_DOUBLE
Definition: vtkType.h:59
vtkRandomAttributeGenerator::DataType
int DataType
Definition: vtkRandomAttributeGenerator.h:345
VTK_UNSIGNED_CHAR
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:51
VTK_LONG
#define VTK_LONG
Definition: vtkType.h:56
vtkRandomAttributeGenerator::~vtkRandomAttributeGenerator
~vtkRandomAttributeGenerator() override
Definition: vtkRandomAttributeGenerator.h:339
vtkRandomAttributeGenerator::SetDataTypeToUnsignedShort
void SetDataTypeToUnsignedShort()
Definition: vtkRandomAttributeGenerator.h:80
vtkRandomAttributeGenerator::GenerateAllDataOn
void GenerateAllDataOn()
Definition: vtkRandomAttributeGenerator.h:323
vtkRandomAttributeGenerator::NumberOfComponents
int NumberOfComponents
Definition: vtkRandomAttributeGenerator.h:346
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
vtkRandomAttributeGenerator::SetDataTypeToBit
void SetDataTypeToBit()
Definition: vtkRandomAttributeGenerator.h:76
VTK_UNSIGNED_LONG
#define VTK_UNSIGNED_LONG
Definition: vtkType.h:57
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:80
vtkRandomAttributeGenerator
generate and create random data attributes
Definition: vtkRandomAttributeGenerator.h:59
vtkX3D::info
Definition: vtkX3D.h:376
vtkRandomAttributeGenerator::GenerateAllCellDataOn
void GenerateAllCellDataOn()
Definition: vtkRandomAttributeGenerator.h:305
VTK_SHORT
#define VTK_SHORT
Definition: vtkType.h:52
vtkRandomAttributeGenerator::SetDataTypeToUnsignedLong
void SetDataTypeToUnsignedLong()
Definition: vtkRandomAttributeGenerator.h:84
vtkRandomAttributeGenerator::GenerateCellTCoords
vtkTypeBool GenerateCellTCoords
Definition: vtkRandomAttributeGenerator.h:361
vtkRandomAttributeGenerator::GenerateAllPointDataOn
void GenerateAllPointDataOn()
Convenience methods for generating data: all data, all point data, or all cell data.
Definition: vtkRandomAttributeGenerator.h:287
vtkRandomAttributeGenerator::GenerateAllPointDataOff
void GenerateAllPointDataOff()
Definition: vtkRandomAttributeGenerator.h:296
vtkRandomAttributeGenerator::AttributesConstantPerBlock
bool AttributesConstantPerBlock
Definition: vtkRandomAttributeGenerator.h:366
vtkRandomAttributeGenerator::GenerateAllDataOff
void GenerateAllDataOff()
Definition: vtkRandomAttributeGenerator.h:329
vtkRandomAttributeGenerator::GenerateCellArray
vtkTypeBool GenerateCellArray
Definition: vtkRandomAttributeGenerator.h:363
vtkPassInputTypeAlgorithm::New
static vtkPassInputTypeAlgorithm * New()
vtkRandomAttributeGenerator::SetComponentRange
void SetComponentRange(double minimumValue, double maximumValue)
Definition: vtkRandomAttributeGenerator.h:109
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:77
vtkRandomAttributeGenerator::GeneratePointTCoords
vtkTypeBool GeneratePointTCoords
Definition: vtkRandomAttributeGenerator.h:354
VTK_BIT
#define VTK_BIT
Definition: vtkType.h:48
VTK_INT
#define VTK_INT
Definition: vtkType.h:54
vtkRandomAttributeGenerator::GeneratePointVectors
vtkTypeBool GeneratePointVectors
Definition: vtkRandomAttributeGenerator.h:352
vtkRandomAttributeGenerator::NumberOfTuples
vtkIdType NumberOfTuples
Definition: vtkRandomAttributeGenerator.h:347
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:83
vtkRandomAttributeGenerator::GeneratePointTensors
vtkTypeBool GeneratePointTensors
Definition: vtkRandomAttributeGenerator.h:355
vtkRandomAttributeGenerator::SetDataTypeToInt
void SetDataTypeToInt()
Definition: vtkRandomAttributeGenerator.h:81