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

Method RequestData

IO/NetCDF/vtkNetCDFCAMReader.cxx:539–1159  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

537
538//------------------------------------------------------------------------------
539int vtkNetCDFCAMReader::RequestData(
540 vtkInformation*, vtkInformationVector**, vtkInformationVector* outputVector)
541{
542 if (this->FileName == nullptr || this->ConnectivityFileName == nullptr)
543 {
544 vtkWarningMacro("Missing a file name.");
545 return 0;
546 }
547
548 vtkInformation* outInfo = outputVector->GetInformationObject(0);
549 vtkUnstructuredGrid* output =
550 vtkUnstructuredGrid::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
551
552 vtkDebugMacro(<< "Reading NetCDF CAM file.");
553 this->UpdateProgress(0);
554 if (this->CurrentConnectivityFileName != nullptr &&
555 strcmp(this->CurrentConnectivityFileName, this->ConnectivityFileName) != 0)
556 {
557 this->Internals->closeConnectivity();
558 this->SetCurrentConnectivityFileName(nullptr);
559 }
560 if (this->Internals->nc_connectivity == -1)
561 {
562 if (!this->Internals->openConnectivity(this->ConnectivityFileName))
563 {
564 vtkErrorMacro(<< "Can't read file " << this->ConnectivityFileName);
565 return 0;
566 }
567 this->SetCurrentConnectivityFileName(this->ConnectivityFileName);
568 }
569
570 // read in the points first
571 size_t numLevels = 1; // value for single level
572 const char* levName = nullptr;
573 int levelsid = 0;
574 if (this->VerticalDimension == VERTICAL_DIMENSION_MIDPOINT_LAYERS ||
575 this->VerticalDimension == VERTICAL_DIMENSION_INTERFACE_LAYERS)
576 {
577 levName = (this->VerticalDimension == VERTICAL_DIMENSION_MIDPOINT_LAYERS) ? "lev" : "ilev";
578 int dimid;
579 if (this->Internals->nc_err(nc_inq_dimid(this->Internals->nc_points, levName, &dimid)))
580 {
581 vtkErrorMacro("Cannot find the number of levels (lev dimension).");
582 return 0;
583 }
584 if (this->Internals->nc_err(nc_inq_dimlen(this->Internals->nc_points, dimid, &numLevels)))
585 {
586 return 0;
587 }
588 if (this->Internals->nc_err(nc_inq_varid(this->Internals->nc_points, levName, &levelsid)))
589 {
590 vtkErrorMacro("Cannot find the number of levels (lev variable).");
591 return 0;
592 }
593 int ndims;
594 if (this->Internals->nc_err(nc_inq_varndims(this->Internals->nc_points, levelsid, &ndims)))
595 {
596 return 0;

Callers

nothing calls this directly

Calls 15

GetPartitioningMethod · 0.95
nc_inq_dimidFunction · 0.85
nc_inq_dimlenFunction · 0.85
nc_inq_varidFunction · 0.85
nc_inq_varndimsFunction · 0.85
nc_inq_vardimidFunction · 0.85
nc_inq_vartypeFunction · 0.85
nc_get_vara_doubleFunction · 0.85
nc_get_vara_floatFunction · 0.85
nc_get_vara_intFunction · 0.85
IsCellInvertedFunction · 0.85
nc_inq_varidsFunction · 0.85

Tested by

no test coverage detected