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

Method RequestInformation

IO/NetCDF/vtkSLACReader.cxx:637–823  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

635
636//------------------------------------------------------------------------------
637int vtkSLACReader::RequestInformation(vtkInformation* vtkNotUsed(request),
638 vtkInformationVector** vtkNotUsed(inputVector), vtkInformationVector* outputVector)
639{
640 vtkInformation* surfaceOutInfo = outputVector->GetInformationObject(SURFACE_OUTPUT);
641 surfaceOutInfo->Remove(vtkStreamingDemandDrivenPipeline::TIME_STEPS());
642 surfaceOutInfo->Remove(vtkStreamingDemandDrivenPipeline::TIME_RANGE());
643
644 vtkInformation* volumeOutInfo = outputVector->GetInformationObject(VOLUME_OUTPUT);
645 volumeOutInfo->Remove(vtkStreamingDemandDrivenPipeline::TIME_STEPS());
646 volumeOutInfo->Remove(vtkStreamingDemandDrivenPipeline::TIME_RANGE());
647
648 if (!this->MeshFileName)
649 {
650 vtkErrorMacro("No filename specified.");
651 return 0;
652 }
653
654 this->Internal->VariableArraySelection->RemoveAllArrays();
655
656 vtkSLACReaderAutoCloseNetCDF meshFD(this->MeshFileName, NC_NOWRITE);
657 if (!meshFD.Valid())
658 return 0;
659
660 this->ReadModeData = false; // Assume false until everything checks out.
661 this->TimeStepModes = false;
662 this->Internal->TimeStepToFile.clear();
663 this->FrequencyModes = false;
664 this->Internal->Frequencies.clear();
665 if (!this->Internal->ModeFileNames.empty())
666 {
667 // Check the first mode file, assume that the rest follow.
668 vtkSLACReaderAutoCloseNetCDF modeFD(this->Internal->ModeFileNames[0].c_str(), NC_NOWRITE);
669 if (!modeFD.Valid())
670 return 0;
671
672 int meshCoordsVarId, modeCoordsVarId;
673 CALL_NETCDF_INT(nc_inq_varid(meshFD, "coords", &meshCoordsVarId));
674 CALL_NETCDF_INT(nc_inq_varid(modeFD, "coords", &modeCoordsVarId));
675
676 if (this->GetNumTuplesInVariable(meshFD, meshCoordsVarId, 3) !=
677 this->GetNumTuplesInVariable(modeFD, modeCoordsVarId, 3))
678 {
679 vtkWarningMacro(<< "Mode file " << this->Internal->ModeFileNames[0]
680 << " invalid for mesh file " << this->MeshFileName
681 << "; the number of coordinates do not match.");
682 }
683 else
684 {
685 this->ReadModeData = true;
686
687 // Read the "frequency". When a time series is written, the frequency
688 // variable is overloaded to mean time. There is no direct way to tell
689 // the difference, but things happen very quickly (less than nanoseconds)
690 // in simulations that write out this data. Thus, we expect large numbers
691 // to be frequency (in Hz) and small numbers to be time (in seconds).
692 double frequency;
693 if ((nc_get_scalar_double(modeFD, "frequency", &frequency) != NC_NOERR) &&
694 (nc_get_scalar_double(modeFD, "frequencyreal", &frequency) != NC_NOERR))

Callers

nothing calls this directly

Calls 15

nc_inq_varidFunction · 0.85
nc_get_scalar_doubleFunction · 0.85
nc_inq_dimidFunction · 0.85
nc_inq_nvarsFunction · 0.85
nc_inq_varndimsFunction · 0.85
nc_inq_vardimidFunction · 0.85
nc_inq_varnameFunction · 0.85
GetInformationObjectMethod · 0.80
RemoveAllArraysMethod · 0.80
assertFunction · 0.50

Tested by

no test coverage detected