MCPcopy Create free account
hub / github.com/Kitware/VTK / GenerateRandomTuples

Method GenerateRandomTuples

Filters/General/vtkRandomAttributeGenerator.cxx:84–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82// assumed that the input data array may have a variable number of components.
83template <class T>
84void vtkRandomAttributeGenerator::GenerateRandomTuples(
85 T* data, vtkIdType numTuples, int numComp, int minComp, int maxComp, double min, double max)
86{
87 if (numTuples == 0)
88 {
89 return;
90 }
91 vtkIdType total = numComp * numTuples;
92 vtkIdType tenth = total / 10 + 1;
93 ::GenerateRandomTuple(data, 0, numComp, minComp, maxComp, min, max);
94 for (vtkIdType i = 1; i < numTuples; i++)
95 {
96 // update progress and check for aborts
97 if (!(i % tenth))
98 {
99 this->UpdateProgress(static_cast<double>(i) / total);
100 if (this->CheckAbort())
101 {
102 break;
103 }
104 }
105 if (this->AttributesConstantPerBlock)
106 {
107 ::CopyTupleFrom0(data, i, numComp, minComp, maxComp);
108 }
109 else
110 {
111 ::GenerateRandomTuple(data, i, numComp, minComp, maxComp, min, max);
112 }
113 }
114}
115
116//------------------------------------------------------------------------------
117// This method does the data type allocation and switching for various types.

Callers 1

GenerateDataMethod · 0.95

Calls 4

GenerateRandomTupleFunction · 0.85
CopyTupleFrom0Function · 0.85
CheckAbortMethod · 0.80
UpdateProgressMethod · 0.45

Tested by

no test coverage detected