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

Method ReadMeshSimple

IO/Legacy/vtkStructuredGridReader.cxx:139–366  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

137
138//------------------------------------------------------------------------------
139int vtkStructuredGridReader::ReadMeshSimple(const std::string& fname, vtkDataObject* doOutput)
140{
141 vtkIdType numPts = 0, npts = 0, numCells = 0, ncells;
142 char line[256];
143 int dimsRead = 0;
144 vtkStructuredGrid* output = vtkStructuredGrid::SafeDownCast(doOutput);
145
146 vtkDebugMacro(<< "Reading vtk structured grid file...");
147
148 if (!this->OpenVTKFile(fname.c_str()) || !this->ReadHeader(fname.c_str()))
149 {
150 return 1;
151 }
152
153 // Read structured grid specific stuff
154 //
155 if (!this->ReadString(line))
156 {
157 vtkErrorMacro(<< "Data file ends prematurely!");
158 this->CloseVTKFile();
159 return 1;
160 }
161
162 if (!strncmp(this->LowerCase(line), "dataset", 7))
163 {
164 // Make sure we're reading right type of geometry
165 //
166 if (!this->ReadString(line))
167 {
168 vtkErrorMacro(<< "Data file ends prematurely!");
169 this->CloseVTKFile();
170 return 1;
171 }
172
173 if (strncmp(this->LowerCase(line), "structured_grid", 15) != 0)
174 {
175 vtkErrorMacro(<< "Cannot read dataset type: " << line);
176 this->CloseVTKFile();
177 return 1;
178 }
179
180 // Read keyword and number of points
181 //
182 while (true)
183 {
184 if (!this->ReadString(line))
185 {
186 break;
187 }
188
189 if (!strncmp(this->LowerCase(line), "field", 5))
190 {
191 vtkFieldData* fd = this->ReadFieldData();
192 output->SetFieldData(fd);
193 fd->Delete(); // ?
194 }
195
196 else if (!strncmp(line, "extent", 6) && !dimsRead)

Callers

nothing calls this directly

Calls 15

GhostArrayNameFunction · 0.85
ReadStringMethod · 0.80
ReadPointCoordinatesMethod · 0.80
ReadPointDataMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
OpenVTKFileMethod · 0.45
c_strMethod · 0.45
ReadHeaderMethod · 0.45
CloseVTKFileMethod · 0.45
LowerCaseMethod · 0.45
ReadFieldDataMethod · 0.45

Tested by

no test coverage detected