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

Method get_vars_double

IO/NetCDF/vtkXArrayAccessor.cxx:504–530  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

502}
503
504int vtkXArrayAccessor::get_vars_double(int vtkNotUsed(ncid), int varid, const size_t* startp,
505 const size_t* countp, const ptrdiff_t* vtkNotUsed(stridep), double* ip)
506{
507 if (static_cast<size_t>(varid) >= this->Var.size())
508 return NC_ENOTVAR;
509 size_t ndims = this->VarDims[varid].size();
510 if (std::any_of(countp, countp + ndims, [](size_t val) { return val == 0; }))
511 {
512 vtkErrorMacro("Invalid countp: one of the elements is 0");
513 return NC_ERANGE;
514 }
515
516 char* arrayStart;
517 vtkIdType arraySize;
518 int vtkType = NetCDFTypeToVTKType(this->VarType[varid]);
519 if (this->IsContiguous(varid, startp, countp))
520 {
521 this->GetContiguousStartSize(varid, startp, countp, arrayStart, arraySize);
522 for (vtkIdType i = 0; i < arraySize; ++i)
523 copyToDouble(vtkType, arrayStart + i * VTKSizeof(vtkType), ip + i);
524 }
525 else
526 {
527 this->Copy(varid, startp, countp, reinterpret_cast<char*>(ip));
528 }
529 return NC_NOERR;
530}
531
532int vtkXArrayAccessor::get_var_double(int ncid, int varid, double* ip)
533{

Callers 1

LoadMetaDataMethod · 0.45

Calls 7

IsContiguousMethod · 0.95
CopyMethod · 0.95
copyToDoubleFunction · 0.85
VTKSizeofFunction · 0.85
NetCDFTypeToVTKTypeFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected