------------------------------------------------------------------------------
| 679 | |
| 680 | //------------------------------------------------------------------------------ |
| 681 | bool vtkFLUENTReader::PreParseFluentFile() |
| 682 | { |
| 683 | this->FluentFile->clear(); |
| 684 | this->FluentFile->seekg(0, ios::beg); |
| 685 | |
| 686 | while (true) |
| 687 | { |
| 688 | auto character = this->FluentFile->get(); |
| 689 | if (this->FluentFile->eof()) |
| 690 | { |
| 691 | this->UpdateZoneSectionSelection(); |
| 692 | return true; |
| 693 | } |
| 694 | |
| 695 | // Search for new section |
| 696 | if (character == '(') |
| 697 | { |
| 698 | auto nextChar = this->FluentFile->peek(); |
| 699 | if (nextChar < '1' || nextChar > '9') |
| 700 | { |
| 701 | // Drop line |
| 702 | this->FluentFile->ignore(std::numeric_limits<std::streamsize>::max(), '\n'); |
| 703 | continue; |
| 704 | } |
| 705 | |
| 706 | // New section found, keep position |
| 707 | std::streampos pos = this->FluentFile->tellg(); |
| 708 | |
| 709 | // Parse section index |
| 710 | std::string index; |
| 711 | while (true) |
| 712 | { |
| 713 | nextChar = this->FluentFile->get(); |
| 714 | if (this->FluentFile->eof()) |
| 715 | { |
| 716 | this->UpdateZoneSectionSelection(); |
| 717 | return true; |
| 718 | } |
| 719 | if (nextChar == ' ') |
| 720 | { |
| 721 | break; |
| 722 | } |
| 723 | if (nextChar == '(') |
| 724 | { |
| 725 | this->FluentFile->unget(); |
| 726 | break; |
| 727 | } |
| 728 | index += static_cast<char>(nextChar); |
| 729 | } |
| 730 | |
| 731 | unsigned int zoneId; |
| 732 | VTK_FROM_CHARS_IF_ERROR_RETURN(index, zoneId, false); |
| 733 | switch (zoneId) |
| 734 | { |
| 735 | // Indices 39 and 45 describe zone sections (such as fluid, wall, pressure-outlet,...). |
| 736 | // Each zone section will be a different block in the output multiblock dataset. |
| 737 | case 39: |
| 738 | if (!this->ReadZoneSection(4)) |
no test coverage detected