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

Method RequestInformation

IO/NetCDF/vtkNetCDFCAMReader.cxx:288–380  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

286
287//------------------------------------------------------------------------------
288int vtkNetCDFCAMReader::RequestInformation(vtkInformation* vtkNotUsed(reqInfo),
289 vtkInformationVector** vtkNotUsed(inputVector), vtkInformationVector* outputVector)
290{
291 if (this->FileName == nullptr)
292 {
293 vtkWarningMacro("Missing a file name.");
294 return 0;
295 }
296
297 if (this->CurrentFileName != nullptr && strcmp(this->CurrentFileName, this->FileName) != 0)
298 {
299 this->Internals->closePoints();
300 this->PointDataArraySelection->RemoveAllArrays();
301 this->SetCurrentFileName(nullptr);
302 }
303 if (this->Internals->nc_points == -1)
304 {
305 if (!this->Internals->openPoints(this->FileName))
306 {
307 vtkErrorMacro(<< "Can't read file " << this->FileName);
308 return 0;
309 }
310 this->SetCurrentFileName(this->FileName);
311 this->BuildVarArray();
312 int dimid;
313 if (!this->Internals->nc_err(nc_inq_dimid(this->Internals->nc_points, "lev", &dimid), false))
314 {
315 size_t size;
316 if (this->Internals->nc_err(nc_inq_dimlen(this->Internals->nc_points, dimid, &size)))
317 {
318 return 0;
319 }
320 this->MidpointLayersRange[1] = static_cast<int>(size - 1);
321 }
322 if (!this->Internals->nc_err(nc_inq_dimid(this->Internals->nc_points, "ilev", &dimid), false))
323 {
324 size_t size;
325 if (this->Internals->nc_err(nc_inq_dimlen(this->Internals->nc_points, dimid, &size)))
326 {
327 return 0;
328 }
329 this->InterfaceLayersRange[1] = static_cast<int>(size - 1);
330 }
331 }
332 int dimid;
333 if (this->Internals->nc_err(nc_inq_dimid(this->Internals->nc_points, "time", &dimid)))
334 {
335 vtkErrorMacro("Cannot find the number of time steps (time dimension).");
336 return 0;
337 }
338 size_t size;
339 if (this->Internals->nc_err(nc_inq_dimlen(this->Internals->nc_points, dimid, &size)))
340 {
341 return 0;
342 }
343 this->NumberOfTimeSteps = size;
344 vtkInformation* outInfo = outputVector->GetInformationObject(0);
345

Callers

nothing calls this directly

Calls 12

BuildVarArrayMethod · 0.95
nc_inq_dimidFunction · 0.85
nc_inq_dimlenFunction · 0.85
nc_inq_varidFunction · 0.85
nc_get_vara_doubleFunction · 0.85
closePointsMethod · 0.80
RemoveAllArraysMethod · 0.80
openPointsMethod · 0.80
GetInformationObjectMethod · 0.80
nc_errMethod · 0.45
SetMethod · 0.45
RemoveMethod · 0.45

Tested by

no test coverage detected