VTK  9.4.20241221
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 "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_4_0
45#include "vtkFiltersGeneralModule.h" // For export macro
47
48VTK_ABI_NAMESPACE_BEGIN
49class vtkCellData;
51class vtkDataSet;
52class vtkFieldData;
54class vtkPointData;
55
56class VTKFILTERSGENERAL_EXPORT vtkRandomAttributeGenerator : public vtkPassInputTypeAlgorithm
57{
58public:
60
65 void PrintSelf(ostream& os, vtkIndent indent) override;
67
69
73 vtkSetMacro(DataType, int);
74 void SetDataTypeToBit() { this->SetDataType(VTK_BIT); }
75 void SetDataTypeToChar() { this->SetDataType(VTK_CHAR); }
76 void SetDataTypeToUnsignedChar() { this->SetDataType(VTK_UNSIGNED_CHAR); }
77 void SetDataTypeToShort() { this->SetDataType(VTK_SHORT); }
78 void SetDataTypeToUnsignedShort() { this->SetDataType(VTK_UNSIGNED_SHORT); }
79 void SetDataTypeToInt() { this->SetDataType(VTK_INT); }
80 void SetDataTypeToUnsignedInt() { this->SetDataType(VTK_UNSIGNED_INT); }
81 void SetDataTypeToLong() { this->SetDataType(VTK_LONG); }
82 void SetDataTypeToLongLong() { this->SetDataType(VTK_LONG_LONG); }
83 void SetDataTypeToUnsignedLong() { this->SetDataType(VTK_UNSIGNED_LONG); }
85 void SetDataTypeToIdType() { this->SetDataType(VTK_ID_TYPE); }
86 void SetDataTypeToFloat() { this->SetDataType(VTK_FLOAT); }
87 void SetDataTypeToDouble() { this->SetDataType(VTK_DOUBLE); }
88 vtkGetMacro(DataType, int);
90
92
98 vtkSetClampMacro(NumberOfComponents, int, 1, VTK_INT_MAX);
99 vtkGetMacro(NumberOfComponents, int);
101
103
108 vtkSetMacro(MinimumComponentValue, double);
109 vtkGetMacro(MinimumComponentValue, double);
110 void SetComponentRange(double minimumValue, double maximumValue)
111 {
112 this->SetMinimumComponentValue(minimumValue);
113 this->SetMaximumComponentValue(maximumValue);
114 }
116
118
123 vtkSetMacro(MaximumComponentValue, double);
124 vtkGetMacro(MaximumComponentValue, double);
126
128
133 vtkSetClampMacro(NumberOfTuples, vtkIdType, 0, VTK_INT_MAX);
134 vtkGetMacro(NumberOfTuples, vtkIdType);
136
138
142 vtkSetMacro(GeneratePointScalars, vtkTypeBool);
143 vtkGetMacro(GeneratePointScalars, vtkTypeBool);
144 vtkBooleanMacro(GeneratePointScalars, vtkTypeBool);
146
148
152 vtkSetMacro(GeneratePointVectors, vtkTypeBool);
153 vtkGetMacro(GeneratePointVectors, vtkTypeBool);
154 vtkBooleanMacro(GeneratePointVectors, vtkTypeBool);
156
158
162 vtkSetMacro(GeneratePointNormals, vtkTypeBool);
163 vtkGetMacro(GeneratePointNormals, vtkTypeBool);
164 vtkBooleanMacro(GeneratePointNormals, vtkTypeBool);
166
168
172 vtkSetMacro(GeneratePointTensors, vtkTypeBool);
173 vtkGetMacro(GeneratePointTensors, vtkTypeBool);
174 vtkBooleanMacro(GeneratePointTensors, vtkTypeBool);
176
178
183 vtkSetMacro(GeneratePointTCoords, vtkTypeBool);
184 vtkGetMacro(GeneratePointTCoords, vtkTypeBool);
185 vtkBooleanMacro(GeneratePointTCoords, vtkTypeBool);
187
189
196 vtkSetMacro(GeneratePointArray, vtkTypeBool);
197 vtkGetMacro(GeneratePointArray, vtkTypeBool);
198 vtkBooleanMacro(GeneratePointArray, vtkTypeBool);
200
202
206 vtkSetMacro(GenerateCellScalars, vtkTypeBool);
207 vtkGetMacro(GenerateCellScalars, vtkTypeBool);
208 vtkBooleanMacro(GenerateCellScalars, vtkTypeBool);
210
212
216 vtkSetMacro(GenerateCellVectors, vtkTypeBool);
217 vtkGetMacro(GenerateCellVectors, vtkTypeBool);
218 vtkBooleanMacro(GenerateCellVectors, vtkTypeBool);
220
222
226 vtkSetMacro(GenerateCellNormals, vtkTypeBool);
227 vtkGetMacro(GenerateCellNormals, vtkTypeBool);
228 vtkBooleanMacro(GenerateCellNormals, vtkTypeBool);
230
232
236 vtkSetMacro(GenerateCellTensors, vtkTypeBool);
237 vtkGetMacro(GenerateCellTensors, vtkTypeBool);
238 vtkBooleanMacro(GenerateCellTensors, vtkTypeBool);
240
242
247 vtkSetMacro(GenerateCellTCoords, vtkTypeBool);
248 vtkGetMacro(GenerateCellTCoords, vtkTypeBool);
249 vtkBooleanMacro(GenerateCellTCoords, vtkTypeBool);
251
253
260 vtkSetMacro(GenerateCellArray, vtkTypeBool);
261 vtkGetMacro(GenerateCellArray, vtkTypeBool);
262 vtkBooleanMacro(GenerateCellArray, vtkTypeBool);
264
266
270 vtkSetMacro(GenerateFieldArray, vtkTypeBool);
271 vtkGetMacro(GenerateFieldArray, vtkTypeBool);
272 vtkBooleanMacro(GenerateFieldArray, vtkTypeBool);
274
276
281 vtkSetMacro(AttributesConstantPerBlock, bool);
282 vtkGetMacro(AttributesConstantPerBlock, bool);
283 vtkBooleanMacro(AttributesConstantPerBlock, bool);
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
343protected:
345 ~vtkRandomAttributeGenerator() override = default;
346
348 int FillInputPortInformation(int port, vtkInformation* info) override;
349
350 int DataType = VTK_FLOAT;
351 int NumberOfComponents = 1;
352 vtkIdType NumberOfTuples = 0;
353 double MinimumComponentValue = 0.0;
354 double MaximumComponentValue = 1.0;
355
356 vtkTypeBool GeneratePointScalars = 0;
357 vtkTypeBool GeneratePointVectors = 0;
358 vtkTypeBool GeneratePointNormals = 0;
359 vtkTypeBool GeneratePointTCoords = 0;
360 vtkTypeBool GeneratePointTensors = 0;
361 vtkTypeBool GeneratePointArray = 0;
362
363 vtkTypeBool GenerateCellScalars = 0;
364 vtkTypeBool GenerateCellVectors = 0;
365 vtkTypeBool GenerateCellNormals = 0;
366 vtkTypeBool GenerateCellTCoords = 0;
367 vtkTypeBool GenerateCellTensors = 0;
368 vtkTypeBool GenerateCellArray = 0;
369
370 vtkTypeBool GenerateFieldArray = 0;
371 bool AttributesConstantPerBlock = false;
372
377 vtkDataArray* GenerateData(int dataType, vtkIdType numTuples, int numComp, int minComp,
378 int maxComp, double min, double max);
379
384 template <class T>
386 T* data, vtkIdType numTuples, int numComp, int minComp, int maxComp, double min, double max);
387
388 VTK_DEPRECATED_IN_9_4_0("This function has confusing naming and contains implementation details, "
389 "it as been made private.")
390 int RequestData(vtkDataSet* input, vtkDataSet* output);
391 VTK_DEPRECATED_IN_9_4_0("This function has confusing naming and contains implementation details, "
392 "it as been made private.")
393 int RequestData(vtkCompositeDataSet* input, vtkCompositeDataSet* output);
394
395private:
397 void operator=(const vtkRandomAttributeGenerator&) = delete;
398
402 int ProcessDataSet(vtkDataSet* input, vtkDataSet* output);
403 int ProcessComposite(vtkCompositeDataSet* input, vtkCompositeDataSet* output);
404 int ProcessHTG(vtkHyperTreeGrid* input, vtkHyperTreeGrid* output);
405
409 void GeneratePointData(vtkPointData* outputPD, vtkIdType numPts);
410 void GenerateCellData(vtkCellData* outputCD, vtkIdType numCells);
411 void GenerateFieldData(vtkFieldData* outputFD);
412};
413
414VTK_ABI_NAMESPACE_END
415#endif
represent and manipulate cell attribute data
abstract superclass for composite (multi-block or AMR) datasets
abstract superclass for arrays of numeric data
abstract class to specify dataset behavior
Definition vtkDataSet.h:165
represent and manipulate fields of data
A dataset containing a grid of vtkHyperTree instances arranged as a rectilinear grid.
a simple class to control print indentation
Definition vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Superclass for algorithms that produce output of the same type as input.
represent and manipulate point attribute data
generate and create random data attributes
void SetDataTypeToUnsignedChar()
Specify the type of array to create (all components of this array are of this type).
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)
Returns new array with numTuples tuples and numComp components, with values in the range [min,...
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).
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)
Fills data with numTuples tuples and numComp components, with values in the range [min,...
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:64
#define VTK_DEPRECATED_IN_9_4_0(reason)
#define VTK_SHORT
Definition vtkType.h:36
int vtkIdType
Definition vtkType.h:315
#define VTK_UNSIGNED_INT
Definition vtkType.h:39
#define VTK_LONG_LONG
Definition vtkType.h:51
#define VTK_DOUBLE
Definition vtkType.h:43
#define VTK_UNSIGNED_CHAR
Definition vtkType.h:35
#define VTK_UNSIGNED_SHORT
Definition vtkType.h:37
#define VTK_INT
Definition vtkType.h:38
#define VTK_FLOAT
Definition vtkType.h:42
#define VTK_CHAR
Definition vtkType.h:33
#define VTK_UNSIGNED_LONG
Definition vtkType.h:41
#define VTK_BIT
Definition vtkType.h:32
#define VTK_UNSIGNED_LONG_LONG
Definition vtkType.h:52
#define VTK_INT_MAX
Definition vtkType.h:144
#define VTK_LONG
Definition vtkType.h:40
#define VTK_ID_TYPE
Definition vtkType.h:44
#define max(a, b)