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
59class vtkDataSet;
61
62class VTKFILTERSGENERAL_EXPORT vtkRandomAttributeGenerator : public vtkPassInputTypeAlgorithm
63{
64public:
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
349protected:
351 ~vtkRandomAttributeGenerator() override = default;
352
354 int FillInputPortInformation(int port, vtkInformation* info) override;
355
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>
386 T* data, vtkIdType numTuples, int numComp, int minComp, int maxComp, double min, double max);
387
388private:
390 void operator=(const vtkRandomAttributeGenerator&) = delete;
391};
392
393#endif
abstract superclass for composite (multi-block or AMR) datasets
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:56
abstract class to specify dataset behavior
Definition: vtkDataSet.h:63
a simple class to control print indentation
Definition: vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Superclass for algorithms that produce output of the same type as input.
generate and create random data attributes
void SetDataTypeToUnsignedChar()
Specify the type of array to create (all components of this array are of this type).
int RequestData(vtkDataSet *input, vtkDataSet *output)
void SetDataTypeToUnsignedShort()
Specify the type of array to create (all components of this array are of this type).
void SetDataTypeToUnsignedInt()
Specify the type of array to create (all components of this array are of this type).
void GenerateAllPointDataOff()
Convenience methods for generating data: all data, all point data, or all cell data.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called within ProcessRequest when a request asks the algorithm to do its work.
void GenerateAllDataOff()
Convenience methods for generating data: all data, all point data, or all cell data.
static vtkRandomAttributeGenerator * New()
Standard methods for construction, type info, and printing.
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.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
void SetDataTypeToIdType()
Specify the type of array to create (all components of this array are of this type).
void SetDataTypeToBit()
Specify the type of array to create (all components of this array are of this type).
vtkDataArray * GenerateData(int dataType, vtkIdType numTuples, int numComp, int minComp, int maxComp, double min, double max)
void SetDataTypeToInt()
Specify the type of array to create (all components of this array are of this type).
void SetDataTypeToLong()
Specify the type of array to create (all components of this array are of this type).
void GenerateAllDataOn()
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.
void SetDataTypeToFloat()
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).
void SetDataTypeToDouble()
Specify the type of array to create (all components of this array are of this type).
int RequestData(vtkCompositeDataSet *input, vtkCompositeDataSet *output)
void SetDataTypeToUnsignedLong()
Specify the type of array to create (all components of this array are of this type).
void GenerateRandomTuples(T *data, vtkIdType numTuples, int numComp, int minComp, int maxComp, double min, double max)
void SetDataTypeToChar()
Specify the type of array to create (all components of this array are of this type).
~vtkRandomAttributeGenerator() override=default
void SetDataTypeToUnsignedLongLong()
Specify the type of array to create (all components of this array are of this type).
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for construction, type info, and printing.
void SetComponentRange(double minimumValue, double maximumValue)
Set the minimum component value.
void GenerateAllPointDataOn()
Convenience methods for generating data: all data, all point data, or all cell data.
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_SHORT
Definition: vtkType.h:48
int vtkIdType
Definition: vtkType.h:332
#define VTK_UNSIGNED_INT
Definition: vtkType.h:51
#define VTK_LONG_LONG
Definition: vtkType.h:63
#define VTK_DOUBLE
Definition: vtkType.h:55
#define VTK_UNSIGNED_CHAR
Definition: vtkType.h:47
#define VTK_UNSIGNED_SHORT
Definition: vtkType.h:49
#define VTK_INT
Definition: vtkType.h:50
#define VTK_FLOAT
Definition: vtkType.h:54
#define VTK_CHAR
Definition: vtkType.h:45
#define VTK_UNSIGNED_LONG
Definition: vtkType.h:53
#define VTK_BIT
Definition: vtkType.h:44
#define VTK_UNSIGNED_LONG_LONG
Definition: vtkType.h:64
#define VTK_INT_MAX
Definition: vtkType.h:155
#define VTK_LONG
Definition: vtkType.h:52
#define VTK_ID_TYPE
Definition: vtkType.h:56
#define max(a, b)