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 =========================================================================*/
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:
69 
71  void PrintSelf(ostream& os, vtkIndent indent) override;
72 
74 
78  vtkSetMacro(DataType,int);
79  void SetDataTypeToBit() {this->SetDataType(VTK_BIT);}
80  void SetDataTypeToChar() {this->SetDataType(VTK_CHAR);}
81  void SetDataTypeToUnsignedChar() {this->SetDataType(VTK_UNSIGNED_CHAR);}
82  void SetDataTypeToShort() {this->SetDataType(VTK_SHORT);}
83  void SetDataTypeToUnsignedShort() {this->SetDataType(VTK_UNSIGNED_SHORT);}
84  void SetDataTypeToInt() {this->SetDataType(VTK_INT);}
85  void SetDataTypeToUnsignedInt() {this->SetDataType(VTK_UNSIGNED_INT);}
86  void SetDataTypeToLong() {this->SetDataType(VTK_LONG);}
87  void SetDataTypeToLongLong() {this->SetDataType(VTK_LONG_LONG);}
88  void SetDataTypeToUnsignedLong() {this->SetDataType(VTK_UNSIGNED_LONG);}
90  void SetDataTypeToIdType() {this->SetDataType(VTK_ID_TYPE);}
91  void SetDataTypeToFloat() {this->SetDataType(VTK_FLOAT);}
92  void SetDataTypeToDouble() {this->SetDataType(VTK_DOUBLE);}
93  vtkGetMacro(DataType,int);
95 
97 
103  vtkSetClampMacro(NumberOfComponents,int,1,VTK_INT_MAX);
104  vtkGetMacro(NumberOfComponents,int);
106 
108 
113  vtkSetMacro(MinimumComponentValue,double);
114  vtkGetMacro(MinimumComponentValue,double);
115  void SetComponentRange (double minimumValue, double maximumValue)
116  {
117  this->SetMinimumComponentValue (minimumValue);
118  this->SetMaximumComponentValue (maximumValue);
119  }
121 
123 
128  vtkSetMacro(MaximumComponentValue,double);
129  vtkGetMacro(MaximumComponentValue,double);
131 
133 
138  vtkSetClampMacro(NumberOfTuples,vtkIdType,0,VTK_INT_MAX);
139  vtkGetMacro(NumberOfTuples,vtkIdType);
141 
143 
147  vtkSetMacro(GeneratePointScalars,vtkTypeBool);
148  vtkGetMacro(GeneratePointScalars,vtkTypeBool);
149  vtkBooleanMacro(GeneratePointScalars,vtkTypeBool);
151 
153 
157  vtkSetMacro(GeneratePointVectors,vtkTypeBool);
158  vtkGetMacro(GeneratePointVectors,vtkTypeBool);
159  vtkBooleanMacro(GeneratePointVectors,vtkTypeBool);
161 
163 
167  vtkSetMacro(GeneratePointNormals,vtkTypeBool);
168  vtkGetMacro(GeneratePointNormals,vtkTypeBool);
169  vtkBooleanMacro(GeneratePointNormals,vtkTypeBool);
171 
173 
177  vtkSetMacro(GeneratePointTensors,vtkTypeBool);
178  vtkGetMacro(GeneratePointTensors,vtkTypeBool);
179  vtkBooleanMacro(GeneratePointTensors,vtkTypeBool);
181 
183 
188  vtkSetMacro(GeneratePointTCoords,vtkTypeBool);
189  vtkGetMacro(GeneratePointTCoords,vtkTypeBool);
190  vtkBooleanMacro(GeneratePointTCoords,vtkTypeBool);
192 
194 
198  vtkSetMacro(GeneratePointArray,vtkTypeBool);
199  vtkGetMacro(GeneratePointArray,vtkTypeBool);
200  vtkBooleanMacro(GeneratePointArray,vtkTypeBool);
202 
204 
208  vtkSetMacro(GenerateCellScalars,vtkTypeBool);
209  vtkGetMacro(GenerateCellScalars,vtkTypeBool);
210  vtkBooleanMacro(GenerateCellScalars,vtkTypeBool);
212 
214 
218  vtkSetMacro(GenerateCellVectors,vtkTypeBool);
219  vtkGetMacro(GenerateCellVectors,vtkTypeBool);
220  vtkBooleanMacro(GenerateCellVectors,vtkTypeBool);
222 
224 
228  vtkSetMacro(GenerateCellNormals,vtkTypeBool);
229  vtkGetMacro(GenerateCellNormals,vtkTypeBool);
230  vtkBooleanMacro(GenerateCellNormals,vtkTypeBool);
232 
234 
238  vtkSetMacro(GenerateCellTensors,vtkTypeBool);
239  vtkGetMacro(GenerateCellTensors,vtkTypeBool);
240  vtkBooleanMacro(GenerateCellTensors,vtkTypeBool);
242 
244 
249  vtkSetMacro(GenerateCellTCoords,vtkTypeBool);
250  vtkGetMacro(GenerateCellTCoords,vtkTypeBool);
251  vtkBooleanMacro(GenerateCellTCoords,vtkTypeBool);
253 
255 
259  vtkSetMacro(GenerateCellArray,vtkTypeBool);
260  vtkGetMacro(GenerateCellArray,vtkTypeBool);
261  vtkBooleanMacro(GenerateCellArray,vtkTypeBool);
263 
265 
269  vtkSetMacro(GenerateFieldArray,vtkTypeBool);
270  vtkGetMacro(GenerateFieldArray,vtkTypeBool);
271  vtkBooleanMacro(GenerateFieldArray,vtkTypeBool);
273 
275 
280  vtkSetMacro(AttributesConstantPerBlock,bool);
281  vtkGetMacro(AttributesConstantPerBlock,bool);
282  vtkBooleanMacro(AttributesConstantPerBlock,bool);
284 
285 
287 
294  {
295  this->GeneratePointScalarsOn();
296  this->GeneratePointVectorsOn();
297  this->GeneratePointNormalsOn();
298  this->GeneratePointTCoordsOn();
299  this->GeneratePointTensorsOn();
300  this->GeneratePointArrayOn();
301  }
303  {
304  this->GeneratePointScalarsOff();
305  this->GeneratePointVectorsOff();
306  this->GeneratePointNormalsOff();
307  this->GeneratePointTCoordsOff();
308  this->GeneratePointTensorsOff();
309  this->GeneratePointArrayOff();
310  }
312  {
313  this->GenerateCellScalarsOn();
314  this->GenerateCellVectorsOn();
315  this->GenerateCellNormalsOn();
316  this->GenerateCellTCoordsOn();
317  this->GenerateCellTensorsOn();
318  this->GenerateCellArrayOn();
319  }
321  {
322  this->GenerateCellScalarsOff();
323  this->GenerateCellVectorsOff();
324  this->GenerateCellNormalsOff();
325  this->GenerateCellTCoordsOff();
326  this->GenerateCellTensorsOff();
327  this->GenerateCellArrayOff();
328  }
330  {
331  this->GenerateAllPointDataOn();
332  this->GenerateAllCellDataOn();
333  this->GenerateFieldArrayOn();
334  }
336  {
337  this->GenerateAllPointDataOff();
338  this->GenerateAllCellDataOff();
339  this->GenerateFieldArrayOff();
340  }
342 
343 protected:
346 
348  vtkInformationVector *) override;
349  int FillInputPortInformation(int port, vtkInformation* info) override;
350 
351  int DataType;
356 
363 
370 
373 
374  // Helper functions
375  vtkDataArray *GenerateData(int dataType, vtkIdType numTuples, int numComp,
376  int minComp, int maxComp, double min, double max);
377  int RequestData(vtkDataSet *input, vtkDataSet *output);
379  template <class T>
380  void GenerateRandomTuples(T *data,
381  vtkIdType numTuples,
382  int numComp,
383  int minComp,
384  int maxComp,
385  double min,
386  double max);
387 
388 
389 private:
391  void operator=(const vtkRandomAttributeGenerator&) = delete;
392 };
393 
394 #endif
vtkRandomAttributeGenerator::SetDataTypeToUnsignedInt
void SetDataTypeToUnsignedInt()
Definition: vtkRandomAttributeGenerator.h:85
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:159
vtkRandomAttributeGenerator::SetDataTypeToLongLong
void SetDataTypeToLongLong()
Definition: vtkRandomAttributeGenerator.h:87
VTK_UNSIGNED_LONG_LONG
#define VTK_UNSIGNED_LONG_LONG
Definition: vtkType.h:68
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:362
vtkX3D::data
Definition: vtkX3D.h:315
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
VTK_UNSIGNED_SHORT
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:53
vtkRandomAttributeGenerator::SetDataTypeToFloat
void SetDataTypeToFloat()
Definition: vtkRandomAttributeGenerator.h:91
vtkRandomAttributeGenerator::GenerateCellScalars
vtkTypeBool GenerateCellScalars
Definition: vtkRandomAttributeGenerator.h:364
vtkRandomAttributeGenerator::GenerateAllCellDataOff
void GenerateAllCellDataOff()
Definition: vtkRandomAttributeGenerator.h:320
vtkRandomAttributeGenerator::SetDataTypeToShort
void SetDataTypeToShort()
Definition: vtkRandomAttributeGenerator.h:82
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:54
VTK_LONG_LONG
#define VTK_LONG_LONG
Definition: vtkType.h:67
vtkRandomAttributeGenerator::SetDataTypeToDouble
void SetDataTypeToDouble()
Definition: vtkRandomAttributeGenerator.h:92
vtkRandomAttributeGenerator::GenerateCellVectors
vtkTypeBool GenerateCellVectors
Definition: vtkRandomAttributeGenerator.h:365
vtkRandomAttributeGenerator::MaximumComponentValue
double MaximumComponentValue
Definition: vtkRandomAttributeGenerator.h:355
vtkCompositeDataSet
abstract superclass for composite (multi-block or AMR) datasets
Definition: vtkCompositeDataSet.h:51
max
#define max(a, b)
Definition: vtkX3DExporterFIWriterHelper.h:31
vtkRandomAttributeGenerator::GenerateCellTensors
vtkTypeBool GenerateCellTensors
Definition: vtkRandomAttributeGenerator.h:368
vtkX3D::port
Definition: vtkX3D.h:447
vtkRandomAttributeGenerator::SetDataTypeToUnsignedChar
void SetDataTypeToUnsignedChar()
Definition: vtkRandomAttributeGenerator.h:81
vtkRandomAttributeGenerator::GeneratePointNormals
vtkTypeBool GeneratePointNormals
Definition: vtkRandomAttributeGenerator.h:359
vtkRandomAttributeGenerator::GenerateFieldArray
vtkTypeBool GenerateFieldArray
Definition: vtkRandomAttributeGenerator.h:371
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:178
vtkRandomAttributeGenerator::MinimumComponentValue
double MinimumComponentValue
Definition: vtkRandomAttributeGenerator.h:354
VTK_CHAR
#define VTK_CHAR
Definition: vtkType.h:49
vtkRandomAttributeGenerator::GenerateCellNormals
vtkTypeBool GenerateCellNormals
Definition: vtkRandomAttributeGenerator.h:366
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkRandomAttributeGenerator::GeneratePointScalars
vtkTypeBool GeneratePointScalars
Definition: vtkRandomAttributeGenerator.h:357
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:351
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:345
vtkRandomAttributeGenerator::SetDataTypeToUnsignedShort
void SetDataTypeToUnsignedShort()
Definition: vtkRandomAttributeGenerator.h:83
vtkRandomAttributeGenerator::GenerateAllDataOn
void GenerateAllDataOn()
Definition: vtkRandomAttributeGenerator.h:329
vtkRandomAttributeGenerator::NumberOfComponents
int NumberOfComponents
Definition: vtkRandomAttributeGenerator.h:352
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
vtkRandomAttributeGenerator::SetDataTypeToBit
void SetDataTypeToBit()
Definition: vtkRandomAttributeGenerator.h:79
VTK_UNSIGNED_LONG
#define VTK_UNSIGNED_LONG
Definition: vtkType.h:57
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkRandomAttributeGenerator
generate and create random data attributes
Definition: vtkRandomAttributeGenerator.h:62
vtkX3D::info
Definition: vtkX3D.h:376
vtkRandomAttributeGenerator::GenerateAllCellDataOn
void GenerateAllCellDataOn()
Definition: vtkRandomAttributeGenerator.h:311
VTK_SHORT
#define VTK_SHORT
Definition: vtkType.h:52
vtkRandomAttributeGenerator::SetDataTypeToIdType
void SetDataTypeToIdType()
Definition: vtkRandomAttributeGenerator.h:90
vtkRandomAttributeGenerator::SetDataTypeToUnsignedLong
void SetDataTypeToUnsignedLong()
Definition: vtkRandomAttributeGenerator.h:88
vtkRandomAttributeGenerator::GenerateCellTCoords
vtkTypeBool GenerateCellTCoords
Definition: vtkRandomAttributeGenerator.h:367
vtkRandomAttributeGenerator::GenerateAllPointDataOn
void GenerateAllPointDataOn()
Convenience methods for generating data: all data, all point data, or all cell data.
Definition: vtkRandomAttributeGenerator.h:293
vtkRandomAttributeGenerator::GenerateAllPointDataOff
void GenerateAllPointDataOff()
Definition: vtkRandomAttributeGenerator.h:302
vtkRandomAttributeGenerator::AttributesConstantPerBlock
bool AttributesConstantPerBlock
Definition: vtkRandomAttributeGenerator.h:372
vtkRandomAttributeGenerator::GenerateAllDataOff
void GenerateAllDataOff()
Definition: vtkRandomAttributeGenerator.h:335
vtkRandomAttributeGenerator::SetDataTypeToUnsignedLongLong
void SetDataTypeToUnsignedLongLong()
Definition: vtkRandomAttributeGenerator.h:89
vtkRandomAttributeGenerator::GenerateCellArray
vtkTypeBool GenerateCellArray
Definition: vtkRandomAttributeGenerator.h:369
vtkPassInputTypeAlgorithm::New
static vtkPassInputTypeAlgorithm * New()
vtkRandomAttributeGenerator::SetComponentRange
void SetComponentRange(double minimumValue, double maximumValue)
Definition: vtkRandomAttributeGenerator.h:115
VTK_ID_TYPE
#define VTK_ID_TYPE
Definition: vtkType.h:60
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:80
vtkRandomAttributeGenerator::GeneratePointTCoords
vtkTypeBool GeneratePointTCoords
Definition: vtkRandomAttributeGenerator.h:360
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:358
vtkRandomAttributeGenerator::NumberOfTuples
vtkIdType NumberOfTuples
Definition: vtkRandomAttributeGenerator.h:353
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkPassInputTypeAlgorithm
Superclass for algorithms that produce output of the same type as input.
Definition: vtkPassInputTypeAlgorithm.h:54
vtkRandomAttributeGenerator::SetDataTypeToLong
void SetDataTypeToLong()
Definition: vtkRandomAttributeGenerator.h:86
vtkRandomAttributeGenerator::GeneratePointTensors
vtkTypeBool GeneratePointTensors
Definition: vtkRandomAttributeGenerator.h:361
vtkRandomAttributeGenerator::SetDataTypeToInt
void SetDataTypeToInt()
Definition: vtkRandomAttributeGenerator.h:84