| 356 | } |
| 357 | |
| 358 | bool vtkXArrayAccessor::DecrementAndUpdate(size_t varid, std::vector<size_t>& count, |
| 359 | const size_t* vtkNotUsed(startp), const size_t* countp, const std::vector<size_t>& dimIncrement, |
| 360 | char*& src) |
| 361 | { |
| 362 | size_t ndims = count.size(); |
| 363 | // we need i to signed as we test if it becomes less than 0 |
| 364 | int i = static_cast<int>(ndims - 1); |
| 365 | // first i for which count[i] > 0 |
| 366 | while (i >= 0 && count[i] == 0) |
| 367 | --i; |
| 368 | if (i < 0) |
| 369 | { |
| 370 | // all count is 0, we are done |
| 371 | return false; |
| 372 | } |
| 373 | --count[i]; |
| 374 | if (i == 0 && count[i] == 0) |
| 375 | { |
| 376 | // all count is 0, we are done |
| 377 | return false; |
| 378 | } |
| 379 | |
| 380 | size_t j = i + 1; |
| 381 | size_t length = this->DimLen[this->VarDims[varid][j]]; |
| 382 | length -= countp[j] * dimIncrement[j]; |
| 383 | int vtkType = NetCDFTypeToVTKType(this->VarType[varid]); |
| 384 | src += length * VTKSizeof(vtkType); |
| 385 | |
| 386 | // count[ndims-1] is always 0 |
| 387 | for (size_t k = j; k < count.size() - 1; ++k) |
| 388 | { |
| 389 | count[k] = countp[k]; |
| 390 | } |
| 391 | return true; |
| 392 | } |
| 393 | |
| 394 | void vtkXArrayAccessor::Copy(int varid, const size_t* startp, const size_t* countp, char* dst) |
| 395 | { |
no test coverage detected