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

Method AutoDetectionCheck

IO/Parallel/vtkMultiBlockPLOT3DReader.cxx:2489–2600  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2487}
2488
2489int vtkMultiBlockPLOT3DReader::AutoDetectionCheck(FILE* fp)
2490{
2491 auto& internals = (*this->Internal);
2492
2493 // attempt to auto-detect other settings; we do this irrespective of
2494 // this->AutoDetectionCheck flag; if auto-detection code could successfully
2495 // determine settings and they don't match with the user-specified ones, we
2496 // report an error.
2497 try
2498 {
2499 if (!internals.CheckBinaryFile(fp, this->FileSize))
2500 {
2501 throw "Could not determine binary/ascii file type";
2502 }
2503
2504 if (!internals.Settings.BinaryFile)
2505 {
2506 // ascii file, not much to auto-detect.
2507 vtkDebugMacro("Auto-detection only works with binary files.");
2508 if (this->BinaryFile && !this->AutoDetectFormat)
2509 {
2510 vtkWarningMacro("This appears to be an ASCII file. Please make sure "
2511 "that all settings are correct to read it correctly.");
2512 }
2513 this->Internal->Settings.ByteOrder = this->ByteOrder;
2514 this->Internal->Settings.HasByteCount = this->HasByteCount;
2515 this->Internal->Settings.MultiGrid = this->MultiGrid;
2516 this->Internal->Settings.NumberOfDimensions = this->TwoDimensionalGeometry ? 2 : 3;
2517 this->Internal->Settings.Precision = this->DoublePrecision ? 8 : 4;
2518 this->Internal->Settings.IBlanking = this->IBlanking;
2519 return 1;
2520 }
2521
2522 // binary file, continue with auto-detection.
2523 if (!internals.CheckByteOrder(fp))
2524 {
2525 throw "Could not determine big/little endianness of file.";
2526 }
2527 if (!internals.CheckByteCount(fp))
2528 {
2529 throw "Could not determine if file has Fortran byte counts.";
2530 }
2531
2532 if (!internals.Settings.HasByteCount)
2533 {
2534 if (!internals.CheckCFile(fp, this->FileSize))
2535 {
2536 throw "CheckCFile failed; could not determine settings for file.";
2537 }
2538 }
2539 else
2540 {
2541 if (!internals.CheckMultiGrid(fp))
2542 {
2543 throw "CheckMultiGrid failed; could not determine settings for file.";
2544 }
2545 if (!internals.Check2DGeom(fp))
2546 {

Callers 2

GetTimeValueMethod · 0.95
CanReadBinaryFileMethod · 0.95

Calls 7

CheckBinaryFileMethod · 0.80
CheckByteOrderMethod · 0.80
CheckByteCountMethod · 0.80
CheckCFileMethod · 0.80
CheckMultiGridMethod · 0.80
Check2DGeomMethod · 0.80

Tested by

no test coverage detected