| 2487 | } |
| 2488 | |
| 2489 | int 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 | { |
no test coverage detected