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

Method RequestData

IO/Chemistry/vtkVASPAnimationReader.cxx:87–125  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

85
86//------------------------------------------------------------------------------
87int vtkVASPAnimationReader::RequestData(
88 vtkInformation*, vtkInformationVector**, vtkInformationVector* outInfos)
89{
90 vtkInformation* outInfo = outInfos->GetInformationObject(0);
91
92 vtkMolecule* output = vtkMolecule::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
93 assert(output);
94
95 vtksys::ifstream in(this->FileName);
96 if (!in)
97 {
98 vtkErrorMacro("Could not open file for reading: " << (this->FileName ? this->FileName : ""));
99 return 1;
100 }
101
102 // Advance to the selected timestep:
103 size_t stepIdx = this->SelectTimeStepIndex(outInfo);
104 double time = 0.;
105 for (size_t i = 0; i <= stepIdx; ++i) // <= to read the "time=" line
106 {
107 if (!this->NextTimeStep(in, time))
108 {
109 vtkErrorMacro("Error -- attempting to read timestep #"
110 << (stepIdx + 1) << " but encountered a parsing error at timestep #" << (i + 1) << ".");
111 return 1;
112 }
113 }
114
115 if (this->ReadMolecule(in, output))
116 {
117 output->GetInformation()->Set(vtkDataObject::DATA_TIME_STEP(), time);
118 }
119 else
120 {
121 output->Initialize();
122 }
123
124 return 1;
125}
126
127//------------------------------------------------------------------------------
128int vtkVASPAnimationReader::RequestInformation(

Callers

nothing calls this directly

Calls 9

SelectTimeStepIndexMethod · 0.95
NextTimeStepMethod · 0.95
ReadMoleculeMethod · 0.95
GetInformationObjectMethod · 0.80
assertFunction · 0.50
GetMethod · 0.45
SetMethod · 0.45
GetInformationMethod · 0.45
InitializeMethod · 0.45

Tested by

no test coverage detected