MCPcopy Create free account
hub / github.com/Kitware/VTK / GetCursorForDimension

Method GetCursorForDimension

IO/NetCDF/vtkMPASReader.cxx:354–379  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Return the cursor position for the specified dimension. ------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

352// Return the cursor position for the specified dimension.
353//------------------------------------------------------------------------------
354size_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.

Callers 1

LoadTimeFieldDataMethod · 0.80

Calls 3

nc_inq_dimnameFunction · 0.85
minFunction · 0.50
floorFunction · 0.50

Tested by

no test coverage detected