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

Method ParseSparseness

IO/Infovis/vtkBiomTableReader.cxx:286–327  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

284
285//------------------------------------------------------------------------------
286void vtkBiomTableReader::ParseSparseness()
287{
288 // find "matrix_type":
289 size_t pos1 = this->FileContents.find("\"matrix_type\":");
290 if (pos1 == std::string::npos)
291 {
292 vtkErrorMacro(<< "matrix_type not found in input file");
293 return;
294 }
295
296 // find first double quote
297 size_t pos2 = this->FileContents.find('\"', pos1 + 13);
298 if (pos2 == std::string::npos)
299 {
300 vtkErrorMacro(<< "matrix_type field not formatted properly");
301 return;
302 }
303
304 // find second double quote
305 size_t pos3 = this->FileContents.find('\"', pos2 + 1);
306 if (pos2 == std::string::npos)
307 {
308 vtkErrorMacro(<< "matrix_type field not formatted properly");
309 return;
310 }
311
312 // We should find either 'sparse' or 'dense' between these quotes
313 std::string matrix_type = this->FileContents.substr(pos2 + 1, pos3 - pos2 - 1);
314 if (matrix_type == "sparse")
315 {
316 this->Sparse = true;
317 }
318 else if (matrix_type == "dense")
319 {
320 this->Sparse = false;
321 }
322 else
323 {
324 vtkErrorMacro(<< "matrix_type field not formatted properly");
325 return;
326 }
327}
328
329//------------------------------------------------------------------------------
330void vtkBiomTableReader::ParseSparseData()

Callers 1

ReadMeshSimpleMethod · 0.95

Calls 1

findMethod · 0.45

Tested by

no test coverage detected