------------------------------------------------------------------------------
| 22 | |
| 23 | //------------------------------------------------------------------------------ |
| 24 | vtkTypeBool vtkReaderAlgorithm::ProcessRequest( |
| 25 | vtkInformation* request, vtkInformationVector** vtkNotUsed(inInfo), vtkInformationVector* outInfo) |
| 26 | { |
| 27 | using vtkSDDP = vtkStreamingDemandDrivenPipeline; |
| 28 | vtkInformation* reqs = outInfo->GetInformationObject(0); |
| 29 | const int hasTime = reqs->Has(vtkSDDP::UPDATE_TIME_STEP()); |
| 30 | const double* steps = reqs->Get(vtkStreamingDemandDrivenPipeline::TIME_STEPS()); |
| 31 | int timeIndex = 0; |
| 32 | if (hasTime && steps) |
| 33 | { |
| 34 | double requestedTimeStep = reqs->Get(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP()); |
| 35 | |
| 36 | int length = reqs->Length(vtkStreamingDemandDrivenPipeline::TIME_STEPS()); |
| 37 | |
| 38 | // find the first time value larger than requested time value |
| 39 | // this logic could be improved |
| 40 | int cnt = 0; |
| 41 | while (cnt < length - 1 && steps[cnt] < requestedTimeStep) |
| 42 | { |
| 43 | cnt++; |
| 44 | } |
| 45 | timeIndex = cnt; |
| 46 | } |
| 47 | |
| 48 | int result = 1; |
| 49 | if (request->Has(vtkSDDP::REQUEST_DATA_OBJECT())) |
| 50 | { |
| 51 | vtkDataObject* currentOutput = vtkDataObject::GetData(outInfo); |
| 52 | vtkDataObject* output = this->CreateOutput(currentOutput); |
| 53 | if (output) |
| 54 | { |
| 55 | result = 1; |
| 56 | if (output != currentOutput) |
| 57 | { |
| 58 | outInfo->GetInformationObject(0)->Set(vtkDataObject::DATA_OBJECT(), output); |
| 59 | output->Delete(); |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | else if (request->Has(vtkSDDP::REQUEST_INFORMATION())) |
| 64 | { |
| 65 | try |
| 66 | { |
| 67 | result = this->ReadMetaData(outInfo->GetInformationObject(0)); |
| 68 | } |
| 69 | catch (const std::exception&) |
| 70 | { |
| 71 | result = 0; |
| 72 | } |
| 73 | } |
| 74 | else if (request->Has(vtkSDDP::REQUEST_TIME_DEPENDENT_INFORMATION())) |
| 75 | { |
| 76 | try |
| 77 | { |
| 78 | result = this->ReadTimeDependentMetaData(timeIndex, outInfo->GetInformationObject(0)); |
| 79 | } |
| 80 | catch (const std::exception&) |
| 81 | { |
nothing calls this directly
no test coverage detected