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

Method ReadMeshSimple

IO/Legacy/vtkDataObjectReader.cxx:36–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36int vtkDataObjectReader::ReadMeshSimple(const std::string& fname, vtkDataObject* output)
37{
38 char line[256];
39 vtkFieldData* field = nullptr;
40
41 vtkDebugMacro(<< "Reading vtk field data...");
42
43 if (!(this->OpenVTKFile(fname.c_str())) || !this->ReadHeader())
44 {
45 return 1;
46 }
47
48 // Read field data until end-of-file
49 //
50 while (this->ReadString(line) && !field)
51 {
52 if (!strncmp(this->LowerCase(line), "field", (unsigned long)5))
53 {
54 field = this->ReadFieldData(); // reads named field (or first found)
55 if (field != nullptr)
56 {
57 output->SetFieldData(field);
58 field->Delete();
59 }
60 }
61
62 else if (!strncmp(this->LowerCase(line), "dataset", 7))
63 {
64 vtkErrorMacro(<< "Field reader cannot read datasets");
65 this->CloseVTKFile();
66 return 1;
67 }
68
69 else
70 {
71 vtkErrorMacro(<< "Unrecognized keyword: " << line);
72 this->CloseVTKFile();
73 return 1;
74 }
75 }
76 // while field not read
77
78 this->CloseVTKFile();
79
80 return 1;
81}
82
83int vtkDataObjectReader::FillOutputPortInformation(int, vtkInformation* info)
84{

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected