MCPcopy Create free account
hub / github.com/Kitware/VTK / WriteInternal

Method WriteInternal

IO/ParallelXML/vtkXMLPDataObjectWriter.cxx:133–199  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

131
132//------------------------------------------------------------------------------
133int 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 }

Callers

nothing calls this directly

Calls 9

SplitFileNameMethod · 0.95
PrepareSummaryFileMethod · 0.95
DeleteFilesMethod · 0.95
assertFunction · 0.50
GetProgressRangeMethod · 0.45
SetProgressRangeMethod · 0.45
WritePieceInternalMethod · 0.45
GetLocalProcessIdMethod · 0.45

Tested by

no test coverage detected