| 229 | }; |
| 230 | |
| 231 | void BlankToFillValue(vtkUnsignedCharArray* ghostType, vtkDataArray* array, |
| 232 | vtkDataArray* arrayFillValue, int attributeType, int fillValue) |
| 233 | { |
| 234 | // Create our worker functor: |
| 235 | BlankToFillValueWorker worker(ghostType, attributeType, fillValue); |
| 236 | |
| 237 | // Define our dispatcher. We'll let vectors have any ValueType, but only |
| 238 | // consider float/double arrays for magnitudes. These combinations will |
| 239 | // use a 'fast-path' implementation generated by the dispatcher: |
| 240 | typedef vtkArrayDispatch::Dispatch2ByValueType<vtkArrayDispatch::AllTypes, // ValueTypes allowed |
| 241 | // by first array |
| 242 | vtkArrayDispatch::AllTypes> |
| 243 | Dispatcher; |
| 244 | |
| 245 | // Execute the dispatcher: |
| 246 | if (!Dispatcher::Execute(array, arrayFillValue, worker)) |
| 247 | { |
| 248 | // If Execute() fails, it means the dispatch failed due to an |
| 249 | // unsupported array type. In this case, it's likely that the magnitude |
| 250 | // array is using an integral type. This is an uncommon case, so we won't |
| 251 | // generate a fast path for these, but instead call an instantiation of |
| 252 | // CalcMagnitudeWorker::operator()<vtkDataArray, vtkDataArray>. |
| 253 | // Through the use of vtkDataArrayAccessor, this falls back to using the |
| 254 | // vtkDataArray double API: |
| 255 | worker(array, arrayFillValue); |
| 256 | } |
| 257 | } |
| 258 | |
| 259 | } |
| 260 | |