| 58 | } |
| 59 | |
| 60 | vtkTypeBool vtkXMLStatisticalModelWriter::ProcessRequest( |
| 61 | vtkInformation* request, vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 62 | { |
| 63 | // Force the DataMode to be inline. |
| 64 | int prevDataMode = this->DataMode; |
| 65 | this->DataMode = vtkXMLWriter::Ascii; |
| 66 | int result = 1; |
| 67 | // generate the data |
| 68 | if (request->Has(vtkDemandDrivenPipeline::REQUEST_DATA())) |
| 69 | { |
| 70 | this->SetErrorCode(vtkErrorCode::NoError); |
| 71 | |
| 72 | if (!this->Stream && !this->FileName && !this->WriteToOutputString) |
| 73 | { |
| 74 | this->SetErrorCode(vtkErrorCode::NoFileNameError); |
| 75 | vtkErrorMacro("The FileName or Stream must be set first or " |
| 76 | "the output must be written to a string."); |
| 77 | this->DataMode = prevDataMode; |
| 78 | return 0; |
| 79 | } |
| 80 | |
| 81 | float wholeProgressRange[2] = { 0, 1 }; |
| 82 | this->SetProgressRange(wholeProgressRange, 0, 1); |
| 83 | this->UpdateProgress(0); |
| 84 | |
| 85 | if (this->CurrentTimeIndex == 0) |
| 86 | { |
| 87 | // We are just starting to write. Do not call |
| 88 | // UpdateProgressDiscrete because we want a 0 progress callback the |
| 89 | // first time. |
| 90 | this->UpdateProgress(0); |
| 91 | |
| 92 | // Initialize progress range to entire 0..1 range. |
| 93 | this->SetProgressRange(wholeProgressRange, 0, 1); |
| 94 | |
| 95 | if (!this->OpenStream()) |
| 96 | { |
| 97 | this->DataMode = prevDataMode; |
| 98 | return 0; |
| 99 | } |
| 100 | // Force ASCII model data to exactly represent double-precision |
| 101 | // floating-point values: |
| 102 | this->Stream->precision(17); |
| 103 | |
| 104 | if (this->GetDataSetInput() != nullptr) |
| 105 | { |
| 106 | // use the current version for the file. |
| 107 | this->UsePreviousVersion = false; |
| 108 | } |
| 109 | |
| 110 | // Write the file. |
| 111 | if (!this->StartFile()) |
| 112 | { |
| 113 | this->DataMode = prevDataMode; |
| 114 | return 0; |
| 115 | } |
| 116 | |
| 117 | if (!this->WriteHeader()) |
nothing calls this directly
no test coverage detected