------------------------------------------------------------------------------
| 187 | |
| 188 | //------------------------------------------------------------------------------ |
| 189 | void vtkReduceTable::ReduceValuesToMean( |
| 190 | vtkTable* input, vtkTable* output, vtkIdType row, vtkIdType col, std::vector<vtkIdType> oldRows) |
| 191 | { |
| 192 | if (!input->GetValue(0, col).IsNumeric()) |
| 193 | { |
| 194 | vtkErrorMacro(<< "Mean is unsupported for non-numerical data"); |
| 195 | return; |
| 196 | } |
| 197 | |
| 198 | double mean = 0.0; |
| 199 | for (std::vector<vtkIdType>::iterator itr = oldRows.begin(); itr != oldRows.end(); ++itr) |
| 200 | { |
| 201 | mean += input->GetValue(*itr, col).ToDouble(); |
| 202 | } |
| 203 | mean /= oldRows.size(); |
| 204 | output->SetValue(row, col, vtkVariant(mean)); |
| 205 | } |
| 206 | |
| 207 | //------------------------------------------------------------------------------ |
| 208 | void vtkReduceTable::ReduceValuesToMedian( |
no test coverage detected