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

Method InitializeDimension

IO/NetCDF/vtkMPASReader.cxx:416–444  ·  view source on GitHub ↗

------------------------------------------------------------------------------ For an arbitrary (i.e. not nCells, nVertices, or Time) dimension, extract the dimension's metadata into memory (if needed) and return the last used index into the dimension values, or 0 if the dimension is new. For an arbitrary (i.e. not nCells, nVertices, or Time) dimension, extract ------------------------------------

Source from the content-addressed store, hash-verified

414// For an arbitrary (i.e. not nCells, nVertices, or Time) dimension, extract
415//------------------------------------------------------------------------------
416long vtkMPASReader::Internal::InitializeDimension(int nc_dim)
417{
418 char name[NC_MAX_NAME + 1];
419 if (nc_err(nc_inq_dimname(ncFile, nc_dim, name)))
420 {
421 return false;
422 }
423 Internal::DimMetaDataMap::const_iterator match = dimMetaDataMap.find(name);
424
425 long result = 0;
426 if (match == dimMetaDataMap.end())
427 {
428 DimMetaData metaData;
429 metaData.curIdx = result;
430 if (nc_err(nc_inq_dimlen(ncFile, nc_dim, &metaData.dimSize)))
431 {
432 return -1;
433 }
434
435 dimMetaDataMap.insert(std::make_pair(std::string(name), metaData));
436 dimMetaDataTime.Modified();
437 }
438 else
439 {
440 result = match->second.curIdx;
441 }
442
443 return result;
444}
445
446//------------------------------------------------------------------------------
447vtkIdType vtkMPASReader::Internal::ComputeNumberOfTuples(int nc_var) const

Callers 1

BuildVarArraysMethod · 0.80

Calls 7

nc_inq_dimnameFunction · 0.85
nc_inq_dimlenFunction · 0.85
stringClass · 0.50
findMethod · 0.45
endMethod · 0.45
insertMethod · 0.45
ModifiedMethod · 0.45

Tested by

no test coverage detected