------------------------------------------------------------------------------ Return the cursor position for the specified dimension. ------------------------------------------------------------------------------
| 352 | // Return the cursor position for the specified dimension. |
| 353 | //------------------------------------------------------------------------------ |
| 354 | size_t vtkMPASReader::Internal::GetCursorForDimension(int nc_dim) |
| 355 | { |
| 356 | char name[NC_MAX_NAME + 1]; |
| 357 | if (nc_err(nc_inq_dimname(ncFile, nc_dim, name))) |
| 358 | { |
| 359 | return static_cast<size_t>(-1); |
| 360 | } |
| 361 | std::string dimName = name; |
| 362 | if (dimName == "nCells" || dimName == "nVertices") |
| 363 | { |
| 364 | return 0; |
| 365 | } |
| 366 | else if (dimName == "Time") |
| 367 | { |
| 368 | return std::min(static_cast<long>(std::floor(reader->DTime)), |
| 369 | static_cast<long>(reader->NumberOfTimeSteps - 1)); |
| 370 | } |
| 371 | else if (reader->ShowMultilayerView && dimName == reader->VerticalDimension) |
| 372 | { |
| 373 | return 0; |
| 374 | } |
| 375 | else |
| 376 | { |
| 377 | return InitializeDimension(nc_dim); |
| 378 | } |
| 379 | } |
| 380 | |
| 381 | //------------------------------------------------------------------------------ |
| 382 | // Return the number of values to read for the specified dimension. |
no test coverage detected