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

Method ReadPVTKFileInformation

IO/Parallel/vtkPDataSetReader.cxx:429–631  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

427
428//------------------------------------------------------------------------------
429void vtkPDataSetReader::ReadPVTKFileInformation(
430 istream* file, vtkInformation*, vtkInformationVector**, vtkInformationVector* outputVector)
431{
432 char* block;
433 char* param;
434 char* val;
435 int type;
436 int ext[6];
437 double vect[3];
438 int i;
439 char *pfn, *pdir;
440 int count, dirLength;
441 char dir[512];
442
443 vtkInformation* info = outputVector->GetInformationObject(0);
444
445 // The file block should have a version parameter.
446 type = this->ReadXML(file, &block, &param, &val);
447 if (type != 2 || strcmp(param, "version") != 0)
448 {
449 vtkErrorMacro("Could not find file version.");
450 return;
451 }
452 if (strcmp(val, "pvtk-1.0") != 0)
453 {
454 vtkDebugMacro("Unexpected Version.");
455 }
456
457 // Extract the directory form the filename so we can complete relative paths.
458 count = dirLength = 0;
459 pfn = this->FileName;
460 pdir = dir;
461 // Copy filename to dir, and keep track of the last slash.
462 while (*pfn != '\0' && count < 512)
463 {
464 *pdir++ = *pfn++;
465 ++count;
466 if (*pfn == '/' || *pfn == '\\')
467 {
468 // The extra +1 is to keep the last slash.
469 dirLength = count + 1;
470 }
471 }
472 // This trims off every thing after the last slash.
473 dir[dirLength] = '\0';
474
475 // We are in the start file block.
476 // Read parameters until we terminate the start block.
477 while ((type = this->ReadXML(file, &block, &param, &val)) != 3)
478 {
479 if (type == 0)
480 {
481 vtkErrorMacro("Early termination of pvtk file.");
482 return;
483 }
484 if (type != 2)
485 { // There should be no other possibility. Param will not be nullptr.
486 vtkErrorMacro("Expecting a parameter.");

Callers 1

RequestDataObjectMethod · 0.95

Calls 6

ReadXMLMethod · 0.95
SetNumberOfPiecesMethod · 0.95
GetInformationObjectMethod · 0.80
format_to_nFunction · 0.50
valuesMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected