------------------------------------------------------------------------------
| 393 | |
| 394 | //------------------------------------------------------------------------------ |
| 395 | int vtkPlot3DMetaReader::RequestData( |
| 396 | vtkInformation*, vtkInformationVector**, vtkInformationVector* outputVector) |
| 397 | { |
| 398 | vtkInformation* outInfo = outputVector->GetInformationObject(0); |
| 399 | vtkMultiBlockDataSet* output = |
| 400 | vtkMultiBlockDataSet::GetData(outputVector->GetInformationObject(0)); |
| 401 | |
| 402 | double timeValue = 0; |
| 403 | if (outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP())) |
| 404 | { |
| 405 | // Get the requested time step. We only support requests of a single time |
| 406 | // step in this reader right now |
| 407 | timeValue = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_TIME_STEP()); |
| 408 | } |
| 409 | |
| 410 | int tsLength = outInfo->Length(vtkStreamingDemandDrivenPipeline::TIME_STEPS()); |
| 411 | double* steps = outInfo->Get(vtkStreamingDemandDrivenPipeline::TIME_STEPS()); |
| 412 | |
| 413 | if (tsLength < 1) |
| 414 | { |
| 415 | vtkErrorMacro("No timesteps were found. Please specify at least one " |
| 416 | "filenames entry in the input file."); |
| 417 | return 0; |
| 418 | } |
| 419 | |
| 420 | // find the first time value larger than requested time value |
| 421 | // this logic could be improved |
| 422 | int cnt = 0; |
| 423 | while (cnt < tsLength - 1 && steps[cnt] < timeValue) |
| 424 | { |
| 425 | cnt++; |
| 426 | } |
| 427 | |
| 428 | int updateTime = cnt; |
| 429 | |
| 430 | if (updateTime >= tsLength) |
| 431 | { |
| 432 | updateTime = tsLength - 1; |
| 433 | } |
| 434 | |
| 435 | if (tsLength > updateTime) |
| 436 | { |
| 437 | this->Reader->SetXYZFileName(this->Internal->TimeSteps[updateTime].XYZFile.c_str()); |
| 438 | const char* qname = this->Internal->TimeSteps[updateTime].QFile.c_str(); |
| 439 | if (strlen(qname) > 0) |
| 440 | { |
| 441 | this->Reader->SetQFileName(qname); |
| 442 | } |
| 443 | else |
| 444 | { |
| 445 | this->Reader->SetQFileName(nullptr); |
| 446 | } |
| 447 | const char* fname = this->Internal->TimeSteps[updateTime].FunctionFile.c_str(); |
| 448 | if (strlen(fname) > 0) |
| 449 | { |
| 450 | this->Reader->SetFunctionFileName(fname); |
| 451 | } |
| 452 | else |
nothing calls this directly
no test coverage detected