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

Method ReadMeshSimple

IO/Infovis/vtkBiomTableReader.cxx:64–140  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

62
63//------------------------------------------------------------------------------
64int vtkBiomTableReader::ReadMeshSimple(const std::string& fname, vtkDataObject* doOutput)
65{
66 vtkDebugMacro(<< "Reading biom table...");
67
68 if (fname.empty())
69 {
70 vtkErrorMacro(<< "Input filename not set");
71 return 1;
72 }
73
74 vtksys::ifstream ifs(fname.c_str(), vtksys::ifstream::in);
75 if (!ifs.good())
76 {
77 vtkErrorMacro(<< "Unable to open " << fname << " for reading");
78 return 1;
79 }
80
81 ifs.seekg(0, std::ios::end);
82 this->FileContents.reserve(ifs.tellg());
83 ifs.seekg(0, std::ios::beg);
84
85 this->FileContents.assign(
86 (std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
87
88 this->ParseShape();
89 this->ParseDataType();
90
91 vtkNew<vtkStringArray> rowNames;
92 rowNames->SetName("name");
93 vtkTable* output = vtkTable::SafeDownCast(doOutput);
94 output->AddColumn(rowNames);
95 for (int i = 1; i < this->NumberOfColumns + 1; ++i)
96 {
97 switch (this->DataType)
98 {
99 case VTK_INT:
100 {
101 vtkNew<vtkIntArray> intCol;
102 output->AddColumn(intCol);
103 break;
104 }
105 case VTK_FLOAT:
106 {
107 vtkNew<vtkFloatArray> floatCol;
108 output->AddColumn(floatCol);
109 break;
110 }
111 case VTK_STRING:
112 {
113 vtkNew<vtkStringArray> stringCol;
114 output->AddColumn(stringCol);
115 break;
116 }
117 default:
118 break;
119 }
120 }
121 output->SetNumberOfRows(this->NumberOfRows);

Callers

nothing calls this directly

Calls 15

ParseShapeMethod · 0.95
ParseDataTypeMethod · 0.95
ParseRowsMethod · 0.95
ParseSparsenessMethod · 0.95
InitializeDataMethod · 0.95
ParseSparseDataMethod · 0.95
ParseDenseDataMethod · 0.95
ParseIdMethod · 0.95
ParseColumnsMethod · 0.95
SetNumberOfRowsMethod · 0.80
emptyMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected