------------------------------------------------------------------------------
| 62 | |
| 63 | //------------------------------------------------------------------------------ |
| 64 | vtkTypeBool vtkExtractDataOverTime::ProcessRequest( |
| 65 | vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 66 | { |
| 67 | if (request->Has(vtkDemandDrivenPipeline::REQUEST_INFORMATION())) |
| 68 | { |
| 69 | return this->RequestInformation(request, inputVector, outputVector); |
| 70 | } |
| 71 | else if (request->Has(vtkStreamingDemandDrivenPipeline::REQUEST_UPDATE_EXTENT())) |
| 72 | { |
| 73 | // get the requested update extent |
| 74 | double* inTimes = |
| 75 | inputVector[0]->GetInformationObject(0)->Get(vtkStreamingDemandDrivenPipeline::TIME_STEPS()); |
| 76 | if (inTimes) |
| 77 | { |
| 78 | double timeReq = inTimes[this->CurrentTimeIndex]; |
| 79 | inputVector[0]->GetInformationObject(0)->Set( |
| 80 | vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP(), timeReq); |
| 81 | } |
| 82 | return 1; |
| 83 | } |
| 84 | |
| 85 | // generate the data |
| 86 | else if (request->Has(vtkDemandDrivenPipeline::REQUEST_DATA())) |
| 87 | { |
| 88 | if (this->NumberOfTimeSteps == 0) |
| 89 | { |
| 90 | vtkErrorMacro("No Time steps in input time data!"); |
| 91 | return 0; |
| 92 | } |
| 93 | |
| 94 | // get the output data object |
| 95 | vtkInformation* outInfo = outputVector->GetInformationObject(0); |
| 96 | vtkPointSet* output = vtkPointSet::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 97 | |
| 98 | // and input data object |
| 99 | vtkInformation* inInfo = inputVector[0]->GetInformationObject(0); |
| 100 | vtkPointSet* input = vtkPointSet::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 101 | |
| 102 | // is this the first request |
| 103 | if (!this->CurrentTimeIndex) |
| 104 | { |
| 105 | // Tell the pipeline to start looping. |
| 106 | request->Set(vtkStreamingDemandDrivenPipeline::CONTINUE_EXECUTING(), 1); |
| 107 | this->AllocateOutputData(input, output); |
| 108 | } |
| 109 | |
| 110 | // extract the actual data |
| 111 | output->GetPoints()->SetPoint( |
| 112 | this->CurrentTimeIndex, input->GetPoints()->GetPoint(this->PointIndex)); |
| 113 | output->GetPointData()->CopyData( |
| 114 | input->GetPointData(), this->PointIndex, this->CurrentTimeIndex); |
| 115 | if (input->GetPointData()->GetArray("Time")) |
| 116 | { |
| 117 | output->GetPointData() |
| 118 | ->GetArray("TimeData") |
| 119 | ->SetTuple1( |
| 120 | this->CurrentTimeIndex, input->GetInformation()->Get(vtkDataObject::DATA_TIME_STEP())); |
| 121 | } |
no test coverage detected