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

Method ReadMetaDataSimple

IO/Legacy/vtkStructuredGridReader.cxx:41–136  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

39
40//------------------------------------------------------------------------------
41int vtkStructuredGridReader::ReadMetaDataSimple(const std::string& fname, vtkInformation* metadata)
42{
43 char line[256];
44 bool dimsRead = false;
45
46 if (!this->OpenVTKFile(fname.c_str()) || !this->ReadHeader(fname.c_str()))
47 {
48 return 1;
49 }
50
51 // Read structured grid specific stuff
52 //
53 if (!this->ReadString(line))
54 {
55 vtkErrorMacro(<< "Data file ends prematurely!");
56 this->CloseVTKFile();
57 return 1;
58 }
59
60 if (!strncmp(this->LowerCase(line), "dataset", 7))
61 {
62 // Make sure we're reading right type of geometry
63 //
64 if (!this->ReadString(line))
65 {
66 vtkErrorMacro(<< "Data file ends prematurely!");
67 this->CloseVTKFile();
68 return 1;
69 }
70
71 if (strncmp(this->LowerCase(line), "structured_grid", 15) != 0)
72 {
73 vtkErrorMacro(<< "Cannot read dataset type: " << line);
74 this->CloseVTKFile();
75 return 1;
76 }
77
78 // Read keyword and dimensions
79 //
80 while (true)
81 {
82 if (!this->ReadString(line))
83 {
84 break;
85 }
86
87 // Have to read field data because it may be binary.
88 if (!strncmp(this->LowerCase(line), "field", 5))
89 {
90 vtkFieldData* fd = this->ReadFieldData();
91 fd->Delete();
92 }
93
94 if (!strncmp(this->LowerCase(line), "dimensions", 10) && !dimsRead)
95 {
96 int dim[3];
97 if (!(this->Read(dim) && this->Read(dim + 1) && this->Read(dim + 2)))
98 {

Callers

nothing calls this directly

Calls 10

ReadStringMethod · 0.80
DeleteMethod · 0.65
OpenVTKFileMethod · 0.45
c_strMethod · 0.45
ReadHeaderMethod · 0.45
CloseVTKFileMethod · 0.45
LowerCaseMethod · 0.45
ReadFieldDataMethod · 0.45
ReadMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected