------------------------------------------------------------------------------
| 131 | |
| 132 | //------------------------------------------------------------------------------ |
| 133 | int vtkXMLPDataObjectWriter::WriteInternal() |
| 134 | { |
| 135 | bool beginning = !this->ContinuingExecution; |
| 136 | bool end = true; |
| 137 | |
| 138 | this->ContinuingExecution = false; |
| 139 | this->CurrentPiece = beginning ? this->StartPiece : this->CurrentPiece; |
| 140 | |
| 141 | assert(this->CurrentPiece >= this->StartPiece && this->CurrentPiece <= this->EndPiece); |
| 142 | end = this->CurrentPiece == this->EndPiece; |
| 143 | |
| 144 | if (beginning) |
| 145 | { |
| 146 | // Prepare the file name. |
| 147 | this->SplitFileName(); |
| 148 | delete[] this->PieceWrittenFlags; |
| 149 | this->PieceWrittenFlags = new unsigned char[this->NumberOfPieces]; |
| 150 | memset(this->PieceWrittenFlags, 0, sizeof(unsigned char) * this->NumberOfPieces); |
| 151 | |
| 152 | // Prepare the extension. |
| 153 | this->SetupPieceFileNameExtension(); |
| 154 | } |
| 155 | |
| 156 | // Write the current piece. |
| 157 | |
| 158 | // Split progress range by piece. Just assume all pieces are the |
| 159 | // same size. |
| 160 | float progressRange[2] = { 0.f, 0.f }; |
| 161 | this->GetProgressRange(progressRange); |
| 162 | |
| 163 | this->SetProgressRange( |
| 164 | progressRange, this->CurrentPiece - this->StartPiece, this->EndPiece - this->StartPiece + 1); |
| 165 | |
| 166 | if (!this->WritePieceInternal()) |
| 167 | { |
| 168 | return 0; |
| 169 | } |
| 170 | |
| 171 | // Write the summary file if requested. |
| 172 | if (end && this->WriteSummaryFile) |
| 173 | { |
| 174 | // Decide whether to write the summary file. |
| 175 | bool writeSummaryLocally = |
| 176 | (this->Controller == nullptr || this->Controller->GetLocalProcessId() == 0); |
| 177 | |
| 178 | // Let subclasses collect information, if any to write the summary file. |
| 179 | this->PrepareSummaryFile(); |
| 180 | |
| 181 | if (writeSummaryLocally) |
| 182 | { |
| 183 | if (!this->Superclass::WriteInternal()) |
| 184 | { |
| 185 | vtkErrorMacro("Ran out of disk space; deleting file(s) already written"); |
| 186 | this->DeleteFiles(); |
| 187 | return 0; |
| 188 | } |
| 189 | } |
| 190 | } |
nothing calls this directly
no test coverage detected