| 82 | // assumed that the input data array may have a variable number of components. |
| 83 | template <class T> |
| 84 | void 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. |
no test coverage detected