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

Method WriteHeader

IO/Legacy/vtkDataWriter.cxx:205–248  ·  view source on GitHub ↗

------------------------------------------------------------------------------ Write the header of a vtk data file. Returns 0 if error.

Source from the content-addressed store, hash-verified

203//------------------------------------------------------------------------------
204// Write the header of a vtk data file. Returns 0 if error.
205int vtkDataWriter::WriteHeader(ostream* fp)
206{
207 vtkDebugMacro(<< "Writing header...");
208
209 // This code will update as the compile time
210 // major and minor versions are updated.
211 int majVersion, minVersion;
212 if (this->FileVersion == VTK_LEGACY_READER_VERSION_4_2)
213 {
214 majVersion = 4;
215 minVersion = 2;
216 }
217 else if (this->FileVersion == VTK_LEGACY_READER_VERSION_5_1)
218 {
219 majVersion = 5;
220 minVersion = 1;
221 }
222 else // future?
223 {
224 majVersion = vtkLegacyReaderMajorVersion;
225 minVersion = vtkLegacyReaderMinorVersion;
226 }
227
228 *fp << "# vtk DataFile Version " << majVersion << "." << minVersion << "\n";
229 *fp << this->Header << "\n";
230
231 if (this->FileType == VTK_ASCII)
232 {
233 *fp << "ASCII\n";
234 }
235 else
236 {
237 *fp << "BINARY\n";
238 }
239
240 fp->flush();
241 if (fp->fail())
242 {
243 this->SetErrorCode(vtkErrorCode::OutOfDiskSpaceError);
244 return 0;
245 }
246
247 return 1;
248}
249
250//------------------------------------------------------------------------------
251// Write the cell data (e.g., scalars, vectors, ...) of a vtk dataset.

Callers 12

WriteDataMethod · 0.45
WriteDataMethod · 0.45
WriteDataMethod · 0.45
WriteDataMethod · 0.45
WriteDataMethod · 0.45
WriteDataMethod · 0.45
WriteDataMethod · 0.45
WriteDataMethod · 0.45
WriteDataMethod · 0.45
WriteDataMethod · 0.45
WriteDataMethod · 0.45
WriteDataMethod · 0.45

Calls 1

flushMethod · 0.45

Tested by

no test coverage detected