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

Method ReadMeshSimple

IO/Legacy/vtkUnstructuredGridReader.cxx:51–359  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

49
50//------------------------------------------------------------------------------
51int vtkUnstructuredGridReader::ReadMeshSimple(const std::string& fname, vtkDataObject* doOutput)
52{
53 vtkIdType i, numPts = 0, numCells = 0;
54 char line[256];
55 vtkIdType npts, size = 0, ncells = 0;
56 int piece, numPieces, skip1, read2, skip3, tmp;
57 vtkCellArray* cells = nullptr;
58 int* types = nullptr;
59 vtkUnstructuredGrid* output = vtkUnstructuredGrid::SafeDownCast(doOutput);
60
61 vtkDebugMacro(<< "Reading vtk unstructured grid...");
62
63 if (!this->OpenVTKFile(fname.c_str()) || !this->ReadHeader(fname.c_str()))
64 {
65 return 1;
66 }
67
68 // Read unstructured grid specific stuff
69 //
70 if (!this->ReadString(line))
71 {
72 vtkErrorMacro(<< "Data file ends prematurely!");
73 this->CloseVTKFile();
74 return 1;
75 }
76
77 if (!strncmp(this->LowerCase(line), "dataset", 7))
78 {
79 // Make sure we're reading right type of geometry
80 //
81 if (!this->ReadString(line))
82 {
83 vtkErrorMacro(<< "Data file ends prematurely!");
84 this->CloseVTKFile();
85 return 1;
86 }
87
88 if (strncmp(this->LowerCase(line), "unstructured_grid", 17) != 0)
89 {
90 vtkErrorMacro(<< "Cannot read dataset type: " << line);
91 this->CloseVTKFile();
92 return 1;
93 }
94
95 // Might find points, cells, and cell types
96 //
97 while (true)
98 {
99 if (!this->ReadString(line))
100 {
101 break;
102 }
103
104 if (!strncmp(this->LowerCase(line), "field", 5))
105 {
106 vtkFieldData* fd = this->ReadFieldData();
107 output->SetFieldData(fd);
108 fd->Delete(); // ?

Callers

nothing calls this directly

Calls 15

vtkUpdateCellsV8toV9Function · 0.85
ReadStringMethod · 0.80
ReadPointCoordinatesMethod · 0.80
ReadCellsLegacyMethod · 0.80
ImportLegacyFormatMethod · 0.80
GetFileTypeMethod · 0.80
ReadPointDataMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
OpenVTKFileMethod · 0.45
c_strMethod · 0.45
ReadHeaderMethod · 0.45

Tested by

no test coverage detected