------------------------------------------------------------------------------
| 85 | |
| 86 | //------------------------------------------------------------------------------ |
| 87 | int 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 | //------------------------------------------------------------------------------ |
| 128 | int vtkVASPAnimationReader::RequestInformation( |
nothing calls this directly
no test coverage detected